Sample
Schnappinger/jsweet/org.jsweet.transpiler.util.ErrorCountTranspilationHandler
Human rating uses the original dataset scale.
Scores
| Method | Score | Scale | Dataset rank (0–100) |
|---|---|---|---|
| Posnett | 0.869 | 0–1; higher is more readable | 86.6Δ 1.1 |
| Scalabrino | 0.931 | 0–1; higher is more readable | 95.5Δ 10.1 |
| Dorn | 0.499 | 0–1; higher is more readable | 60.7Δ 24.8 |
| Mi | 0.779 | 0–1; higher is more readable | 94.4Δ 8.9 |
| LLOC | 25 | Logical lines; fewer is more readable | 53.0Δ 32.5 |
| DeepSeek V4 Pro | 17.67 | 0–20; mean of three runs | 83.0Δ 2.5 |
| GPT-6.1 Sol | 18 | 0–20; mean of three runs | 73.8Δ 11.7 |
| BTTF | 0.771 | 0–1; higher is more readable | 92.7Δ 7.3 |
| Human | 3.97 | 1–4; original rating | 85.5 |
Views
Loading feature diagnosis…
Source regions
Feature contributions
Feature contributions
| Feature | Value | Contribution (log-odds) |
|---|---|---|
| Source linesThe number of non-empty source lines. | 100 | +40 |
| Halstead volumeHow much symbolic information the code contains. It combines the total number of operators and values with the number of distinct ones. | 1195.742 | −39.46 |
| Byte entropyHow varied the bytes in the source text are. Repeated bytes give a lower value; a more even mixture gives a higher value. | 5.011 | −7.516 |
Intercept 8.87 + feature contributions = 1.895 (log-odds).
Score = sigmoid(1.895) = 0.869.
| Score | 0.931 |
|---|
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. | 101 | −2.54 |
| Indentation frequencyHow rapidly indentation changes from line to line. | 65 | +1.511 |
| Number layout frequencyHow rapidly the number of numeric values per line changes through the code. | 65 | −1.071 |
| Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom. | 99.87 | +0.986 |
| Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right. | 90.95 | +0.663 |
| Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *. | 0.043 | +0.528 |
| 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. | 90.099 | −0.151 |
Intercept 0.07 + feature contributions = -0.003 (log-odds).
Score = sigmoid(-0.003) = 0.499.
| Score | 0.779 |
|---|
| Score | 25 |
|---|
Run 1
The code is well-structured, following a clear class hierarchy and standard Java conventions. It is logically organized with fields, constructor, and methods in a natural order. The nesting is minimal—only a simple switch statement within a single if block, without multi-level indentation. Intent is clear; the class serves as a counting decorator, and method names are descriptive. The code length is appropriate, with no unnecessary verbosity or duplication. Action granularity is good, though the switch statement packs multiple operations per case, including possible repetition of problemCount++ across branches. Reading flow is natural, aided by Javadoc comments that briefly clarify each method's purpose. Minor improvements could include extracting the common problemCount++ increment before the switch or using a more concise approach for counting, but overall readability is high and the code is easy to follow.
Run 2
The code is highly readable with clear separation of concerns, minimal nesting, and self-documenting methods. The class structure is logical, following the decorator pattern with a single inheritance and straightforward method overrides. Nesting is limited to one level (switch statement inside an if-check), maintaining flat control flow. Intent is explicit through descriptive method names like getErrorCount, getWarningCount, and isDisabled. Code length is appropriate—concise without omitting necessary functionality. Action granularity is well-balanced: each increment operation occupies its own line within case blocks, though the switch could be simplified. Reading flow is natural, progressing from constructor to report logic to getters/setters. Javadoc comments are consistent and informative without being excessive. Minor improvements could include extracting the counting logic or using a Map for severity counts, but overall the code demonstrates excellent clarity and maintainability.
Run 3
This code is highly readable across all evaluated criteria. The structure is logical and follows a clear class hierarchy with appropriate delegation to a parent class. Nesting is minimal—only a single switch statement within an if block, keeping the code flat and easy to follow. Intent is clearly documented through meaningful class, method, and variable names, along with concise Javadoc comments that explain the purpose of each component. The code is appropriately concise without sacrificing clarity; each method serves a single purpose and avoids unnecessary verbosity. Action granularity is well-maintained, with one action per line in the report method's switch statement, making counting logic transparent. The reading flow follows a natural progression from class declaration through constructor, core logic, and getter/setter methods. The only minor deduction is the slightly redundant problemCount++ appearing in every switch case, which could be consolidated, but this doesn't significantly impact readability. Overall, this is an exemplary piece of well-structured, maintainable code.
Run 1
Code Structure: Well-organized decorator with grouped fields, a constructor, reporting logic, and accessors. Nesting: Shallow; only an if enclosing a switch. Clarity of intent: Descriptive names and documentation clearly explain counting and delegation, although getProblemCount's comment implies only errors and warnings while the default branch counts other severities too. Code length: Compact overall, but repeated problemCount increments and obvious accessor comments add minor redundancy. Action granularity: Each statement performs one clear action on its own line. Reading flow: Natural progression from initialization to behavior and accessors; unconditional delegation after counting is easy to follow.
Run 2
Code Structure: Well-organized decorator class with clearly separated fields, constructor, reporting logic, and accessors. Nesting: Limited to an if statement containing a switch, making the control flow easy to follow. Clarity of intent: Descriptive names and documentation explain counting and delegation, though the problem-count comment suggests only errors and warnings while the default branch counts other severities too. The negatively phrased disabled flag adds slight cognitive overhead. Code length: Concise overall, although problemCount++ is unnecessarily repeated across switch branches and accessor comments are somewhat redundant. Action granularity: Each statement performs one clear action on its own line. Reading flow: Natural progression from initialization to behavior and accessors; unconditional delegation after optional counting is particularly clear.
Run 3
Code Structure: Clearly organized decorator with grouped fields, a constructor, reporting logic, and accessors. Nesting: Limited to an if statement containing a switch, making control flow easy to follow. Clarity of intent: Descriptive class, method, and variable names communicate counting and delegation well. However, the problem-count documentation suggests only errors and warnings, while the default branch also counts other severities; the negatively named disabled flag adds slight cognitive overhead. Code length: Compact overall, though repeated problemCount increments and routine getter comments add minor redundancy. Action granularity: Each statement performs a single clear action. Reading flow: Natural progression from initialization through processing to state access, with consistent formatting and unconditional delegation clearly placed after counting.