Sample
pyint-663027115a63-I02
Shorten method, parameter, and local names without collisions
Scores
| Method | Score | Scale |
|---|---|---|
| Posnett | 0 | 0–1; higher is more readable |
| Dorn | 0.856 | 0–1; higher is more readable |
| Mi | 0.53 | 0–1; higher is more readable |
| LLOC | 16 | Logical lines; fewer is more readable |
| DeepSeek V4 Pro | 15.67 | 0–20; mean of three runs |
| GPT-6.1 Sol | 17 | 0–20; mean of three runs |
| BTTF | 0.567 | 0–1; higher is more readable |
Views
Loading feature diagnosis…
Source regions
Feature contributions
Feature contributions
| Feature | Value | Contribution (log-odds) |
|---|---|---|
| Halstead volumeHow much symbolic information the code contains. It combines the total number of operators and values with the number of distinct ones. | 714.305 | −23.572 |
| Source linesThe number of non-empty source lines. | 29 | +11.6 |
| Byte entropyHow varied the bytes in the source text are. Repeated bytes give a lower value; a more even mixture gives a higher value. | 4.266 | −6.398 |
Intercept 8.87 + feature contributions = -9.501 (log-odds).
Score = sigmoid(-9.501) = 0.
Feature contributions
| Feature | Value | Contribution (log-odds) |
|---|---|---|
| Identifier layout (horizontal)How rapidly the visual pattern of identifier characters changes from left to right. It measures spatial frequency, not the meaning of the names. | 69.967 | +0.702 |
| Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *. | 0.054 | +0.42 |
| Number layout frequencyHow rapidly the number of numeric values per line changes through the code. | 1 | +0.398 |
| Indentation frequencyHow rapidly indentation changes from line to line. | 27 | +0.197 |
| Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right. | 51.767 | +0.031 |
| Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code. | 30 | −0.026 |
| Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom. | 28.859 | −0.006 |
Intercept 0.07 + feature contributions = 1.785 (log-odds).
Score = sigmoid(1.785) = 0.856.
| Score | 0.53 |
|---|
| Score | 16 |
|---|
Run 1
The code is generally readable: imports are organized, the class and method names are clear, and the validator's purpose is evident. The error message formatting is straightforward and uses a reasonable line-breaking style. However, a few points reduce clarity: the @attrs decorator with multiple boolean flags is terse and may require knowledge of the attrs library; the 'mes' variable is abbreviated; and the multi-line string concatenation inside the if block slightly disrupts reading flow. Nesting is minimal, and each logical action (checking callability, formatting, raising) is separated, but the code could benefit from slightly more descriptive naming and a clearer separation between validation logic and error message construction.
Run 2
The code is generally well-structured and readable. Imports are organized, and the class and method are clearly named. The validation logic is clear, with a helpful error message. However, some minor readability issues: the error message construction spans multiple nested levels (string formatting inside raise), slightly reducing flatness, and the method mixes validation logic with message assembly in one block. The use of a callable class for repr customization is clear, but slightly increases cognitive overhead for beginners. Overall, concise, purposeful, and maintainable.
Run 3
The code is generally readable with a clear structure: imports are organized by source, the class is decorated cleanly with attrs, and the validator's purpose is evident from its name and docstring. The `__call__` method has a single responsibility (validating callability) and constructs an informative error message. The use of a multi-line string for `mes` improves readability, and the `repr` is concise. Minor deductions: the variable `mes` is slightly opaque (could be `message`), and the conditional structure, while simple, could benefit from an early return or guard clause to reduce nesting. Overall, the code is flat, reasonably concise, and follows natural reading flow, but a few naming and structural refinements would improve clarity.
Run 1
Code Structure: The validator is logically organized into validation and representation methods, although numerous unused imports distract from the small example. Nesting: Shallow nesting makes control flow easy to follow; multiline exception construction remains manageable. Clarity of intent: The class name, callable check, and descriptive error clearly communicate the purpose, but abbreviated parameters and 'mes' reduce clarity, and the docstring explains the class design rather than the method's behavior. Code length: The implementation is concise, though the imports add unnecessary length in this snippet. Action granularity: Each statement performs a single clear action, with readable multiline formatting. Reading flow: The code proceeds naturally from validation to error reporting and representation, with minor friction from terse names and unexplained decorator options.
Run 2
Code Structure: Imports and a small validator class are logically organized, with validation and representation separated. Nesting: A single conditional keeps control flow shallow; nested formatting adds little difficulty. Clarity of intent: The class name, callable check, and descriptive exception clearly convey the purpose, though abbreviated parameters (ins, att, val) and mes reduce clarity, and the decorator requires library knowledge. Code length: The implementation is concise, but several imports are unused in this snippet, and the docstring explains the class design rather than the method's behavior. Action granularity: Each statement performs one main action, with readable multiline error construction. Reading flow: Execution proceeds naturally from checking the value to raising an informative error, followed by a simple representation method.
Run 3
1. Code Structure: Imports and a small validator class are logically organized, although several imports are unused in this snippet. 2. Nesting: Shallow control flow makes the validation easy to follow; multiline formatting adds little complexity. 3. Clarity of intent: The class name, callable check, and descriptive exception clearly communicate the purpose, but abbreviated names such as ins, att, val, and mes reduce clarity. The docstring explains the class design rather than the method's behavior. 4. Code length: Concise overall, with some unnecessary imports and slightly verbose message construction. 5. Action granularity: Each statement performs one clear action, and exception arguments are separated cleanly. 6. Reading flow: The progression from checking callability to raising an informative error is natural, followed by a straightforward representation method.