Sample
pyint-a379d15124b5-I06
Invert eligible conditions and exchange their branches
Scores
| Method | Score | Scale |
|---|---|---|
| Posnett | 0 | 0–1; higher is more readable |
| Dorn | 0.017 | 0–1; higher is more readable |
| Mi | 0.802 | 0–1; higher is more readable |
| LLOC | 204 | Logical lines; fewer is more readable |
| DeepSeek V4 Pro | 9.33 | 0–20; mean of three runs |
| GPT-6.1 Sol | 12 | 0–20; mean of three runs |
| BTTF | 0.39 | 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. | 16567.432 | −546.725 |
| Source linesThe number of non-empty source lines. | 493 | +197.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.146 | −6.219 |
Intercept 8.87 + feature contributions = -346.875 (log-odds).
Score = sigmoid(-346.875) = 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. | 494 | −16.455 |
| Indentation frequencyHow rapidly indentation changes from line to line. | 450 | +14.828 |
| Number layout frequencyHow rapidly the number of numeric values per line changes through the code. | 450 | −9.905 |
| Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom. | 492.901 | +6.48 |
| Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right. | 89.769 | +0.644 |
| Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *. | 0.055 | +0.407 |
| 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. | 89.939 | −0.144 |
Intercept 0.07 + feature contributions = -4.075 (log-odds).
Score = sigmoid(-4.075) = 0.017.
| Score | 0.802 |
|---|
| Score | 204 |
|---|
Run 1
This code has severe readability issues despite being a real-world Django source file. The primary problem is pervasive inverted conditional logic: nearly every 'if' statement uses 'if not (condition): pass else:' instead of simply writing 'if condition:'. This creates unnecessary nesting, obscures intent, and forces readers to mentally invert logic repeatedly. Code Structure suffers from this pattern across methods like __init__, non_db_attrs, _check_to_fields_exist, _check_unique_target, and deconstruct. Action granularity is mostly acceptable, but reading flow is consistently disrupted by the awkward conditionals. Imports are well-organized and docstrings are helpful, showing attention to structure at the module level. However, the function-level logic is tangled. Methods like _check_unique_target contain multiple inverted branches that make error-checking paths difficult to follow. Code length is appropriate for Django's requirements, but the conditional style makes it feel unnecessarily long. Clarity of intent is low—readers must work hard to understand what conditions trigger each return path.
Run 2
The code exhibits severe readability issues stemming from inverted conditional logic. Pervasive 'if not (condition): pass else:' patterns invert normal Python idioms, obscuring intent and interrupting reading flow. This anti-pattern appears throughout __init__, deconstruct, resolve_related_fields, check methods, and contribute_to_class. While imports are organized and the class structure is logical, the conditional inversion creates unnecessary nesting and cognitive overhead. Method length is generally acceptable, and individual actions are reasonably granular, but the constant mental negation required to parse conditions like 'if not (rel_is_string or not self.requires_unique_target): pass else: return []' is exhausting. The code would read far more naturally with direct if statements. Some methods (_check_unique_target, deconstruct) are lengthy but not excessively so. Documentation exists on key methods. Overall, the code works but is unnecessarily difficult to follow due to consistent use of a confusing conditional style that violates Python readability conventions.
Run 3
The code uses an unusual inverted conditional pattern (`if not (condition): pass else: action`) throughout instead of standard positive conditionals, severely impairing readability and intent. This anti-pattern appears dozens of times, making even simple checks confusing. The class is very long with many methods and heavy responsibilities. While method names are clear and the code is functionally organized by concern, the nesting and control flow are awkward. Error-checking methods are excessively verbose due to the inverted conditionals. Imports are excessive and some appear unused. The Django-specific logic is inherently complex, but the presentation makes it significantly harder to follow than necessary.
Run 1
Code Structure: Logically organized into focused methods, with related properties and validation helpers grouped sensibly. Nesting: Mostly moderate, but redundant if-not/pass/else patterns introduce unnecessary branches and deepen several checks. Clarity of intent: Descriptive names, docstrings, and explanatory comments clarify relation handling, although repeated negations obscure straightforward conditions. Code length: Much of the domain complexity justifies the size, but empty branches and excessive conditional scaffolding make it unnecessarily long. Action granularity: Statements generally perform one action per line, and multiline calls are formatted consistently. Reading flow: Method boundaries and consistent formatting support navigation, but inverted conditions repeatedly interrupt natural top-to-bottom reading and require mental simplification. Overall, the code remains understandable to a Django-aware reader, but simplifying conditions and removing no-op branches would substantially improve readability.
Run 2
Code Structure: Well-organized class with focused methods, grouped attributes, and consistent formatting. Nesting: Mostly moderate, but redundant if-not/pass/else patterns introduce unnecessary branches and indentation, especially in validation and deconstruction. Clarity of intent: Descriptive method names, comments, and docstrings explain relation handling, while double negatives obscure otherwise simple conditions; some referenced names lack definitions in the excerpt. Code length: Much of the length reflects legitimate functionality, but repeated no-op branches add substantial avoidable verbosity. Action granularity: Statements generally perform one action per line, and complex calls are formatted clearly. Reading flow: Method organization is coherent, but inverted conditions repeatedly force readers to mentally reconstruct straightforward guards, interrupting natural top-to-bottom understanding.
Run 3
Code Structure: Well-organized class with focused methods separating validation, field resolution, and relationship handling. Nesting: Mostly moderate, but redundant if-not/pass/else patterns introduce unnecessary branches and indentation. Clarity of intent: Descriptive method names, comments, and docstrings explain domain-specific behavior; repeated negations, including double negatives, obscure otherwise simple conditions. Code length: Much length reflects legitimate functionality and documentation, but empty branches and redundant condition wrappers add substantial avoidable verbosity. Action granularity: Generally one action per line, with clean multiline calls and comprehensions; complex constraint expressions require closer attention. Reading flow: Consistent formatting and method grouping help navigation, but inverted conditions repeatedly interrupt natural control flow. Unused imports and references not defined within the snippet add contextual overhead. Overall, solid organization and documentation are undermined by systematically convoluted conditional style.