Sample
pyint-09a019c5db24-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.7 | 0–1; higher is more readable |
| Mi | 0.054 | 0–1; higher is more readable |
| LLOC | 40 | Logical lines; fewer is more readable |
| DeepSeek V4 Pro | 13 | 0–20; mean of three runs |
| GPT-6.1 Sol | 15 | 0–20; mean of three runs |
| BTTF | 0.414 | 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. | 2118.047 | −69.896 |
| Source linesThe number of non-empty source lines. | 54 | +21.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.373 | −6.559 |
Intercept 8.87 + feature contributions = -45.985 (log-odds).
Score = sigmoid(-45.985) = 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.964 | −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. | 51 | +1.027 |
| Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code. | 55 | −0.911 |
| Number layout frequencyHow rapidly the number of numeric values per line changes through the code. | 1 | +0.398 |
| Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom. | 53.944 | +0.344 |
| Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *. | 0.063 | +0.333 |
Intercept 0.07 + feature contributions = 0.846 (log-odds).
Score = sigmoid(0.846) = 0.7.
| Score | 0.054 |
|---|
| Score | 40 |
|---|
Run 1
The code has a clear purpose and generally logical organization, with reasonable method separation. However, it suffers from inconsistent formatting that significantly harms readability: some multi-line function calls have poor indentation (e.g., the TypeError raise and the __eq__ method), creating visual clutter. The __eq__ method is especially tangled, with awkward line breaks and alignment that obscure the comparison logic. Nesting is minimal, which is good, and action granularity is mostly one action per line in __init__ and __call__, but the formatting inconsistencies break the natural reading flow. The regex compilation line is fine, and the class attributes are clearly defined. Overall, the code is understandable but the formatting issues make it feel sloppier than it needs to be, preventing a higher score despite the logic itself being straightforward.
Run 2
The code is generally readable but has several flaws. Structure is logical with clear class and method organization, though the __eq__ method has awkward line breaks. Nesting is minimal and acceptable. Intent is mostly clear - it's a regex validator - but the TypeError message is overly verbose. Code length is reasonable; however, the multiline conditional in __eq__ could be more concise. Action granularity is mostly one action per line, but the raise TypeError statement and __eq__ return have awkward formatting with excessive whitespace. Reading flow is natural overall, but the poorly formatted lines (TypeError message, __eq__ conditions) disrupt comprehension. The docstring is helpful. Main issues are inconsistent formatting and some verbose expressions that reduce readability.
Run 3
The code is generally organized with reasonable imports and a clear class structure. The __init__ method is straightforward, though the default parameters could be simplified. The main issues are inconsistent formatting and poor action granularity. Several lines cram multiple conditions or concatenate arguments, reducing readability. The type error message and __eq__ method are awkwardly formatted with excessive indentation, making them harder to follow. The __call__ method is clear but could use blank lines between logical sections. The nesting is minimal, and intent is mostly clear, but the formatting inconsistencies break the natural reading flow. Some lines are unnecessarily long or oddly broken. Overall, the code is functional but not polished.
Run 1
Code Structure: The validator class is logically organized into configuration, initialization, validation, and equality methods, though unused imports add clutter. Nesting: Control flow is shallow, with simple conditionals and no deeply nested blocks. Clarity of intent: Descriptive names and the validation docstring make the purpose clear; the inverse-match expression requires minor interpretation. Code length: The implementation is reasonably concise, although repetitive initialization checks and unrelated imports slightly dilute it. Action granularity: Most lines perform one action, but several equality comparisons share lines, making them harder to scan. Reading flow: Method order is natural, but inconsistent spacing, awkwardly formatted expressions, and missing separation between methods interrupt readability.
Run 2
Code Structure: The class logically separates configuration, validation, and equality checks, though missing spacing between methods weakens organization. Nesting: Shallow conditionals keep execution easy to follow. Clarity of intent: Descriptive names and the validation docstring explain the purpose well; the inverse-match expression requires slight interpretation. Code length: Concise overall, with repetitive initialization checks that remain understandable. Action granularity: Most lines perform one action, but several equality conditions share awkwardly formatted lines. Reading flow: Initialization naturally precedes validation and comparison, but excessive inline whitespace and inconsistent formatting interrupt scanning. Several imports are unused in this snippet and add visual clutter.
Run 3
Code Structure: The class logically separates configuration, validation, and equality comparison, though missing spacing between methods weakens visual organization. Nesting: Shallow conditionals keep control flow easy to follow. Clarity of intent: Descriptive names, sensible defaults, and the validation docstring clearly communicate purpose; the inverse-match expression requires minor interpretation. Code length: Concise overall, with reasonable explicit configuration checks, although unused imports add clutter. Action granularity: Most lines perform one action, but irregular formatting packs several equality conditions onto single lines. Reading flow: Initialization naturally leads into validation and comparison, but excessive inline whitespace in the TypeError and equality expressions interrupts scanning. Consistent formatting and removal of unused imports would substantially improve readability.