Sample
pyint-8b84b8f3b13e-I06
Invert eligible conditions and exchange their branches
Scores
| Method | Score | Scale |
|---|---|---|
| Posnett | 0 | 0–1; higher is more readable |
| Dorn | 0.334 | 0–1; higher is more readable |
| Mi | 0.738 | 0–1; higher is more readable |
| LLOC | 59 | Logical lines; fewer is more readable |
| DeepSeek V4 Pro | 10.67 | 0–20; mean of three runs |
| GPT-6.1 Sol | 15 | 0–20; mean of three runs |
| BTTF | 0.463 | 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. | 3901.304 | −128.743 |
| Source linesThe number of non-empty source lines. | 197 | +78.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.034 | −6.051 |
Intercept 8.87 + feature contributions = -47.124 (log-odds).
Score = sigmoid(-47.124) = 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. | 198 | −5.974 |
| Indentation frequencyHow rapidly indentation changes from line to line. | 170 | +5.143 |
| Number layout frequencyHow rapidly the number of numeric values per line changes through the code. | 170 | −3.48 |
| Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom. | 196.962 | +2.343 |
| Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *. | 0.054 | +0.414 |
| 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. | 76.96 | +0.406 |
| Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right. | 73.874 | +0.387 |
Intercept 0.07 + feature contributions = -0.691 (log-odds).
Score = sigmoid(-0.691) = 0.334.
| Score | 0.738 |
|---|
| Score | 59 |
|---|
Run 1
The code demonstrates clear organization with logical imports and a well-documented class. The __init__ method is verbose but readable due to consistent parameter naming and straightforward assignments. However, several issues reduce readability: the inverted conditional pattern 'if not (condition): pass else: raise' in validator/default/converter methods is unnecessarily convoluted and should use standard positive conditionals with early raises. The __attrs_attrs__ definition is very long with repetitive Attribute() constructor calls, making it difficult to scan. The class has many parameters (15+ in __init__), suggesting potential for refactoring into smaller config objects. Nesting is generally flat, and intent is mostly clear through good docstrings. Line-by-line action granularity is reasonable, but the conditional inversions break natural reading flow. Overall, the code is maintainable by experienced developers familiar with the domain, but could benefit from simplifying control flow and reducing repetition in attribute definitions.
Run 2
The code is poorly readable. It contains deeply nested structures, especially in the __attrs_attrs__ tuple with generator expressions and a large tuple expansion. The __init__ method has too many parameters with repetitive assignments, reducing clarity and increasing cognitive load. Actions are compacted into long, dense expressions that combine multiple steps per line. The control flow in validator/default/converter methods uses awkward inverted conditions (e.g., `if not (x is None)`), which obscure intent. While imports and class structure are organized, the overall layout suffers from excessive verbosity, unclear separation of concerns, and a lack of concise explanatory comments where needed. The reading flow is disorienting due to inconsistent spacing, long signatures, and a mix of abstractions that make it hard to follow the logical path.
Run 3
The code shows some organizational strengths: clear imports, a docstring, __slots__, and a helper structure in __attrs_attrs__. However, readability suffers from excessive length in __init__ with 16 parameters, making intent hard to follow. The heavy use of negated conditionals like 'if not (self._validator is None)' with empty pass/else branches is awkward and obscures flow. Names like '_CountingAttr', 'cls_counter', and 'eq_key' require domain knowledge but are consistent. Overall, structure is logical but verbose; nesting is flat but long; clarity and reading flow are mixed. Action granularity is generally one action per line, which helps, but the convoluted conditionals and large __attrs_attrs__ tuple reduce readability. Score reflects a codebase that is maintainable but not immediately intuitive.
Run 1
Code Structure: The class is logically organized into metadata, initialization, and decorator methods, though the large metadata declaration dominates the snippet. Nesting: Mostly shallow, with simple conditional branches; the nested tuple comprehension requires more attention. Clarity of intent: Descriptive names and useful docstrings explain the purpose, but negated conditions such as `if not (self._default is not NOTHING)` obscure straightforward checks. Code length: The lengthy constructor and repeated Attribute configuration add verbosity, while the default method's empty `pass` branch is unnecessary. Action granularity: Statements generally perform one action per line, making assignments and state changes easy to follow. Reading flow: Consistent formatting and method grouping support natural reading, but the extensive imports, externally defined helpers, and bulky class metadata delay reaching the core behavior.
Run 2
Code Structure: The class is logically organized into metadata, initialization, and focused decorator methods, though the large import block and verbose attribute definitions add clutter. Nesting: Control flow is shallow; the tuple construction is moderately dense but contained. Clarity of intent: Descriptive method names and docstrings explain responsibilities well. However, negated conditions such as `if not (self._default is not NOTHING)` obscure simple checks, and referenced helpers require external context. Code length: Repeated Attribute arguments and the long constructor make the code verbose; the pass/else error check adds unnecessary lines. Action granularity: Assignments and operations generally occupy separate lines, making state changes easy to inspect. Reading flow: The progression from class configuration to initialization and behavior is natural, but double negatives, built-in-shadowing parameter names, and extensive boilerplate interrupt otherwise straightforward reading.
Run 3
Code Structure: The class is logically organized into metadata, initialization, and decorator methods, although the large import block adds clutter. Nesting: Mostly flat, with shallow conditionals; the nested tuple comprehension is somewhat harder to scan. Clarity of intent: Descriptive names and detailed docstrings explain the purpose well, but negated conditions such as `if not (self._default is not NOTHING)` obscure simple checks. Code length: Repeated Attribute configuration and the long constructor create substantial boilerplate; the empty `pass` branch is unnecessary. Action granularity: Statements generally perform one action per line, making assignments easy to follow. Reading flow: Consistent formatting and method boundaries support natural reading, but verbose metadata construction, double negatives, and dependencies defined outside the snippet interrupt comprehension.