Sample
pyint-00e292c8cab2-I06
Invert eligible conditions and exchange their branches
Scores
| Method | Score | Scale |
|---|---|---|
| Posnett | 0 | 0–1; higher is more readable |
| Dorn | 0.842 | 0–1; higher is more readable |
| Mi | 0.696 | 0–1; higher is more readable |
| LLOC | 18 | Logical lines; fewer is more readable |
| DeepSeek V4 Pro | 10.33 | 0–20; mean of three runs |
| GPT-6.1 Sol | 12.67 | 0–20; mean of three runs |
| BTTF | 0.558 | 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. | 675.895 | −22.305 |
| Source linesThe number of non-empty source lines. | 30 | +12 |
| 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.367 | −6.551 |
Intercept 8.87 + feature contributions = -7.985 (log-odds).
Score = sigmoid(-7.985) = 0.
Feature contributions
| Feature | Value | Contribution (log-odds) |
|---|---|---|
| Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right. | 86.935 | +0.598 |
| Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *. | 0.051 | +0.449 |
| Number layout frequencyHow rapidly the number of numeric values per line changes through the code. | 1 | +0.398 |
| Indentation frequencyHow rapidly indentation changes from line to line. | 28 | +0.231 |
| Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code. | 31 | −0.061 |
| 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. | 86.968 | −0.018 |
| Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom. | 29.807 | +0.007 |
Intercept 0.07 + feature contributions = 1.674 (log-odds).
Score = sigmoid(1.674) = 0.842.
| Score | 0.696 |
|---|
| Score | 18 |
|---|
Run 1
The code has severe readability issues. The conditional logic in `__call__` is inverted and confusing: `if not (not issubclass(value, self.type)): pass else: raise` should be a straightforward `if not issubclass(...): raise`. This creates unnecessary nesting and obscures intent. The class structure is acceptable, but the method bodies contain tangled logic. Action granularity is poor in the conditional statement with multiple operations crammed into confusing boolean expressions. The error message construction is clear but buried in the convoluted control flow. The imports appear unused (`operator`, `re`, `Pattern`, `contextmanager`, etc.) suggesting copy-paste or dead code. The docstring is minimal but present. Overall organization follows a logical pattern (validator class with `__call__` and `__repr__`), but the implementation of the core functionality is unnecessarily obfuscated, requiring careful mental parsing to understand the simple check being performed.
Run 2
The code is generally readable but has a confusing control flow in __call__: `if not (not issubclass(...))` followed by `pass` and an `else` block is convoluted and unclear. This structure hurts clarity of intent and action granularity. The class structure is fine, and the imports are concise, though some unused imports (operator, re, Pattern, contextmanager, get_run_validators, etc.) reduce cleanliness. The repr method is clear. Overall, the code is understandable, but the nested negation and inverted if/else make the key validation logic awkward and less readable than it should be.
Run 3
The code has moderate readability issues across several criteria. The structure is logically organized but contains confusing logic: the conditional in `__call__` is unnecessarily convoluted with `if not (not issubclass(...))` which should simply be `if not issubclass(...)`. This creates ambiguity in intent and hurts clarity. Nesting is flat, which is good. The code length is concise. However, action granularity is impacted by the awkward conditional and the multi-line `TypeError` call that could be clearer. Reading flow suffers from the double negative. The imports are somewhat cluttered with unused imports like `operator`, `contextmanager`, `Pattern`, `default_if_none`, and `NotCallableError`, reducing clarity. The validator's purpose is clear but the implementation could be more direct and readable.
Run 1
Code Structure: The validator class is logically organized into state, validation, and representation methods, though unused imports add clutter. Nesting: Nesting is shallow, but the empty success branch and else block are unnecessary. Clarity of intent: Class and method names indicate the purpose, and the error message is informative; however, the double negation in `if not (not issubclass(...))` obscures a simple condition. Code length: The implementation is short, but redundant control flow and unused imports make it longer than needed. Action granularity: Statements generally perform one action per line, and the exception arguments are clearly separated. Reading flow: The overall progression is natural, but the double negation, pass statement, and implementation-focused docstring interrupt straightforward reading. A direct `if not issubclass(value, self.type):` would improve readability substantially.
Run 2
Code Structure: The validator class logically groups its state, validation behavior, and representation, but numerous unused imports add clutter. Nesting: Nesting is shallow, although an empty success branch and an else block are unnecessary. Clarity of intent: Class and method names communicate subclass validation, but the double negation obscures the condition, and the docstring explains the callable-class design rather than validation behavior. Code length: The implementation is short, yet redundant branching and unused imports make it longer than necessary. Action granularity: Statements generally perform one action each, and the multiline exception arguments are easy to distinguish. Reading flow: Organization is conventional, but the inverted condition and pass interrupt natural reading; a direct failing-condition check would make the validation clearer.
Run 3
1. Code Structure: The validator class logically separates validation and representation, but numerous unused imports distract from its small scope. 2. Nesting: Nesting is shallow, although the if/pass/else structure adds an unnecessary branch. 3. Clarity of intent: Class and method names communicate purpose, but the double negation in `if not (not issubclass(...))` obscures a simple condition. The call method's docstring explains the class design rather than validation behavior. 4. Code length: The implementation is short, but redundant imports, the empty success branch, and the expanded exception call add avoidable length. 5. Action granularity: Statements generally perform one action per line, and message construction is separated from raising the exception. 6. Reading flow: Imports, class declaration, validation, and representation follow a conventional order, but the convoluted condition interrupts otherwise straightforward reading.