Sample
pyint-ba216cc7b52f-I06
Invert eligible conditions and exchange their branches
Scores
| Method | Score | Scale |
|---|---|---|
| Posnett | 0 | 0–1; higher is more readable |
| Dorn | 0.869 | 0–1; higher is more readable |
| Mi | 0.599 | 0–1; higher is more readable |
| LLOC | 21 | Logical lines; fewer is more readable |
| DeepSeek V4 Pro | 13.67 | 0–20; mean of three runs |
| GPT-6.1 Sol | 15 | 0–20; mean of three runs |
| BTTF | 0.574 | 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. | 958.626 | −31.635 |
| Source linesThe number of non-empty source lines. | 38 | +15.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.313 | −6.469 |
Intercept 8.87 + feature contributions = -14.033 (log-odds).
Score = sigmoid(-14.033) = 0.
Feature contributions
| Feature | Value | Contribution (log-odds) |
|---|---|---|
| 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. | 70 | +0.7 |
| Indentation frequencyHow rapidly indentation changes from line to line. | 36 | +0.508 |
| Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *. | 0.055 | +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. | 39 | −0.345 |
| Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom. | 37.746 | +0.118 |
| Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right. | 52.513 | +0.043 |
Intercept 0.07 + feature contributions = 1.896 (log-odds).
Score = sigmoid(1.896) = 0.869.
| Score | 0.599 |
|---|
| Score | 21 |
|---|
Run 1
The code has clear structure with logical class definition, imports, and attributes, but has a few readability issues. The most glaring problem is the unnecessary if/else block in __call__ that could be simplified to a single conditional - this adds needless nesting and obscures intent. The __repr__ method is well-structured but creates two small f-strings that could be combined. Action granularity is mostly good with one action per line, though the conditional block violates this by spreading a simple check across four lines. The class purpose is clear from naming and docstring, and the type hints via attrs are helpful. Reading flow is generally natural, moving from setup to validation to representation. The main deductions are for the awkward control flow and minor verbosity in string construction.
Run 2
The code has clear structure with logical class organization and reasonable naming. However, readability issues exist: the conditional in '__call__' is needlessly inverted and verbose ('if not (x is not None): pass else: ...'), creating unnecessary nesting and confusion. The method's purpose is unclear from the code alone despite the docstring explaining the class design, not the method's behavior. The loop inside '__call__' performs validation but lacks clarity about what 'member' represents. The '__repr__' method is well-structured with clear f-string formatting and good use of the conditional expression. Overall, the code is maintainable but would benefit from simpler conditionals, more explicit variable names, and clearer intent in the validation logic.
Run 3
The code is generally readable but has a few issues that lower its clarity. The structure is mostly logical, with a class definition and clear attributes. However, the __call__ method contains an awkward conditional structure (`if not (self.iterable_validator is not None): pass else: ...`) that inverts logic unnecessarily and creates unnecessary nesting. This could be simplified to `if self.iterable_validator is not None:` to improve clarity. The code length is appropriate for what it does, but the conditional adds verbosity without value. Action granularity is mostly good—one action per line—but the conditional structure interrupts natural reading flow. The intent of validating iterable members is clear, and the repr method is readable, though the conditional for building `iterable_identifier` is slightly verbose. Some unused imports are present, which suggests incomplete cleanup. Overall, the code is functional and understandable but would benefit from cleaner conditional logic and removal of dead code.
Run 1
Code Structure: The class logically groups configuration, validation, and representation, although several imports appear unused in this excerpt. Nesting: Control flow is shallow, with a simple conditional and loop. Clarity of intent: Descriptive names make iterable and member validation clear, but the double-negative condition with an empty pass branch obscures a straightforward optional check. Code length: Generally concise, though the unnecessary if/pass/else structure adds avoidable lines. Action granularity: Each statement performs one clear action; multiline expressions are formatted sensibly. Reading flow: Methods follow a natural order, and the representation construction is readable. However, is_callable and optional are not defined or imported in the shown code, requiring external context, and the __call__ docstring explains the class design rather than the method's behavior.
Run 2
Code Structure: The class logically groups validator configuration, validation behavior, and representation, though several imports appear unused in this snippet. Nesting: Control flow is shallow, with only a simple conditional and loop. Clarity of intent: Descriptive names make iterable and member validation understandable, but the double-negative condition with a pass branch obscures a straightforward optional-validator check. The docstring explains the callable-class design rather than the method's behavior. Code length: Mostly concise, although the empty conditional branch adds unnecessary lines. Action granularity: Statements generally perform one action per line; multiline declarations and string construction remain clear. Reading flow: Configuration followed by __call__ and __repr__ is natural, but the awkward conditional interrupts the flow, and is_callable and optional are not defined or imported in the provided snippet.
Run 3
Code Structure: The class logically groups validator attributes, validation behavior, and representation, though several imports appear unused in this snippet. Nesting: Shallow conditionals and a simple loop make execution easy to follow. Clarity of intent: Descriptive names communicate iterable and member validation, but the double-negative condition with an empty pass branch obscures a straightforward optional-validator check. The docstring explains the callable-class design rather than the method's behavior. Code length: Generally concise, although the redundant conditional branch and unused imports add clutter. Action granularity: Each statement performs a distinct action, with no compressed multi-action lines. Reading flow: Attribute declarations followed by __call__ and __repr__ provide a natural progression; multiline formatting is reasonable, but the inverted conditional interrupts that flow.