Sample
Schnappinger/jsweet/org.jsweet.input.typescriptdef.visitor.TypeReferenceExpander
Human rating uses the original dataset scale.
Scores
| Method | Score | Scale | Dataset rank (0–100) |
|---|---|---|---|
| Posnett | 0 | 0–1; higher is more readable | 43.1Δ 33.2 |
| Scalabrino | 0.56 | 0–1; higher is more readable | 16.1Δ 6.2 |
| Dorn | 0.426 | 0–1; higher is more readable | 57.4Δ 47.5 |
| Mi | 0.182 | 0–1; higher is more readable | 14.5Δ 4.6 |
| LLOC | 24 | Logical lines; fewer is more readable | 54.3Δ 44.4 |
| DeepSeek V4 Pro | 14 | 0–20; mean of three runs | 29.9Δ 20.0 |
| GPT-6.1 Sol | 14.33 | 0–20; mean of three runs | 19.8Δ 9.9 |
| BTTF | 0.454 | 0–1; higher is more readable | 39.9Δ 30.0 |
| Human | 2.17 | 1–4; original rating | 9.9 |
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. | 2499.171 | −82.473 |
| Source linesThe number of non-empty source lines. | 86 | +34.4 |
| 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.074 | −7.611 |
Intercept 8.87 + feature contributions = -46.814 (log-odds).
Score = sigmoid(-46.814) = 0.
| Score | 0.56 |
|---|
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. | 87 | −2.044 |
| Indentation frequencyHow rapidly indentation changes from line to line. | 62 | +1.407 |
| Number layout frequencyHow rapidly the number of numeric values per line changes through the code. | 62 | −1.002 |
| Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right. | 98.943 | +0.792 |
| Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom. | 85.94 | +0.791 |
| 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. | 98.977 | −0.527 |
| Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *. | 0.075 | +0.212 |
Intercept 0.07 + feature contributions = -0.3 (log-odds).
Score = sigmoid(-0.3) = 0.426.
| Score | 0.182 |
|---|
| Score | 24 |
|---|
Run 1
The code is moderately readable. The class has a clear purpose and follows a logical structure with imports, header comment, and method organization. Method names and variable names are descriptive. The main method visitTypeReference has some logical complexity with nested if-else blocks that could be extracted into helper methods. The nesting depth reaches 4 levels in places, which impacts readability. The action granularity is mostly good with one logical operation per line, though some lines combine multiple operations. The use of static imports or constants for string literals like 'any' would improve clarity. The verbose logging blocks are repeated, creating some redundancy that could be refactored. The method onScanEnded is clean and simple. Overall, the code follows reasonable Java conventions but could benefit from extracting the type rewriting logic into smaller, more focused methods to reduce nesting and improve clarity of intent.
Run 2
The code is reasonably structured with a clear single-purpose class and logical method organization. However, it suffers from deep nesting (3-4 levels in visitTypeReference) and multiple actions within complex conditional blocks. The intent is mostly clear from the class-level Javadoc, but the branch logic is verbose and could be simplified with early returns or extracted methods. The repeated verbose logging blocks add length and reduce readability. While naming is good and the overall flow is understandable, the nested conditional logic makes the main method harder to follow than necessary. Action granularity is mixed—some lines do one thing, but most conditionals bundle multiple related operations.
Run 3
The code has a clear structure with good separation of concerns in the visitTypeReference method. However, it suffers from deeply nested conditionals (4+ levels), making the logic harder to follow. The intent is generally clear - expanding type references - but the nested if-else blocks obscure the flow. Code length is appropriate but could be more concise by extracting helper methods. Action granularity is mostly good with one operation per line. Reading flow is somewhat disrupted by the nesting and the need to mentally track multiple conditions. Variable names are descriptive and the comments help understanding. The main improvement would be reducing nesting through early returns or guard clauses, and extracting the type rewriting logic into smaller, named methods.
Run 1
Code Structure: The class is logically organized into initialization, reference processing, and scan completion, but rewriting and logging logic are duplicated. Nesting: Several nested conditionals make the main method harder to follow; guard clauses and extracted helpers would flatten it. Clarity of intent: The class documentation and descriptive names explain its purpose, although the variable 't' and the compound core-type condition require extra interpretation. Code length: Reasonably compact overall, but repeated logging and name-update sequences add avoidable length. Action granularity: Most lines perform one action, with clear separation between lookup, counting, logging, and mutation. Reading flow: Formatting and method order support natural reading, but the nested else/if chain and repeated getName() calls interrupt the flow.
Run 2
Code Structure: The class is logically organized into initialization, reference processing, and a completion hook, although the main method could separate its two rewriting cases into helpers. Nesting: Several nested conditionals, including an else containing another if, make the qualification branch harder to follow. Clarity of intent: The class documentation and descriptive names explain the purpose well; the short variable name 't' and compound condition slightly reduce clarity. Code length: Generally compact, but repeated logging and rewrite bookkeeping add avoidable duplication. Action granularity: Most statements perform one action per line, with sensible wrapping of long expressions. Reading flow: Processing proceeds naturally from validation to rewriting and superclass traversal, then summary reporting; deep indentation and repeated getName calls interrupt an otherwise clear flow.
Run 3
Code Structure: The class is logically organized into initialization, reference processing, and end-of-scan reporting, though rewriting and logging could be extracted into helpers. Nesting: The main method has several deeply nested conditionals; guard clauses and an else-if would simplify it. Clarity of intent: The class documentation, descriptive names, and explicit type updates explain its purpose, although the variable 't' and documentation typos reduce clarity slightly. Code length: Overall length is reasonable, but duplicated logging and repeated getName() calls add avoidable verbosity. Action granularity: Statements generally perform one action per line, with compound conditions formatted across lines. Reading flow: Processing proceeds naturally from validation to transformation and traversal, but nested branches and repeated logging interrupt the flow.