Sample
int-cf71539c3639-I06
Invert eligible conditions and exchange their branches
Scores
| Method | Score | Scale |
|---|---|---|
| Posnett | 0 | 0–1; higher is more readable |
| Scalabrino | 0.615 | 0–1; higher is more readable |
| Dorn | 0.271 | 0–1; higher is more readable |
| Mi | 0.575 | 0–1; higher is more readable |
| LLOC | 37 | Logical lines; fewer is more readable |
| DeepSeek V4 Pro | 7.67 | 0–20; mean of three runs |
| GPT-6.1 Sol | 11.33 | 0–20; mean of three runs |
| BTTF | 0.479 | 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. | 3570.031 | −117.811 |
| Source linesThe number of non-empty source lines. | 129 | +51.6 |
| 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.731 | −7.097 |
Intercept 8.87 + feature contributions = -64.438 (log-odds).
Score = sigmoid(-64.438) = 0.
| Score | 0.615 |
|---|
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. | 130 | −3.567 |
| Indentation frequencyHow rapidly indentation changes from line to line. | 86 | +2.238 |
| Number layout frequencyHow rapidly the number of numeric values per line changes through the code. | 86 | −1.553 |
| Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom. | 128.772 | +1.39 |
| Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right. | 97.631 | +0.771 |
| 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. | 99.977 | −0.569 |
| Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *. | 0.073 | +0.229 |
Intercept 0.07 + feature contributions = -0.991 (log-odds).
Score = sigmoid(-0.991) = 0.271.
| Score | 0.575 |
|---|
| Score | 37 |
|---|
Run 1
The code has logical class structure but suffers from severely unnatural control flow. The inverted conditionals like `if (!condition) {} else { ... }` and `if (!((!nodeIterator.hasNext())))` are ambiguous and disrupt reading flow. The empty if-blocks followed by else-blocks reverse normal programming conventions, making intent unclear. Nesting is relatively flat which is good, but action granularity is inconsistent—multiple operations occur in single lines while trivial checks are broken across multiple lines. The Javadoc, especially for Undirected, is excellent and improves clarity significantly. Static factory method and class hierarchy are sensible. Code length is acceptable but readability is severely impacted by the bizarre negated conditionals and double negatives, which appear intentional to obfuscate rather than clarify. A straightforward `if (condition) { ... } else { ... }` structure would dramatically improve comprehension.
Run 2
The code has serious readability problems. The most glaring issue is the bizarre `if (!((condition))) {} else { ... }` pattern used throughout, which inverts normal boolean logic and makes the control flow extremely confusing. This anti-pattern appears in `advance()`, `Directed.computeNext()`, and `Undirected.computeNext()`, forcing readers to mentally negate conditions and understand empty if-blocks. The nesting is also problematic—particularly in `Undirected.computeNext()` which has a while loop, nested while loop, and multiple conditionals. Variable names like `node` are somewhat ambiguous given it represents the current node being processed. The javadoc comments are good and help explain intent, and the class structure is logical, but the actual implementation code is needlessly convoluted. The `visitedNodes` null-handling adds unnecessary complexity. Action granularity is mixed—some lines are clean, but the inverted conditionals cram logic into single confusing expressions.
Run 3
The code has several readability problems. The most glaring issue is the repeated use of inverted conditional patterns like 'if (!condition) {} else { ... }' which inverts normal logic flow and adds confusing empty blocks. Nesting is moderate but the control flow is convoluted, especially in the computeNext() methods with nested while loops and inverted conditions. The Javadoc comments are helpful, particularly the undirected graph example with the ASCII diagram, which clarifies intent. However, the action granularity is poor in places - multiple operations occur within conditional branches without clear separation. Field naming is generally clear but the null-handling approach for visitedNodes adds cognitive overhead. The code structure could be improved by extracting the inverted conditionals into early returns or standard if-else patterns. Overall, the logic is sound but the presentation makes it unnecessarily difficult to follow the iteration flow.
Run 1
Code Structure: Shared iterator state and separate directed/undirected implementations provide logical organization. Nesting: Mostly moderate, though the undirected implementation has nested loops and conditionals. Clarity of intent: Descriptive names and detailed comments explain traversal, duplicate suppression, and self-loops, but redundant negations and empty if branches obscure straightforward conditions. Code length: Core logic is reasonably compact; excessive parentheses, empty branches, and a lengthy example add reading overhead. Action granularity: Most statements perform one action, although compact empty-if/else constructs reduce visual clarity. Reading flow: Class organization and traversal order are natural, but repeatedly decoding inverted conditions disrupts comprehension. Conventional positive conditions or simple early returns would substantially improve readability.
Run 2
Code Structure: A shared iterator base and separate directed/undirected implementations provide logical organization. Nesting: Mostly moderate, although the undirected implementation combines nested loops and conditionals. Clarity of intent: Descriptive names and explanatory comments clarify edge traversal, duplicate avoidance, and self-loop handling, but redundant negations and empty if branches obscure otherwise simple conditions. Code length: The implementation is reasonably compact; extensive documentation is useful, while unnecessary parentheses and empty branches add noise. Action granularity: Most statements perform one action per line, but compressed empty branches reduce visual clarity. Reading flow: Methods follow a coherent traversal sequence, yet repeated inverted if/else patterns force readers to mentally simplify conditions. Nullable state and adding null to the visited set also require extra reasoning, partly mitigated by comments.
Run 3
Code Structure: The shared iterator base and separate directed/undirected implementations provide logical organization. Nesting: Loop and conditional depth is moderate, though the undirected iterator requires more tracking. Clarity of intent: Descriptive names and helpful comments explain traversal, duplicate prevention, and self-loops, but redundant negations and empty if branches obscure otherwise simple conditions. Code length: The implementation is reasonably compact; the lengthy example adds useful context, while convoluted conditionals add unnecessary syntax. Action granularity: Most statements perform one action, but inline empty branches and else clauses compress control flow awkwardly. Reading flow: Methods follow a sensible traversal sequence, but inverted conditions repeatedly interrupt comprehension, and nullable iterator state adds cognitive overhead.