Sample
Schnappinger/jsweet/def.dom.Selection
Human rating uses the original dataset scale.
Scores
| Method | Score | Scale | Dataset rank (0–100) |
|---|---|---|---|
| Posnett | 0 | 0–1; higher is more readable | 54.2Δ 42.2 |
| Scalabrino | 0.916 | 0–1; higher is more readable | 93.5Δ 2.9 |
| Dorn | 0.146 | 0–1; higher is more readable | 36.6Δ 59.7 |
| Mi | 0.016 | 0–1; higher is more readable | 3.3Δ 93.1 |
| LLOC | 23 | Logical lines; fewer is more readable | 55.9Δ 40.4 |
| DeepSeek V4 Pro | 16.33 | 0–20; mean of three runs | 53.1Δ 43.2 |
| GPT-6.1 Sol | 18 | 0–20; mean of three runs | 73.8Δ 22.6 |
| BTTF | 0.564 | 0–1; higher is more readable | 51.8Δ 44.6 |
| Human | 4 | 1–4; original rating | 96.4 |
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. | 1090.75 | −35.995 |
| Source linesThe number of non-empty source lines. | 27 | +10.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.519 | −6.779 |
Intercept 8.87 + feature contributions = -23.104 (log-odds).
Score = sigmoid(-23.104) = 0.
| Score | 0.916 |
|---|
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. | 112 | −1.079 |
| Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right. | 0 | −0.804 |
| Indentation frequencyHow rapidly indentation changes from line to line. | 1 | −0.703 |
| 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.062 | +0.339 |
| Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code. | 28 | +0.045 |
| Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom. | 26.85 | −0.035 |
Intercept 0.07 + feature contributions = -1.768 (log-odds).
Score = sigmoid(-1.768) = 0.146.
| Score | 0.016 |
|---|
| Score | 23 |
|---|
Run 1
The code is highly readable. It has a logical structure with clear separation between properties and methods, following a consistent ordering. There is no nesting, as it's a flat class definition. The intent is unambiguous: it implements the DOM Selection interface. The code is concise; each method is declared in a single line, which is appropriate for native bindings. Action granularity is excellent, with one action per line. Reading flow is natural, with related methods grouped together and a familiar naming convention. The only minor drawback is the automatic generation artifact of an empty constructor, but this doesn't significantly impact readability.
Run 2
The code is straightforward and well-structured for a DOM API wrapper. It declares fields before methods, maintains consistent formatting, and uses clear method names that match the underlying Selection API. Nesting is non-existent, and each line represents one declaration or action. The only minor issues are the use of `double` for offsets that are typically integers in JavaScript, and `Boolean` wrapper objects instead of primitives, which could confuse readers unfamiliar with the codebase's conventions. The constructor at the end is slightly out of logical order, but this is a minor structural issue. Overall, the code is highly readable, concise, and unambiguous in its intent.
Run 3
The code demonstrates decent structure with clear separation between fields and methods. It follows Java-like conventions with public fields declared first, then methods, which aids readability. Each declaration is on its own line, maintaining good action granularity. The nesting is completely flat with no conditional blocks or loops, which is appropriate for this type of interface/type definition. Method names are descriptive and follow standard DOM API conventions, making intent clear. However, the code loses points for several reasons: the 'native' keyword without context is ambiguous, there's inconsistent use of wrapper types (Boolean vs double vs String), and no comments or documentation explaining the purpose of the class or its members. While concise, the absence of any explanatory context and the repetitive native method declarations make it feel like boilerplate code rather than thoughtfully designed code.
Run 1
Code Structure: Fields and native methods are logically grouped, although the static prototype field and constructor could be separated more clearly. Nesting: Only a single class scope, making the code easy to scan. Clarity of intent: Familiar DOM Selection terminology and descriptive method and parameter names communicate purpose well; the native-binding context is implicit. Code length: Concise declarations with no unnecessary implementation details. Action granularity: Each field or method declaration occupies its own line. Reading flow: Consistent formatting and related method names support natural reading, though blank lines between sections and conventional modifier ordering would improve presentation.
Run 2
Code Structure: Fields and native methods are logically grouped, though the trailing prototype field and constructor slightly weaken organization. Nesting: Only the class scope is present, making the code easy to scan. Clarity of intent: Descriptive names clearly identify a DOM selection API; native declarations appropriately omit implementations. Code length: Concise, with no unnecessary logic or repetition beyond the required API declarations. Action granularity: Each field or method declaration occupies its own line. Reading flow: Consistent indentation and predictable declarations support natural reading, but blank lines between member groups and conventional 'public native' modifier ordering would improve readability.
Run 3
Code Structure: Clearly organized as a compact API declaration, with fields followed by methods, though the static prototype and constructor placement slightly weaken grouping. Nesting: Flat, with no nested control flow. Clarity of intent: Descriptive class, field, and method names make the selection API understandable; native declarations appropriately omit implementation details. Code length: Concise, with little unnecessary content. Action granularity: Each field or method declaration occupies its own line. Reading flow: Consistent indentation and predictable declarations support easy scanning, but blank lines between sections and conventional 'public native' modifier ordering would improve readability.