Sample
pyint-562a3269c137-I06
Invert eligible conditions and exchange their branches
Scores
| Method | Score | Scale |
|---|---|---|
| Posnett | 0 | 0–1; higher is more readable |
| Dorn | 0.548 | 0–1; higher is more readable |
| Mi | 0.772 | 0–1; higher is more readable |
| LLOC | 40 | Logical lines; fewer is more readable |
| DeepSeek V4 Pro | 10 | 0–20; mean of three runs |
| GPT-6.1 Sol | 13.33 | 0–20; mean of three runs |
| BTTF | 0.345 | 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. | 2005.043 | −66.166 |
| Source linesThe number of non-empty source lines. | 92 | +36.8 |
| 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.384 | −6.576 |
Intercept 8.87 + feature contributions = -27.073 (log-odds).
Score = sigmoid(-27.073) = 0.
Feature contributions
| Feature | Value | Contribution (log-odds) |
|---|---|---|
| Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code. | 93 | −2.257 |
| Indentation frequencyHow rapidly indentation changes from line to line. | 65 | +1.511 |
| Number layout frequencyHow rapidly the number of numeric values per line changes through the code. | 65 | −1.071 |
| Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom. | 91.912 | +0.875 |
| Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right. | 78.118 | +0.456 |
| 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. | 78.946 | +0.321 |
| Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *. | 0.067 | +0.287 |
Intercept 0.07 + feature contributions = 0.193 (log-odds).
Score = sigmoid(0.193) = 0.548.
| Score | 0.772 |
|---|
| Score | 40 |
|---|
Run 1
The code has some readability strengths, including clear docstrings, type hints, and a logical class structure. However, it suffers from several significant issues. The use of negated conditionals with empty 'pass' blocks (e.g., 'if not (len(v) == 3): pass else: ...') is confusing and unnecessarily inverted, making the logic harder to follow. This same pattern appears multiple times in '_ensure_tuple', creating tangled control flow. The '_from_version_string' method lacks input validation and has an unclear flow. The comment about releaselevel ordering in __lt__ is helpful but the actual comparison logic could be more explicit. Variable naming is generally good, and the class decorators are clear. Overall, while the intent can be understood, the unnecessarily inverted conditionals and empty blocks significantly impair readability, forcing readers to mentally invert logic multiple times.
Run 2
The code has clear intent and docstrings, but suffers from awkward branching. The `if not condition: pass else: ...` pattern in `_ensure_tuple` and `_from_version_string` is inverted and confusing; it forces readers to mentally negate the condition. This creates unnecessary nesting and obscures the actual logic. The multiple actions on one line in `_from_version_string`’s `return` reduce clarity. Class structure and imports are logical, and the comparison methods are straightforward, but the helper methods’ flow is unnatural. Overall, readable in parts but significantly hindered by the inverted conditionals.
Run 3
The code has a clear structure with logical imports, class-level attributes, and method grouping. However, readability is undermined by awkward inverted conditional patterns like 'if not (len(v) == 3): pass else: ...' which obscure intent and create unnecessary nesting. The _ensure_tuple method has flat but puzzling logic with multiple inverted checks and empty pass blocks, making the control flow hard to follow. The docstrings and comments generally aid understanding, and the version comparison logic is concise. Variable names are descriptive, but the conditional style significantly hurts the natural reading flow. Action granularity is mostly one action per line, which is good, but the overall clarity is reduced by the unnecessarily convoluted conditionals. The code is not deeply nested but could be more readable by replacing inverted 'if not' patterns with straightforward positive checks.
Run 1
Code Structure: Well-organized class with focused parsing, normalization, comparison, and hashing methods. Nesting: Shallow overall, though unnecessary if/else branches with pass add visual clutter. Clarity of intent: Descriptive method names, docstrings, examples, and the release-level comment explain behavior well; repeated negations, especially double and triple negatives in validation, obscure straightforward conditions. Short names such as s and v slightly weaken clarity. Code length: Mostly concise, but redundant branches unnecessarily lengthen simple checks. Action granularity: Generally one action per line, with constructor arguments grouped appropriately. Reading flow: Methods follow a logical progression, and comparisons consistently reuse the normalization helper. However, inverted conditions and exception-based handling of unsupported operands interrupt otherwise natural reading.
Run 2
Code Structure: Responsibilities are logically separated into parsing, tuple normalization, comparison, and hashing methods. Nesting: Depth is shallow, but repeated empty pass branches and else blocks introduce unnecessary branching. Clarity of intent: Descriptive method names, documentation, and comparison examples explain the purpose well; double and triple negations in conditions substantially obscure otherwise simple checks. Code length: The class is reasonably compact, although inverted conditions and no-op branches add avoidable lines. Action granularity: Most statements perform one action, and the compact constructor call remains understandable. Reading flow: Field declarations and method ordering are natural, but readers must repeatedly untangle negations and skip empty branches. Direct conditions and straightforward validation would significantly improve readability.
Run 3
Code Structure: The class is logically organized into fields, parsing, normalization, comparison, and hashing methods. Nesting: Depth is shallow, but redundant if/pass/else branches add unnecessary complexity. Clarity of intent: Docstrings, examples, and descriptive field names explain the purpose well; repeated negations obscure otherwise simple conditions, and abbreviated variables reduce clarity. Code length: Mostly compact, but empty branches and convoluted checks unnecessarily inflate the implementation. Action granularity: Most lines perform one action, although the constructor packs several arguments together. Reading flow: Method ordering and shared comparison normalization support natural reading, but inverted conditions repeatedly interrupt it. Overall, the design is understandable, while the conditional style significantly undermines readability.