Sample
pyint-453c0b086217-I10
Deterministically remove some optional blank lines and bracketed line breaks
Scores
| Method | Score | Scale |
|---|---|---|
| Posnett | 0 | 0–1; higher is more readable |
| Dorn | 0.705 | 0–1; higher is more readable |
| Mi | 0.177 | 0–1; higher is more readable |
| LLOC | 41 | Logical lines; fewer is more readable |
| DeepSeek V4 Pro | 12.67 | 0–20; mean of three runs |
| GPT-6.1 Sol | 16 | 0–20; mean of three runs |
| BTTF | 0.514 | 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. | 2303.37 | −76.011 |
| Source linesThe number of non-empty source lines. | 60 | +24 |
| 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.531 | −6.796 |
Intercept 8.87 + feature contributions = -49.937 (log-odds).
Score = sigmoid(-49.937) = 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. | 124.967 | −1.628 |
| Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right. | 125 | +1.212 |
| Indentation frequencyHow rapidly indentation changes from line to line. | 55 | +1.165 |
| Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code. | 61 | −1.123 |
| Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom. | 59.921 | +0.428 |
| Number layout frequencyHow rapidly the number of numeric values per line changes through the code. | 1 | +0.398 |
| Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *. | 0.061 | +0.347 |
Intercept 0.07 + feature contributions = 0.869 (log-odds).
Score = sigmoid(0.869) = 0.705.
| Score | 0.177 |
|---|
| Score | 41 |
|---|
Run 1
The code has clear logical separation and reasonable structure, with a coherent class definition and understandable methods. However, readability is significantly hampered by inconsistent and awkward formatting: some imports have unusual indentation and extra whitespace, and dictionary definitions use excessive spacing in a non-PEP8 manner. This visual inconsistency disrupts the reading flow and makes the code feel messy. Nesting is mostly flat, which is positive, and actions are mostly one per line, though the long `if` chain in `clean()` could be more explicit. The intent of methods is generally clear, but the formatting quirks reduce overall readability. Improved import alignment and dictionary formatting would raise the score substantially.
Run 2
The code has logical structure and clear intent, but readability is hindered by inconsistent formatting and alignment. Imports are organized with grouping but contain irregular spacing and alignment (e.g., multiple spaces before NON_FIELD_ERRORS and HiddenInput), which disrupts reading flow. The class and methods are well-named and concise, but some long lines (e.g., the ValidationError call) reduce clarity. Nesting is generally flat and action granularity is reasonable, though the __init__ method has multiple responsibilities. Overall, the code is understandable but would benefit from formatting cleanup and line-length consistency.
Run 3
The code has clear structure with a docstring and three methods, and class-level attributes are clear. However, readability suffers from inconsistent formatting: unusual indentation in imports and dictionaries, misplaced closing parentheses, and awkward line breaks (e.g., 'getattr(...)' split across lines). Some nesting exists in __init__ and clean methods, though not excessive. Intent is mostly clear, but the clean method's logic could be more straightforward. Code length is reasonable, but action granularity is uneven—some lines combine multiple operations while others are overly fragmented. The reading flow is disrupted by inconsistent spacing and odd alignment. Overall, the logic is understandable, but formatting issues and minor structural quirks reduce readability significantly.
Run 1
Code Structure: Imports and a single class with distinct initialization, validation, and change-detection methods provide logical organization. Nesting: Conditional nesting is shallow, and early returns simplify validation. Clarity of intent: Descriptive method and attribute names, the class docstring, and comments explain the purpose, though 'orig' is less informative and the unconditional has_changed() result lacks explanation. Code length: The implementation is concise, but numerous unused imports add distracting bulk. Action granularity: Statements generally perform one action per line; several imports combine names awkwardly. Reading flow: Methods follow a natural lifecycle, but inconsistent spacing in imports, the error-message dictionary, and the ValidationError call interrupts scanning.
Run 2
Code Structure: The class is logically organized into initialization, validation, and change detection, although many unrelated imports clutter the snippet. Nesting: Conditional nesting is shallow and manageable, with early returns simplifying validation. Clarity of intent: The class docstring, descriptive attributes, and validation error make its purpose clear; the abbreviated variable 'orig' and unexplained always-false has_changed method slightly reduce clarity. Code length: Methods are concise, but unused imports add unnecessary length. Action granularity: Statements generally perform one action per line. Reading flow: Execution follows a natural progression, but inconsistent spacing in imports, the error-message dictionary, and the ValidationError call interrupts visual flow.
Run 3
Code Structure: The class is logically organized into initialization, validation, and change detection, although numerous unused imports add clutter. Nesting: Conditional nesting is shallow and easy to follow, with early returns simplifying validation. Clarity of intent: Descriptive names, a class docstring, and brief comments make the parent-instance validation purpose clear; the unconditional has_changed result could use explanation. Code length: Methods are concise, but the unused imports unnecessarily lengthen the snippet. Action granularity: Statements generally perform one action per line, making individual operations easy to identify. Reading flow: Execution proceeds naturally from setup to validation, but irregular spacing in imports, the error-message dictionary, and the exception statement disrupts visual consistency.