Sample
pyint-cf48c3dfc94e-I06
Invert eligible conditions and exchange their branches
Scores
| Method | Score | Scale |
|---|---|---|
| Posnett | 0 | 0–1; higher is more readable |
| Dorn | 0.726 | 0–1; higher is more readable |
| Mi | 0.572 | 0–1; higher is more readable |
| LLOC | 29 | Logical lines; fewer is more readable |
| DeepSeek V4 Pro | 4.33 | 0–20; mean of three runs |
| GPT-6.1 Sol | 13 | 0–20; mean of three runs |
| BTTF | 0.543 | 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. | 974.093 | −32.145 |
| Source linesThe number of non-empty source lines. | 53 | +21.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.151 | −6.227 |
Intercept 8.87 + feature contributions = -8.302 (log-odds).
Score = sigmoid(-8.302) = 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. | 52 | −0.805 |
| Indentation frequencyHow rapidly indentation changes from line to line. | 44 | +0.785 |
| Number layout frequencyHow rapidly the number of numeric values per line changes through the code. | 44 | −0.589 |
| Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right. | 78.537 | +0.463 |
| Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *. | 0.051 | +0.442 |
| Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom. | 52.901 | +0.33 |
| 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. | 79.963 | +0.278 |
Intercept 0.07 + feature contributions = 0.974 (log-odds).
Score = sigmoid(0.974) = 0.726.
| Score | 0.572 |
|---|
| Score | 29 |
|---|
Run 1
The code has several readability problems. The `get_first_param_type` method uses convoluted double-negative logic (`if not (not self.sig)`) and redundant pass/else branches that invert natural reading flow — the condition should be `if not self.sig: return None`. Unnecessary re-imports of `inspect` inside methods reduce clarity. Some imports at module level are unused or oddly placed (`Mapping`, `Sequence`, `_GenericAlias`). The class name and docstrings are somewhat helpful, but the mixed structure, redundant `pass` statements, and inverted conditionals make the code needlessly verbose and confusing. While the overall intent is decipherable, the poor control-flow clarity, disorganized imports, and bloated logic lower readability significantly.
Run 2
The code has severe readability issues. The use of inverted conditional logic with empty pass branches and else branches for actual work (e.g., 'if not (not self.sig): pass else: return None') is highly confusing and obscures intent. Nesting is shallow, but the flow is unnatural and forces readers to mentally invert conditions. The extraction logic is split awkwardly across methods with redundant imports and unnecessary double negatives. Action granularity is acceptable, but clarity of intent is undermined by convoluted boolean expressions. The class structure is logical but implementation details are tangled. Overall, the code is difficult to follow due to inverted logic and unnatural control flow.
Run 3
The code has severe readability issues. The get_first_param_type method uses inverted, confusing logic: `if not (not self.sig)` with an empty pass block and an else clause that returns a value, obscuring the actual intent. This creates unnecessary nesting and pushes the main logic into an else branch, disrupting natural reading flow. There are redundant None checks after conditional returns. The class structure itself is reasonable, but the method implementations are convoluted. Imports are scattered (inspect imported inside methods rather than at module level), and there are unused imports. The method names are clear, but the implementation undermines clarity. The code mixes action granularity badly—multiple logical checks are crammed into awkward conditionals. Overall, the code is hard to follow and requires mental backtracking to understand simple conditional logic, making it significantly unreadable.
Run 1
Code Structure: The class logically groups annotation extraction and accessor methods, though unused imports add clutter. Nesting: Overall nesting is shallow, but unnecessary if/else branches with pass complicate the first-parameter accessor. Clarity of intent: Method names and docstrings clearly explain the purpose; double negation and inverted conditions obscure otherwise simple checks. Code length: Mostly concise, but redundant branches, repeated local imports, and converting all parameters to a list introduce avoidable verbosity. Action granularity: Statements generally perform one action per line, making individual operations easy to follow. Reading flow: Initialization and accessors follow a natural order, and get_return_type reads cleanly. However, get_first_param_type interrupts that flow with awkward conditional logic instead of straightforward early returns.
Run 2
Code Structure: The class logically groups signature extraction and annotation access, though unused imports add clutter. Nesting: Nesting is shallow, but unnecessary if/pass/else branches complicate otherwise simple checks. Clarity of intent: Method names and docstrings clearly describe the purpose; double negation in get_first_param_type obscures its logic. Code length: Generally compact, but redundant branches and repeated local imports make it longer than necessary. Action granularity: Each statement performs a single action, making individual steps easy to identify. Reading flow: Initialization followed by accessor methods is natural, and get_return_type reads cleanly. However, get_first_param_type interrupts that flow with inverted conditions and no-op branches instead of straightforward early returns.
Run 3
Code Structure: The class logically groups signature extraction and annotation access, though unused imports add clutter. Nesting: Control flow is shallow, but redundant if/pass/else branches make the first-parameter method harder to follow. Clarity of intent: Method names and docstrings clearly explain the purpose; double negation and inverted conditions obscure otherwise simple checks. Code length: Relatively short, but repeated local imports and unnecessary branches could be simplified. Action granularity: Statements generally perform one action per line, making individual operations easy to identify. Reading flow: Initialization and return-type extraction read naturally, while get_first_param_type interrupts the flow with awkward conditional logic.