Sample
int-22a4d98982e8-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.868 | 0–1; higher is more readable |
| Dorn | 0.785 | 0–1; higher is more readable |
| Mi | 0.341 | 0–1; higher is more readable |
| LLOC | 16 | Logical lines; fewer is more readable |
| DeepSeek V4 Pro | 17.33 | 0–20; mean of three runs |
| GPT-6.1 Sol | 18 | 0–20; mean of three runs |
| BTTF | 0.68 | 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. | 1061.18 | −35.019 |
| Source linesThe number of non-empty source lines. | 52 | +20.8 |
| 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.297 | −6.445 |
Intercept 8.87 + feature contributions = -11.794 (log-odds).
Score = sigmoid(-11.794) = 0.
| Score | 0.868 |
|---|
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. | 53 | −0.84 |
| Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right. | 96 | +0.744 |
| 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.046 | +0.497 |
| 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. | 95.943 | −0.399 |
| Number layout frequencyHow rapidly the number of numeric values per line changes through the code. | 1 | +0.398 |
| Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom. | 51.814 | +0.314 |
Intercept 0.07 + feature contributions = 1.293 (log-odds).
Score = sigmoid(1.293) = 0.785.
| Score | 0.341 |
|---|
| Score | 16 |
|---|
Run 1
The code is well-structured, using a clean utility class with three static methods, each serving a clear purpose. Nesting is minimal, limited to straightforward conditional checks. Variable and method names (e.g., `isTimeoutException`, `newPreMigrationException`) clearly communicate intent. The code is concise, with each method focused on a single task. The `isTimeoutException` method uses early returns for flat, readable logic. Action granularity is good, with one logical operation per line. Reading flow is natural, moving from exception checking to exception creation. Minor deductions: repeated 'No controller appears to be active.' string could be extracted for consistency, and some string concatenation in `newWrongControllerException` is slightly awkward but not unreadable.
Run 2
The code is well-structured and highly readable. Each method has a clear purpose, and Javadoc comments succinctly explain intent. The methods are concise, with minimal nesting and mostly one action per line. The reading flow is natural, and conditional logic is simple if-else branching. Minor deductions: the redundant else blocks slightly increase length, and isTimeoutException mutates the exception parameter, which could be slightly clearer with a local variable. Overall, very clean code.
Run 3
The code is well-structured with clear separation of concerns and consistent formatting. The class is logically organized with three methods, each with a single responsibility. Nesting is minimal - only one level in the helper methods with early returns, which improves readability. The intent is immediately clear from descriptive method names (isTimeoutException, newPreMigrationException, newWrongControllerException) and helpful Javadoc comments. The code is concise without being cryptic, with appropriate use of early returns to avoid unnecessary nesting. Each line performs a single logical action, and the reading flow is natural from top to bottom. The only minor deductions are for the slightly redundant if-else structures in the exception creation methods and the absence of a private constructor for what appears to be a utility class.
Run 1
Code Structure: Three focused utility methods are logically organized, with minor duplication in the inactive-controller message. Nesting: Shallow conditionals and early returns keep control flow simple. Clarity of intent: Descriptive method names, explicit exception types, and Javadoc clearly communicate purpose. Code length: The implementation is concise; else branches after returns and repetitive documentation add slight verbosity. Action granularity: Most lines perform one action, although inline null checks combine a condition and return on one line. Reading flow: Consistent formatting and straightforward branching make the code easy to follow; separating package and import sections and grouping imports consistently would improve presentation.
Run 2
Code Structure: Three focused utility methods are logically organized with helpful documentation. Nesting: Control flow is shallow, with guard clauses and simple if/else branches. Clarity of intent: Descriptive method names, explicit exception types, and clear messages make each purpose easy to understand. Code length: Methods are short and appropriately scoped, though else blocks after returns and repeated exception construction add minor redundancy. Action granularity: Each statement performs one action; inline null-check returns slightly compress the formatting without obscuring behavior. Reading flow: The code progresses naturally from validation to exception inspection or construction. Minor improvements include separating imports from the package declaration, grouping imports consistently, and using braces for inline conditionals.
Run 3
Code Structure: Three focused methods are logically organized within a cohesive exception utility class. Nesting: Shallow conditionals and early returns keep control flow easy to follow. Clarity of intent: Descriptive method names, JavaDoc, and explicit exception messages clearly communicate purpose. Code length: Methods are short and appropriately sized, although repeated inactive-controller messages and unnecessary else blocks add minor redundancy. Action granularity: Most lines perform one action; inline null checks combine a condition and return but remain understandable. Reading flow: Consistent formatting and straightforward branching support natural reading. Minor drawbacks include reassigning the exception parameter and limited spacing around the package and imports.