Sample
int-4b9fbca419b4-I13
Lower every eligible classic and enhanced for loop to a while loop
Scores
| Method | Score | Scale |
|---|---|---|
| Posnett | 0 | 0–1; higher is more readable |
| Scalabrino | 0.781 | 0–1; higher is more readable |
| Dorn | 0.731 | 0–1; higher is more readable |
| Mi | 0.516 | 0–1; higher is more readable |
| LLOC | 18 | Logical lines; fewer is more readable |
| DeepSeek V4 Pro | 17.33 | 0–20; mean of three runs |
| GPT-6.1 Sol | 17 | 0–20; mean of three runs |
| BTTF | 0.606 | 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. | 2525.522 | −83.342 |
| Source linesThe number of non-empty source lines. | 75 | +30 |
| 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.021 | −6.032 |
Intercept 8.87 + feature contributions = -50.504 (log-odds).
Score = sigmoid(-50.504) = 0.
| Score | 0.781 |
|---|
Feature contributions
| Feature | Value | Contribution (log-odds) |
|---|---|---|
| Indentation frequencyHow rapidly indentation changes from line to line. | 75 | +1.857 |
| Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code. | 76 | −1.655 |
| Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right. | 0 | −0.804 |
| Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom. | 74.902 | +0.637 |
| Number layout frequencyHow rapidly the number of numeric values per line changes through the code. | 1 | +0.398 |
| Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *. | 0.07 | +0.261 |
| 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. | 81 | +0.234 |
Intercept 0.07 + feature contributions = 0.999 (log-odds).
Score = sigmoid(0.999) = 0.731.
| Score | 0.516 |
|---|
| Score | 18 |
|---|
Run 1
The code is well-structured and highly readable. It follows clear organizational patterns with a builder pattern implementation, simple constructor delegation, and straightforward method overrides. Nesting is minimal except in the singletonRequest method where the chained List.of calls create some depth, but this is a common pattern that remains clear. Intent is explicit through descriptive method and variable names. Code length is concise without sacrificing clarity. Action granularity is excellent in most places, with each method performing a single logical operation. The singletonRequest method chains multiple setters but maintains readability through consistent indentation. Reading flow is natural, following a logical progression from class declaration through builder, constructor, and utility methods. Minor deductions for the multi-line chained call in singletonRequest which could be extracted, but overall this code represents production-quality readability.
Run 2
The code is well-structured with clear separation of concerns: a Builder class, data accessor, parse method, and factory method. Nesting is minimal, with only one level of indentation in the singletonRequest method. Intent is clear — this is a Kafka VoteRequest with a builder and parser. The chained setter calls are concise and readable, but the deep method chaining in singletonRequest slightly reduces readability due to multiple nested method calls on a single logical line. Action granularity is mostly one action per line, though the nested List.of and chained setters combine multiple actions. Reading flow is natural: imports, class declaration, builder, constructor, accessor, error handling, parsing, and factory method in a logical order. Overall, the code is maintainable and clear, with only minor readability concerns from the nested method chaining.
Run 3
The code is well-structured with clear separation of concerns: a Builder class, core request class, and static factory methods. Nesting is moderate, mostly limited to builder chains in singletonRequest which, while visually nested, follows a consistent fluent pattern. Intent is clear - constructing and parsing VoteRequest objects. Code length is appropriate and concise, with no unnecessary methods or fields. Action granularity is mostly good, though the fluent builder chain in singletonRequest packs many actions into a small space. Reading flow is natural, with methods logically ordered and imports organized. Minor deductions for the deeply chained fluent API in singletonRequest which slightly reduces scannability, and for the lack of explicit parameter validation, but overall this is clean, idiomatic Java code that would be easy for Kafka developers to understand and maintain.
Run 1
Code Structure: The request class and nested builder are logically organized, with focused methods and standard overrides. Nesting: Most methods are flat, but singletonRequest contains deeply nested object construction and lists that require careful tracking. Clarity of intent: Descriptive method names and setters communicate purpose well, although seven parameters and similar epoch names increase cognitive load. Code length: Concise overall, with little unnecessary code. Action granularity: Assignments and fluent setters generally occupy separate lines, though nested construction combines several operations within one expression. Reading flow: The class follows a natural progression from builder to request methods and helpers; inconsistent indentation and clustered closing parentheses in singletonRequest slightly disrupt readability.
Run 2
Code Structure: The request class and nested builder are logically organized, with focused methods and conventional API patterns. Nesting: Most methods are flat, but singletonRequest contains deeply nested object construction and list wrapping that complicate visual parsing. Clarity of intent: Descriptive method names, parameter names, and setters make the purpose clear, although the seven-parameter helper requires careful reading. Code length: The implementation is concise, with little unnecessary code. Action granularity: Most statements perform one clear action; the fluent construction places individual setters on separate lines, but combines several object creations into one expression. Reading flow: The progression from builder to request methods is natural. Inconsistent indentation and clustered closing parentheses in singletonRequest slightly disrupt the otherwise straightforward flow.
Run 3
Code Structure: Well organized around a conventional request class, nested builder, and focused factory methods. Nesting: Most methods are flat, but singletonRequest contains several nested constructors and List.of calls that obscure closing-parenthesis relationships. Clarity of intent: Descriptive method names, parameter names, and setters make the purpose clear; the seven-parameter factory requires some effort to follow. Code length: Concise overall, with reasonable framework boilerplate and no unnecessary logic. Action granularity: Assignments and fluent setters generally occupy separate lines, although object construction and collection wrapping combine several operations in one expression. Reading flow: Methods follow a natural progression, but inconsistent indentation in singletonRequest and its dense nested expression interrupt otherwise smooth reading.