Sample
Schnappinger/jsweet/def.dom.XPathEvaluator
Human rating uses the original dataset scale.
Scores
| Method | Score | Scale | Dataset rank (0–100) |
|---|---|---|---|
| Posnett | 0.001 | 0–1; higher is more readable | 68.2Δ 8.5 |
| Scalabrino | 0.664 | 0–1; higher is more readable | 30.5Δ 29.3 |
| Dorn | 0.114 | 0–1; higher is more readable | 35.3Δ 24.4 |
| Mi | 0.021 | 0–1; higher is more readable | 3.6Δ 56.1 |
| LLOC | 6 | Logical lines; fewer is more readable | 79.7Δ 20.0 |
| DeepSeek V4 Pro | 12.67 | 0–20; mean of three runs | 18.8Δ 40.9 |
| GPT-6.1 Sol | 17 | 0–20; mean of three runs | 55.3Δ 4.5 |
| BTTF | 0.547 | 0–1; higher is more readable | 49.8Δ 9.9 |
| Human | 3.93 | 1–4; original rating | 59.7 |
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. | 386.647 | −12.759 |
| 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.668 | −7.002 |
| Source linesThe number of non-empty source lines. | 10 | +4 |
Intercept 8.87 + feature contributions = -6.891 (log-odds).
Score = sigmoid(-6.891) = 0.001.
| Score | 0.664 |
|---|
Feature contributions
| Feature | Value | Contribution (log-odds) |
|---|---|---|
| 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. | 135 | −2.053 |
| Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right. | 0 | −0.804 |
| Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code. | 11 | +0.647 |
| Indentation frequencyHow rapidly indentation changes from line to line. | 9 | −0.426 |
| 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.057 | +0.391 |
| Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom. | 9.794 | −0.273 |
Intercept 0.07 + feature contributions = -2.05 (log-odds).
Score = sigmoid(-2.05) = 0.114.
| Score | 0.021 |
|---|
| Score | 6 |
|---|
Run 1
The code is a simple TypeScript declaration file for a DOM class, which is generally clear but has some readability issues. The structure is logical and flat, with no nesting, making it easy to follow. Intent is fairly clear for a declaration file, but overloads like `createNSResolver()` without arguments next to one with `Node` parameter may confuse readers without context. Code length is concise, appropriate for a wrapper. Each method is on one line, which is good for granularity, but method signatures are long, reducing scanning speed. The reading flow is natural for developers familiar with DOM APIs, but the mixed use of `native`, missing access modifiers, and implicit `public` reduces clarity. The empty constructor is redundant in TypeScript declarations. Overall, readable for experienced developers but lacks polish for broader audiences.
Run 2
The code is a simple, flat class definition with clear method signatures, making the intent easy to understand. Structure is logical, and nesting is minimal. However, readability is reduced by the presence of native methods, an empty constructor, a static prototype field, and overloaded methods without explanatory comments. The presence of both a static field named 'prototype' and a public constructor adds ambiguity. Action granularity is acceptable—each method is on a single line. Reading flow is natural due to the simple API surface. The score reflects the code being reasonably readable but lacking contextual clarity for a JavaScript-to-Java bridge scenario.
Run 3
The code is a short Java class with a clear purpose: defining an XPath evaluator interface. Structure is logical for a domain model, and intent is mostly clear from method names. However, readability suffers from several issues: use of 'native' methods without context, an overloaded createNSResolver with an empty implementation which is ambiguous, and the presence of a static 'prototype' field that seems out of place in idiomatic Java. The class is concise, but parameter names like 'type' are vague. There is minimal nesting, and each method is on one line, which keeps the file flat and action-per-line clean. Reading flow is interrupted by non-standard constructs ('native', 'prototype') that would confuse Java developers, suggesting this is transpiled or generated code rather than hand-written. Overall, it is readable in basic structure but lacks clarity in details and Java conventions.
Run 1
Code Structure: A compact class groups related XPath API declarations logically, though the prototype field and constructor interrupt the method grouping. Nesting: No nested logic, making the code easy to scan. Clarity of intent: Descriptive class, method, and parameter names clearly convey XPath functionality; the double type parameter and undocumented no-argument overload are less informative. Code length: Concise, with no redundant implementation. Action granularity: Each declaration occupies its own line, although the long evaluate signature would benefit from wrapping. Reading flow: Generally natural, but blank lines between methods, fields, and the constructor, conventional modifier ordering, and spacing in the empty constructor would improve readability.
Run 2
Code Structure: A simple, logically organized class containing related XPath operations, though grouping overloads together would improve organization. Nesting: No nested control flow, making the code easy to scan. Clarity of intent: Descriptive class, method, and parameter names communicate purpose; however, the numeric type parameter and prototype field are less self-explanatory. Code length: Concise, with no unnecessary implementation detail. Action granularity: Each declaration occupies its own line, although the empty constructor uses cramped formatting. Reading flow: Generally natural, but the long evaluate signature, lack of spacing between member groups, and separated createNSResolver overloads slightly reduce readability.
Run 3
Code Structure: A simple, logically organized class, though grouping the createNSResolver overloads would improve organization. Nesting: No nested control flow; only the class scope. Clarity of intent: XPath-related method and parameter names communicate purpose well, but the numeric type parameter and native binding conventions require external knowledge. Code length: Concise, with no unnecessary implementation detail. Action granularity: Each declaration occupies its own line, making members easy to distinguish. Reading flow: Mostly natural, but the long evaluate signature, lack of spacing between member groups, and placement of the no-argument overload after the constructor slightly reduce readability.