Sample
pyint-4e7dc64fc843-I06
Invert eligible conditions and exchange their branches
Scores
| Method | Score | Scale |
|---|---|---|
| Posnett | 0 | 0–1; higher is more readable |
| Dorn | 0.909 | 0–1; higher is more readable |
| Mi | 0.338 | 0–1; higher is more readable |
| LLOC | 67 | Logical lines; fewer is more readable |
| DeepSeek V4 Pro | 5.67 | 0–20; mean of three runs |
| GPT-6.1 Sol | 13 | 0–20; mean of three runs |
| BTTF | 0.403 | 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. | 3624.413 | −119.606 |
| Source linesThe number of non-empty source lines. | 98 | +39.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.252 | −6.378 |
Intercept 8.87 + feature contributions = -77.914 (log-odds).
Score = sigmoid(-77.914) = 0.
Feature contributions
| Feature | Value | Contribution (log-odds) |
|---|---|---|
| Indentation frequencyHow rapidly indentation changes from line to line. | 96 | +2.583 |
| Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code. | 99 | −2.469 |
| Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom. | 97.736 | +0.956 |
| Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right. | 85.859 | +0.581 |
| 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.08 | +0.16 |
| 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. | 85.97 | +0.024 |
Intercept 0.07 + feature contributions = 2.303 (log-odds).
Score = sigmoid(2.303) = 0.909.
| Score | 0.338 |
|---|
| Score | 67 |
|---|
Run 1
The code has excessive conditional inversions (e.g., `if not (x): pass else: ...`) throughout, severely harming readability. Logical structure exists but is obscured by awkward negations and empty branches. Clarity of intent suffers: simple checks like `if loader is not None` become convoluted. Nesting is moderate but compounded by these inverted patterns. The repeated `pass`-else antipattern bloats line count dramatically. Action granularity is inconsistent—some actions span multiple lines unnecessarily. Reading flow is disrupted by constant mental negation and branch reordering. However, type hints are present, function signatures are clear, and names are descriptive. The loader logic is understandable with effort, but the stylistic choices erase these benefits, making even simple checks tedious to parse. Refactoring to standard `if condition:` patterns would immediately improve readability by at least 8–10 points.
Run 2
The code has clear class and method organization, but the inverted conditionals (`if not X: pass else:`) are a major readability flaw. These constructs are unnecessarily convoluted and obscure the intent. Several methods are overly long with multiple actions per block, violating the one-action-per-line principle. The `_get_source_explained` method is particularly tangled, with confusing variable names (`rv`, `trv`) and non-obvious control flow. The `_iter_loaders` method repeats the same inverted conditional pattern, making it hard to follow. While the overall structure is logical and type hints help, the pervasive use of inverted conditionals and verbose exception handling significantly hampers readability. The code would be much clearer with straightforward `if condition:` statements and simplified logic.
Run 3
The code is highly unreadable due to inverted conditional logic throughout. Every `if` statement uses `if not (condition): pass else: ...`, which obscures intent and adds noise. The method `_get_source_explained` has confusing variable naming (`rv`, `trv`), unnecessary type annotations repeated inline, and redundant checks like `if not (trv is None): pass else: trv = rv`. Deep nesting occurs in methods with multiple loops and conditionals, though some is unavoidable. Action granularity is poor because several operations are packed or artificially split across needless `pass` branches. Reading flow is disrupted by the repetitive pattern and verbose boolean negations. Code length is unnecessarily long due to the conditional style and repeated type tuples. The class structure itself is acceptable, but the implementation details make it nearly unmaintainable. Overall, it fails most readability criteria and would benefit from straightforward `if` statements, clearer variable names, and removal of dead `pass` clauses.
Run 1
Code Structure: Methods logically separate loader discovery, fast loading, diagnostic loading, and template listing. Nesting: Mostly shallow, but redundant if/pass/else branches add nesting, and template listing reaches three levels. Clarity of intent: Descriptive method names, a useful docstring, and type annotations explain the purpose; double-negative conditions and abbreviated names such as rv and trv obscure details. Code length: Reasonably compact overall, but repeated no-op branches and verbose tuple annotations create unnecessary bulk. Action granularity: Each line generally performs one action, with clear assignments and calls. Reading flow: Method boundaries and consistent formatting support navigation, but inverted conditions, a mid-method import, and unused imports interrupt the flow. Direct positive checks and clearer result-variable names would substantially improve readability.
Run 2
Code Structure: Methods logically separate loader dispatch, diagnostics, iteration, and template listing. Nesting: Mostly moderate, but redundant if/pass/else blocks add unnecessary nesting, especially inside loops. Clarity of intent: Descriptive method names, type hints, and the class docstring help, while negated conditions, double negatives, and terse variables such as rv and trv obscure straightforward logic. Code length: Reasonably compact overall, but repeated no-op branches and verbose tuple annotations inflate it. Action granularity: Statements generally perform one action per line, making individual operations easy to follow. Reading flow: Method boundaries and consistent formatting support navigation, but inverted checks interrupt natural reading; positive conditions and direct returns would substantially improve readability.
Run 3
Code Structure: Well-organized methods separate loader discovery, fast lookup, diagnostic lookup, and template listing. Nesting: Mostly moderate, but redundant if/pass/else branches add indentation, and blueprint template listing reaches several levels. Clarity of intent: Descriptive method names, a class docstring, and type annotations help, while repeated negated conditions and cryptic names such as rv and trv obscure simple logic. Code length: Unnecessarily expanded by empty branches, repeated complex type annotations, and a loop that could use set.update. Action granularity: Each line generally performs one action, making individual operations easy to follow. Reading flow: The overall progression is logical, but double negatives, no-op branches, and an import inside a method interrupt otherwise straightforward control flow.