Sample
pyint-fe4f113dcd2e-I02
Shorten method, parameter, and local names without collisions
Scores
| Method | Score | Scale |
|---|---|---|
| Posnett | 0 | 0–1; higher is more readable |
| Dorn | 0.837 | 0–1; higher is more readable |
| Mi | 0.278 | 0–1; higher is more readable |
| LLOC | 17 | Logical lines; fewer is more readable |
| DeepSeek V4 Pro | 16.67 | 0–20; mean of three runs |
| GPT-6.1 Sol | 17.33 | 0–20; mean of three runs |
| BTTF | 0.597 | 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. | 578.587 | −19.093 |
| Source linesThe number of non-empty source lines. | 23 | +9.2 |
| 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.611 | −6.916 |
Intercept 8.87 + feature contributions = -7.939 (log-odds).
Score = sigmoid(-7.939) = 0.
Feature contributions
| Feature | Value | Contribution (log-odds) |
|---|---|---|
| Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right. | 84.833 | +0.564 |
| Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *. | 0.05 | +0.455 |
| Number layout frequencyHow rapidly the number of numeric values per line changes through the code. | 1 | +0.398 |
| Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code. | 24 | +0.187 |
| Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom. | 22.802 | −0.091 |
| 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. | 84.958 | +0.067 |
| Indentation frequencyHow rapidly indentation changes from line to line. | 21 | −0.011 |
Intercept 0.07 + feature contributions = 1.639 (log-odds).
Score = sigmoid(1.639) = 0.837.
| Score | 0.278 |
|---|
| Score | 17 |
|---|
Run 1
The code is generally readable with clear structure: imports are organized, the class is logically defined with a focused single responsibility, and methods are concise. Intent is straightforward — validate minimum length. The nesting is minimal (one if statement), and the action granularity is clean (one meaningful action per line). Naming is mostly clear, though `ins` and `att` are slightly terse; `val` is acceptable. The `__repr__` method enhances debuggability. Minor deductions: the `msg2` variable name is arbitrary (likely should be `msg`), and unused imports (`operator`, `re`, `Pattern`, etc.) add noise. The docstring inside `__call__` explains the class choice but feels slightly misplaced. Overall, the code is flat, purposeful, and readable, losing points for minor naming and import clutter.
Run 2
The code is well-structured and readable. It has clear logical organization with imports grouped conventionally. Nesting is minimal, with only a single conditional inside the __call__ method. The intent is clear: a frozen validator class enforcing minimum length with a custom repr. Code length is concise and appropriate for its purpose. Action granularity is good, with one action per line. Reading flow is natural, from imports to class definition and methods. Minor deductions: the explanatory docstring could be more precise, and the unused imports (operator, re, Pattern, contextmanager, etc.) slightly reduce clarity about actual dependencies.
Run 3
The code is well-structured and highly readable. It uses the attrs library concisely to define a frozen, slotted validator class, with clear intent in the class name and method names. The `__call__` method has a single level of nesting and one clear action: validate length, then raise if invalid. The `__repr__` method is declarative and matches the comment about changing representation. Imports are logically grouped and necessary. The only minor weakness is the unused import of `operator`, `re`, `Pattern`, `get_run_validators`, `set_run_validators`, `_AndValidator`, `and_`, and `default_if_none` in this snippet, which slightly reduces clarity if this is the entire module. Otherwise, length is appropriate, action granularity is clean, and reading flow is natural.
Run 1
Code Structure: The validator is logically organized into configuration, validation, and representation methods, although numerous unused imports add clutter. Nesting: A single conditional keeps the code flat and easy to follow. Clarity of intent: The class name, min_length attribute, comparison, and error message clearly communicate minimum-length validation; abbreviated parameters and the name msg2 are less descriptive. Code length: The implementation is concise, though imports unrelated to the shown functionality increase unnecessary length. Action granularity: Each statement performs one clear action. Reading flow: The progression from stored threshold to validation to representation is natural, but the __call__ docstring explains representation customization rather than the method's validation behavior.
Run 2
Code Structure: The validator class logically groups configuration, validation, and representation, although numerous unused imports add clutter. Nesting: Methods are flat, with only one conditional. Clarity of intent: The class name and comparison clearly express minimum-length validation; abbreviated parameters and the generic name msg2 reduce clarity. The docstring explains the callable-class design rather than the method's behavior. Code length: The implementation is concise, but unused imports unnecessarily lengthen the snippet. Action granularity: Each statement performs one clear action. Reading flow: Configuration, validation, and representation appear in a natural order, though import clutter and limited spacing around the class slightly weaken presentation.
Run 3
Code Structure: The validator is logically organized into state, validation behavior, and representation, though numerous unused imports add clutter. Nesting: Only a single conditional keeps the code flat and easy to follow. Clarity of intent: The class name, min_length attribute, and error message clearly communicate minimum-length validation; abbreviated parameters and the name msg2 reduce clarity slightly. Code length: The class is concise, but unnecessary imports and a docstring focused on implementation rationale rather than validation behavior weaken its economy. Action granularity: Each line performs one clear action. Reading flow: The progression from configuration to validation to representation is natural, although the unrelated imports distract from the small implementation.