Sample
pyint-f1a8bc187542-I06
Invert eligible conditions and exchange their branches
Scores
| Method | Score | Scale |
|---|---|---|
| Posnett | 0 | 0–1; higher is more readable |
| Dorn | 0.823 | 0–1; higher is more readable |
| Mi | 0.388 | 0–1; higher is more readable |
| LLOC | 19 | Logical lines; fewer is more readable |
| DeepSeek V4 Pro | 15.33 | 0–20; mean of three runs |
| GPT-6.1 Sol | 16 | 0–20; mean of three runs |
| BTTF | 0.553 | 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. | 827.453 | −27.306 |
| Source linesThe number of non-empty source lines. | 35 | +14 |
| 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.41 | −6.615 |
Intercept 8.87 + feature contributions = -11.051 (log-odds).
Score = sigmoid(-11.051) = 0.
Feature contributions
| Feature | Value | Contribution (log-odds) |
|---|---|---|
| Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *. | 0.039 | +0.564 |
| 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. | 74.917 | +0.492 |
| Indentation frequencyHow rapidly indentation changes from line to line. | 33 | +0.404 |
| Number layout frequencyHow rapidly the number of numeric values per line changes through the code. | 1 | +0.398 |
| Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code. | 36 | −0.238 |
| Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right. | 35.417 | −0.233 |
| Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom. | 34.895 | +0.078 |
Intercept 0.07 + feature contributions = 1.535 (log-odds).
Score = sigmoid(1.535) = 0.823.
| Score | 0.388 |
|---|
| Score | 19 |
|---|
Run 1
The code is generally readable with clear structure and intent. The class has a focused purpose and the error message construction is logical. However, there are a few issues: the empty if/else block with 'pass' adds unnecessary nesting and could be improved; the message string concatenation across multiple f-strings and literals is slightly awkward; and the type hint for `request: Request` is not imported, which would break at runtime. The code is relatively flat and concise, with one logical action per line mostly maintained. The reading flow is natural, though the conditional could be restructured for clarity. Overall, it's clear but has minor structural inefficiencies.
Run 2
The code is generally readable with a clear purpose and logical structure. The class has a focused responsibility — providing a better error message — and the message-building logic is straightforward. Nesting is minimal, with only a single if/else block. Clarity is aided by descriptive variable names (e.g., form_matches, buf) and an informative docstring. However, the `if not (form_matches): pass else:` pattern is awkward and needlessly verbose; a simple `if form_matches:` would be clearer and shorter. The line length for the f-string is long, slightly hurting readability. Action granularity is mostly one action per line, but the long string concatenation across lines could be split more cleanly. Overall, the code is readable but could be improved with minor refactoring to eliminate the empty branch and improve string construction.
Run 3
The code has a clear purpose and is generally readable, but it has some unnecessary constructs that reduce clarity. The class name and docstring are helpful. Structure is logical, and nesting is shallow—only one if/else block with a redundant 'pass' branch, which could be inverted for better flow. The 'if not (form_matches): pass else: ...' pattern is awkward and hurts reading flow. Action granularity is mostly fine, though list-building in __init__ is slightly verbose. The imported types (App, Blueprint, BaseLoader) are unused and add noise. The error message construction is clear but could benefit from a direct multiline string instead of incremental appends. Overall, the code is understandable but has small style issues that prevent it from being highly readable.
Run 1
Code Structure: The exception class is logically organized, with message construction in __init__ and rendering in __str__, although unused imports add clutter. Nesting: Nesting is shallow, but the empty if branch followed by else is unnecessarily awkward; a direct if form_matches would be clearer. Clarity of intent: The descriptive class name, docstring, and detailed error message make the purpose clear. The Request annotation lacks a visible import, and names like buf are somewhat generic. Code length: The implementation is reasonably concise, though unnecessary imports and the pass branch lengthen it without benefit. Action granularity: Each statement performs a distinct action; the multiline strings appropriately represent a single message. Reading flow: Initialization, optional message expansion, and final assembly follow a natural sequence, slightly disrupted by the inverted conditional and sparse spacing around top-level definitions.
Run 2
Code Structure: The exception class is logically organized, with initialization separated from string conversion, although several imports are unused and Request is not visibly imported. Nesting: Shallow nesting makes the code easy to follow, but the empty if branch and substantive else branch are needlessly awkward. Clarity of intent: The descriptive class name, docstring, and explicit error message clearly communicate its debugging purpose; buf is less descriptive than message_parts. Code length: Reasonably concise, though the pass branch and redundant parentheses could be removed. Action granularity: Statements generally perform one action each, and the long message is split into readable lines. Reading flow: Construction proceeds naturally from request data to explanatory message to stored output, but replacing if not (form_matches): pass with if form_matches: would improve flow.
Run 3
Code Structure: The exception class is logically organized, with message construction in the initializer and rendering in __str__, although several unused imports add clutter. Nesting: Shallow nesting makes the code easy to follow, but the empty if branch and else are unnecessarily awkward. Clarity of intent: The class name, docstring, and descriptive error message clearly convey its debugging purpose; the Request annotation lacks a visible import. Code length: Mostly concise, though the no-op branch and unnecessary parentheses could be replaced with a direct if form_matches condition. Action granularity: Statements generally perform one action each, and multiline string formatting remains readable. Reading flow: Message initialization, optional details, and final assignment follow a natural sequence, slightly disrupted by the pass branch and generic variable name buf.