Sample
pyint-f154b3510ed2-I06
Invert eligible conditions and exchange their branches
Scores
| Method | Score | Scale |
|---|---|---|
| Posnett | 0 | 0–1; higher is more readable |
| Dorn | 0.887 | 0–1; higher is more readable |
| Mi | 0.558 | 0–1; higher is more readable |
| LLOC | 47 | Logical lines; fewer is more readable |
| DeepSeek V4 Pro | 6.67 | 0–20; mean of three runs |
| GPT-6.1 Sol | 12 | 0–20; mean of three runs |
| BTTF | 0.461 | 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. | 2387.646 | −78.792 |
| Source linesThe number of non-empty source lines. | 74 | +29.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.259 | −6.388 |
Intercept 8.87 + feature contributions = -46.711 (log-odds).
Score = sigmoid(-46.711) = 0.
Feature contributions
| Feature | Value | Contribution (log-odds) |
|---|---|---|
| Indentation frequencyHow rapidly indentation changes from line to line. | 71 | +1.719 |
| Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code. | 75 | −1.619 |
| Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom. | 73.888 | +0.623 |
| Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right. | 88 | +0.615 |
| 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.065 | +0.308 |
| 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.88 | −0.057 |
Intercept 0.07 + feature contributions = 2.057 (log-odds).
Score = sigmoid(2.057) = 0.887.
| Score | 0.558 |
|---|
| Score | 47 |
|---|
Run 1
The code has severe readability issues. The __init__ method uses 'if not (X is not None): pass else: self.X = X' anti-patterns instead of simple None checks, making each parameter assignment 3 lines instead of 1. This violates action granularity and creates unnecessarily long code. The __call__ method repeats this inverted-conditional pattern for validation logic. Import order follows PEP8, but unused imports (ipaddress, math, re, urlsplit, etc.) add clutter. The class has logical structure and flat nesting, but the inverted conditionals disrupt reading flow and obscure intent. While the docstring and __eq__ method are clear, the core logic is buried under 'if not...pass...else' constructs that should be 'if X is not None: self.X = X' or simply 'self.X = X or self.X'. The code is technically correct but written to maximize cognitive overhead.
Run 2
The code has clear imports and a simple class structure, but is hampered by poor conditional patterns in __init__ and __call__, which invert natural logic and make intent unclear. The if-not-pass-else pattern adds unnecessary nesting and verbosity, hurting readability. Action granularity is generally one action per line, and the overall flow is logical, but the redundant conditionals significantly undermine clarity and conciseness. The class attributes and docstring are helpful, and method length is reasonable.
Run 3
The code is overly verbose and difficult to read due to several anti-patterns. The __init__ method uses `if not (condition): pass else: action` instead of standard `if condition: action`, making the logic unnecessarily convoluted. The __call__ method suffers from the same issue with `if not (invalid_input): pass else: raise ValidationError(...)`. The variable `invalid_input` is confusingly named - it represents whether input should be rejected, but the name suggests it's a boolean flag for invalid data. The conditional structure creates unnecessary nesting and breaks reading flow. While the code has a clear class structure, the implementation style obscures intent and makes simple operations appear complex. The code would benefit from direct conditional statements with positive logic, reducing cognitive overhead and improving readability significantly.
Run 1
Code Structure: The class is logically organized into configuration, initialization, validation, and equality methods. Nesting: Depth is shallow, but repeated if-not/pass/else blocks introduce unnecessary branches. Clarity of intent: Descriptive names and the validation docstring explain the purpose, while double negatives obscure otherwise simple conditions. Code length: Excessive pass branches make initialization and validation substantially longer than necessary; direct positive checks would be clearer. Action granularity: Each statement generally performs one action, and multiline expressions are formatted consistently. Reading flow: Method order is natural, but redundant negation, parentheses, and empty branches repeatedly interrupt the flow. Several unused imports also add visual noise.
Run 2
Code Structure: The class is logically organized into initialization, validation, and equality methods, but several imports are unused. Nesting: Nesting is shallow, although repeated if/pass/else branches add unnecessary control-flow complexity. Clarity of intent: Descriptive names and the validation docstring convey purpose, but negated conditions such as 'if not (regex is not None)' obscure straightforward checks. Code length: Repeated no-op branches substantially inflate code that could use simple positive-condition assignments. Action granularity: Statements generally perform one action per line, and multiline expressions are formatted clearly. Reading flow: Method order is natural and formatting is consistent, but redundant negations, parentheses, and pass statements repeatedly interrupt the reader.
Run 3
Code Structure: The class is logically organized into initialization, validation, and equality methods, though several imports are unused. Nesting: Depth is shallow, but repeated if/pass/else blocks introduce unnecessary branching. Clarity of intent: Descriptive names and the validation docstring explain the purpose, while negated conditions such as 'not (regex is not None)' obscure straightforward checks. Code length: Initialization and validation are unnecessarily verbose; direct positive conditions would substantially shorten them. Action granularity: Each statement performs a single action, making individual operations easy to identify. Reading flow: Method ordering is natural, but repeated no-op branches and redundant parentheses interrupt the flow and increase mental effort.