Sample
pyint-7dca19c97af9-I12
Inline all eligible single-use intermediate local variables
Scores
| Method | Score | Scale |
|---|---|---|
| Posnett | 0 | 0–1; higher is more readable |
| Dorn | 0.769 | 0–1; higher is more readable |
| Mi | 0.613 | 0–1; higher is more readable |
| LLOC | 16 | Logical lines; fewer is more readable |
| DeepSeek V4 Pro | 15.33 | 0–20; mean of three runs |
| GPT-6.1 Sol | 17 | 0–20; mean of three runs |
| BTTF | 0.614 | 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. | 570.029 | −18.811 |
| 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.657 (log-odds).
Score = sigmoid(-7.657) = 0.
Feature contributions
| Feature | Value | Contribution (log-odds) |
|---|---|---|
| Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right. | 101 | +0.825 |
| 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. | 100.958 | −0.611 |
| Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *. | 0.052 | +0.434 |
| 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.735 | −0.092 |
| Indentation frequencyHow rapidly indentation changes from line to line. | 21 | −0.011 |
Intercept 0.07 + feature contributions = 1.2 (log-odds).
Score = sigmoid(1.2) = 0.769.
| Score | 0.613 |
|---|
| Score | 16 |
|---|
Run 1
The code is well-structured and readable. It uses a frozen, slotted attrs class for a validator, which is logical and clear. The nesting is minimal (one if statement), and the intent is evident from the class name and docstring. The code length is concise and each line has a single action, promoting good granularity. Reading flow is natural, with a clear __call__ method and a custom __repr__ for debugging. Minor deductions: the blank line after the if statement could be removed, and the error message could be split for better line length control. The unused imports (operator, re, Pattern, contextmanager, etc.) at the top are not part of the class logic, but they slightly clutter the snippet and could confuse a reader about their usage.
Run 2
The code is mostly readable with clear structure and intent, but it has some issues that lower the score. The class definition is logical and the validator pattern is recognizable. However, there is an unnecessary blank line before the raise statement that disrupts flow, and the error message f-string is overly compact and hard to read. The `__call__` method mixes validation logic with formatting in one block. Imports include unused items (`operator`, `re`, `Pattern`, `contextmanager`, `get_run_validators`, `set_run_validators`, `_AndValidator`, `and_`, `NotCallableError`), suggesting boilerplate or copy-paste. The `__repr__` is clear. Nesting is flat, which is good, and action granularity is mostly one action per line. Overall, the code is understandable but could be cleaner and more concise.
Run 3
The code is well-structured and concise, with clear imports and a single class definition. It uses a frozen, slotted attrs class, which is idiomatic and readable. The method is short and has a single responsibility. The nesting is minimal. The main readability issue is the presence of an unnecessary blank line inside the if block before the raise statement, and the f-string is slightly long but still understandable. The docstring is helpful for explaining why a callable class is used. Overall, the intent is clear, the flow is natural, and the code avoids over-engineering.
Run 1
Code Structure: The validator class is logically organized, with configuration, validation, and representation clearly separated, although many imports are unused in this snippet. Nesting: Minimal nesting makes the validation path easy to follow. Clarity of intent: Class and attribute names clearly communicate the maximum-length constraint, and the error message is informative. However, the __call__ docstring explains the class design rather than the method's behavior. Code length: The implementation is concise, but redundant parentheses around the error message and an unnecessary blank line add minor clutter. Action granularity: Each statement performs a single clear action. Reading flow: Methods follow a natural order, though the long raise statement and limited spacing between imports and the class slightly reduce readability.
Run 2
Code Structure: The validator is logically organized into configuration, validation, and representation, though numerous unused imports add clutter. Nesting: A single conditional keeps the implementation flat and easy to follow. Clarity of intent: Descriptive class and attribute names make the maximum-length check clear; however, the __call__ docstring explains representation design rather than validation behavior. Code length: The implementation is concise, but unused imports, redundant parentheses around the error message, and an extra blank line are unnecessary. Action granularity: Each statement performs one clear action. Reading flow: The class reads naturally from stored limit to validation to representation, although the long raise statement and excess imports slightly interrupt readability.
Run 3
Code Structure: The validator is logically organized into configuration, validation, and representation methods, though many imports are unused in this snippet. Nesting: A single conditional keeps nesting shallow. Clarity of intent: The class name, max_length attribute, and error message clearly communicate maximum-length validation; the docstring explains the callable-class choice rather than the method's behavior. Code length: The implementation is concise, but unused imports, redundant parentheses around the error message, and an extra blank line add clutter. Action granularity: Each statement performs one clear action. Reading flow: The class reads naturally from initialization metadata through validation to representation, although the long raise statement and inconsistent spacing slightly disrupt scanning.