Sample
pyint-718c8ac7b580-I12
Inline all eligible single-use intermediate local variables
Scores
| Method | Score | Scale |
|---|---|---|
| Posnett | 0 | 0–1; higher is more readable |
| Dorn | 0.835 | 0–1; higher is more readable |
| Mi | 0.758 | 0–1; higher is more readable |
| LLOC | 19 | 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.669 | 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. | 656.057 | −21.65 |
| Source linesThe number of non-empty source lines. | 27 | +10.8 |
| 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.501 | −6.752 |
Intercept 8.87 + feature contributions = -8.732 (log-odds).
Score = sigmoid(-8.732) = 0.
Feature contributions
| Feature | Value | Contribution (log-odds) |
|---|---|---|
| Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right. | 88 | +0.615 |
| Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *. | 0.053 | +0.425 |
| 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. | 26 | +0.162 |
| 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. | 87.929 | −0.059 |
| Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code. | 28 | +0.045 |
| Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom. | 26.798 | −0.035 |
Intercept 0.07 + feature contributions = 1.621 (log-odds).
Score = sigmoid(1.621) = 0.835.
| Score | 0.758 |
|---|
| Score | 19 |
|---|
Run 1
The code demonstrates strong readability through clear structure and purposeful organization. The _OrValidator class is logically constructed with a straightforward __call__ method that implements the validator pattern effectively. The nesting is minimal with only one level of depth in the try-except-else block, maintaining flatness. Intent is clear: iterate through validators and raise an error if none succeed. Action granularity is appropriate, with each logical operation on its own line. The try-except-else pattern is idiomatic Python for this use case. The unused blank line before the final raise statement and minor formatting inconsistency in whitespace slightly impact flow. Import organization is clean with standard library imports preceding relative imports. The code length is concise for its purpose, avoiding unnecessary verbosity while maintaining clarity. The exception handling comment is informative, explaining why broad exception catching is intentional in this context. Type hints could improve clarity further but the absence doesn't significantly reduce readability.
Run 2
The code is fairly readable and follows common patterns for a validator class using attrs. The structure is logical: imports are grouped, the class is small, and the `__call__` method has a clear loop-and-try pattern. Nesting is minimal, with only one level inside the for loop. However, readability suffers in a few places: the bare `raise ValueError(...)` is preceded by two blank lines, creating awkward vertical whitespace; the broad exception handling is flagged with multiple `noqa` comments that hint at hidden complexity; and the f-string in the error is long and dense. Action granularity is generally good, but the loop body crams several logical steps (validation, exception handling, flow control) into short lines, which slightly obscures intent. Overall, the code is understandable but could be tightened with better spacing and a more explicit error construction. The class is concise, but minor formatting and exception-handling choices prevent it from being highly readable.
Run 3
The code is generally readable, with clear structure and intent. It defines a single class with a clear purpose, uses type hints and modern attrs features. The __call__ method uses a straightforward for-else pattern, but the exception handling (catching broad Exception and intentionally swallowing it) slightly obscures intent. The blank line before the final raise is unnecessary and breaks flow. The nested try-except-else inside a for loop adds moderate nesting but remains understandable. Naming is consistent, and line length is reasonable. Overall, the code is maintainable but could improve error specificity and minor formatting.
Run 1
Code Structure: The class is logically organized into state, validation behavior, and representation, though several unused imports add clutter. Nesting: The loop and try/except/else introduce moderate, manageable nesting. Clarity of intent: The class name, validators attribute, and error message clearly convey that any successful validator is sufficient; the abbreviated variable v and broad exception handling slightly obscure details. Code length: The implementation is concise, but redundant parentheses around the error message and excess blank lines are unnecessary. Action granularity: Each line generally performs one clear action. Reading flow: Validation proceeds naturally from trying alternatives to returning on success or raising on total failure, with only minor formatting distractions.
Run 2
Code Structure: The validator class is logically organized, with separate validation and representation methods, though several imports are unused in this snippet. Nesting: The loop and try/except/else introduce moderate, manageable nesting. Clarity of intent: The class name, validators attribute, and error message clearly convey that any successful validator is sufficient; however, the abbreviated name v and broad exception handling obscure which failures are intentionally ignored. Code length: The implementation is concise, but redundant parentheses around the error message and extra blank lines add minor clutter. Action granularity: Each line generally performs one action. Reading flow: Execution proceeds naturally through attempts, early success, and final failure, although lint-suppression comments slightly interrupt readability.
Run 3
Code Structure: The small validator class logically separates validation behavior from its representation, though several imports appear unused in this snippet. Nesting: The loop and try/except/else introduce moderate nesting, but the early return keeps control flow manageable. Clarity of intent: The class name, validators attribute, and error message clearly communicate that any successful validator is sufficient; the abbreviated variable v and broad exception handling slightly reduce clarity. Code length: The implementation is concise, with minor clutter from unused imports, extra blank lines, and redundant parentheses around the error message. Action granularity: Each line generally performs one clear action. Reading flow: Execution naturally progresses from trying validators to returning on success or raising on total failure, although the noqa directives add visual noise.