Sample
int-932deb4ba7e9-I12
Inline all eligible single-use intermediate local variables
Scores
| Method | Score | Scale |
|---|---|---|
| Posnett | 0 | 0–1; higher is more readable |
| Scalabrino | 0.622 | 0–1; higher is more readable |
| Dorn | 0.284 | 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 | 17 | 0–20; mean of three runs |
| GPT-6.1 Sol | 17.33 | 0–20; mean of three runs |
| BTTF | 0.5 | 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. | 3304.828 | −109.059 |
| 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.721 | −7.082 |
Intercept 8.87 + feature contributions = -55.671 (log-odds).
Score = sigmoid(-55.671) = 0.
| Score | 0.622 |
|---|
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.752 | +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.066 | +0.296 |
Intercept 0.07 + feature contributions = -0.924 (log-odds).
Score = sigmoid(-0.924) = 0.284.
| Score | 0.575 |
|---|
| Score | 37 |
|---|
Run 1
The code is highly readable with clear logical organization: an abstract base class encapsulates shared logic, while directed and undirected variants are cleanly separated into subclasses. Nesting is minimal and control flow is straightforward. The intent of each method and field is well-documented with Javadoc and inline comments, including explanations of non-obvious decisions like the use of null in `visitedNodes` and the safety of `requireNonNull`. Code length is appropriate—concise but not overly compact. Action granularity is mostly one action per line, contributing to clarity. The reading flow is natural: fields, constructors, static factory, shared helper, then subclasses. Minor deductions: the inner `while (true)` loops and reliance on state (`node`, `successorIterator`) add slight cognitive load, and the `@Nullable` set with null `visitedNodes` is a bit unusual despite explicit comments. Overall, it is exceptionally well-structured for a graph iterator implementation.
Run 2
The code is well-structured with a clear class hierarchy and separation of concerns. The abstract base class handles common logic while Directed and Undirected subclasses implement specific traversal behavior. Nesting is minimal and manageable. Javadoc comments explain non-obvious behavior, especially the undirected deduplication logic with a helpful diagram. Variable names are descriptive and intent is generally clear. However, readability is slightly reduced by the use of nullable fields and the requirement for `requireNonNull` checks scattered throughout, which adds cognitive overhead. The `while (true)` loops with multiple exit points are acceptable but require careful reading. The undirected traversal's use of a visited set containing `null` as a sentinel is noted but still requires mental effort. Overall, this is professional-quality code with good structure and documentation.
Run 3
The code is highly readable with clear structure and intent. The class hierarchy separates directed and undirected graph traversal logic cleanly, and the Javadoc (especially the undirected case diagram) effectively explains the algorithm's behavior. Nesting is minimal with only one level of loop depth in computeNext methods. Variable names are descriptive, and action granularity is appropriate with one primary action per line. The state management pattern (node/successorIterator fields with advance() helper) is well-documented with helpful comments explaining null safety assumptions. Minor readability impacts: the `while (true)` loops with multiple return points require careful reading, and the null-setting of visitedNodes at the end adds slight complexity. These are offset by strong documentation and clear separation of concerns.
Run 1
Code Structure: Well organized into a shared iterator base and separate directed/undirected implementations, with traversal advancement centralized. Nesting: Generally shallow, although the undirected implementation has nested loops and a conditional that require closer attention. Clarity of intent: Descriptive names and useful comments explain duplicate suppression, self-loops, and null-safety invariants. However, adding null to visitedNodes and clearing the set on completion introduce subtle state conventions. Code length: Implementation is concise; the lengthy undirected example helps understanding but adds substantial reading overhead. Action granularity: Most lines perform one clear action, with only straightforward combined expressions. Reading flow: Factory, initialization, advancement, and specialized traversal follow a logical sequence. Stateful iteration and reliance on AbstractIterator lifecycle behavior slightly reduce immediate readability.
Run 2
Code Structure: Shared traversal logic is cleanly separated from directed and undirected implementations. Nesting: Mostly shallow, although undirected traversal uses nested loops and a conditional. Clarity of intent: Descriptive names, documented invariants, and the duplicate-filtering example explain behavior well; nullable state and initially adding null to the visited set introduce minor cognitive overhead. Code length: Implementation is concise, though the extensive example and repeated null-safety explanations lengthen reading. Action granularity: Statements generally perform one action per line, with straightforward state updates. Reading flow: Factory, constructor, shared advancement, and specialized iterators follow a logical order. Understanding iteration requires tracking state across advance() and computeNext(), but comments make that manageable.
Run 3
Code Structure: Well organized into a shared iterator base and separate directed and undirected implementations, with advancement logic centralized. Nesting: Mostly shallow, though the undirected implementation has nested loops and a conditional. Clarity of intent: Descriptive names and helpful comments explain duplicate suppression, self-loops, and null-safety invariants; nullable state and the initial null entry in visitedNodes require extra attention. Code length: Implementation is concise, although the extensive graph example makes the listing longer. Action granularity: Statements generally perform one action per line, with only straightforward composed expressions. Reading flow: Factory, initialization, advancement, and specialized iteration follow a natural progression. Understanding the stateful iteration still requires tracking interactions among node, successorIterator, and visitedNodes.