Sample
pyint-644834ccab3c-I06
Invert eligible conditions and exchange their branches
Scores
| Method | Score | Scale |
|---|---|---|
| Posnett | 0 | 0–1; higher is more readable |
| Dorn | 0.88 | 0–1; higher is more readable |
| Mi | 0.502 | 0–1; higher is more readable |
| LLOC | 44 | Logical lines; fewer is more readable |
| DeepSeek V4 Pro | 7.67 | 0–20; mean of three runs |
| GPT-6.1 Sol | 10.67 | 0–20; mean of three runs |
| BTTF | 0.491 | 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. | 2447.443 | −80.766 |
| Source linesThe number of non-empty source lines. | 73 | +29.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.492 | −6.738 |
Intercept 8.87 + feature contributions = -49.434 (log-odds).
Score = sigmoid(-49.434) = 0.
Feature contributions
| Feature | Value | Contribution (log-odds) |
|---|---|---|
| Indentation frequencyHow rapidly indentation changes from line to line. | 68 | +1.615 |
| Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code. | 74 | −1.584 |
| Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right. | 87.946 | +0.615 |
| Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom. | 72.989 | +0.61 |
| 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.063 | +0.328 |
| 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.959 | −0.06 |
Intercept 0.07 + feature contributions = 1.992 (log-odds).
Score = sigmoid(1.992) = 0.88.
| Score | 0.502 |
|---|
| Score | 44 |
|---|
Run 1
The code exhibits poor readability due to inverted conditional logic ('if not... else') that inverts natural reading flow and obscures intent. Numerous unnecessary 'pass' statements create noise. Inline multiline calls (super().__init__) reduce clarity. The __init__ method uses tangled branching for initial value assignment, making it hard to follow. Missing blank lines between methods violates PEP8 and further reduces structure. The clean method has high nesting and disorganized action flow, with multiple actions interspersed. While imports are logically grouped, the overall implementation is overly verbose and ambiguous.
Run 2
The code suffers from severe readability issues due to inverted conditional logic. Instead of straightforward if-else blocks, it uses `if not (condition): pass else:` patterns, which force the reader to mentally invert conditions and disrupt natural reading flow. This creates deep cognitive overhead and obscures intent. The `__init__` and `clean` methods contain unnecessary nesting and multiple actions per line, reducing clarity. The import section is well-organized, and the docstring is helpful, but these positive aspects are overshadowed by the convoluted control flow. The logic in `clean` is particularly difficult to follow, requiring careful tracing to understand the branching. While the code is functional, its structure makes it unnecessarily hard to read and maintain, earning a low score.
Run 3
The code has clear imports, a focused class, and straightforward method purposes, but it suffers from inverted conditional logic that harms readability. The `if not (condition): pass else:` pattern is unnecessarily convoluted and should be `if condition:` or early returns. The `__init__` method has a confusing nested structure around setting initial values. While the class is concise and each line performs a single action, the unnatural if/else inversions disrupt reading flow and obscure intent. The docstring and error message help clarity, but the conditional style undermines it. Overall, it is readable for an experienced Django developer but unnecessarily harder to parse than it needs to be.
Run 1
Code Structure: Methods separate initialization, validation, and change detection logically, but many imports are unused in this snippet. Nesting: Unnecessary pass branches and else blocks introduce avoidable nesting. Clarity of intent: Descriptive names and a class docstring explain the purpose, but negated conditions such as 'not (str(value) != str(orig))' obscure straightforward comparisons. Code length: The implementation is relatively short, yet redundant conditionals and unused imports make it longer than necessary. Action granularity: Each line generally performs one action, and assignments and validation calls are clearly separated. Reading flow: The method order is natural, but repeatedly skipping pass branches to find meaningful logic interrupts reading. Direct conditions and early returns would substantially improve readability.
Run 2
Code Structure: The class is logically divided into initialization, validation, and change detection, but many unrelated imports add clutter. Nesting: Depth is moderate, yet unnecessary pass branches and else blocks make simple conditions cumbersome. Clarity of intent: Descriptive names and the docstring help, but negated conditions, especially the double-negative comparison, obscure straightforward logic. Code length: The implementation is unnecessarily long because several checks could use direct conditions without empty branches. Action granularity: Statements generally perform one action per line, and formatting is consistent. Reading flow: Method ordering is natural, but repeated inverted checks interrupt the flow and force readers to mentally simplify conditions.
Run 3
Code Structure: Methods logically separate initialization, validation, and change detection, but many unrelated imports add clutter. Nesting: Depth is moderate, yet empty pass branches and unnecessary else blocks complicate otherwise simple conditions. Clarity of intent: The class docstring, method names, and validation error convey purpose, but negated expressions such as 'not (str(value) != str(orig))' obscure straightforward comparisons. Code length: The implementation is relatively short, although redundant branching and unused imports make it unnecessarily long. Action granularity: Most lines perform one action, and the multiline exception construction is easy to read. Reading flow: Initialization and validation follow a sensible sequence, but inverted conditions repeatedly interrupt that flow and increase the effort needed to understand behavior.