Sample
Schnappinger/jsweet/def.dom.NodeList
Human rating uses the original dataset scale.
Scores
| Method | Score | Scale | Dataset rank (0–100) |
|---|---|---|---|
| Posnett | 0.517 | 0–1; higher is more readable | 79.6Δ 11.8 |
| Scalabrino | 0.977 | 0–1; higher is more readable | 99.7Δ 8.2 |
| Dorn | 0.886 | 0–1; higher is more readable | 95.4Δ 4.0 |
| Mi | 0.693 | 0–1; higher is more readable | 82.8Δ 8.6 |
| LLOC | 4 | Logical lines; fewer is more readable | 87.0Δ 4.5 |
| DeepSeek V4 Pro | 16.67 | 0–20; mean of three runs | 59.9Δ 31.5 |
| GPT-6.1 Sol | 18.67 | 0–20; mean of three runs | 86.5Δ 5.0 |
| BTTF | 0.655 | 0–1; higher is more readable | 68.0Δ 23.4 |
| Human | 4 | 1–4; original rating | 91.4 |
Views
Loading feature diagnosis…
Source regions
Feature contributions
Feature contributions
| Feature | Value | Contribution (log-odds) |
|---|---|---|
| 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.675 | −7.012 |
| Halstead volumeHow much symbolic information the code contains. It combines the total number of operators and values with the number of distinct ones. | 199.686 | −6.59 |
| Source linesThe number of non-empty source lines. | 12 | +4.8 |
Intercept 8.87 + feature contributions = 0.069 (log-odds).
Score = sigmoid(0.069) = 0.517.
| Score | 0.977 |
|---|
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. | 36 | +2.14 |
| 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. | 12 | +0.611 |
| Number layout frequencyHow rapidly the number of numeric values per line changes through the code. | 1 | +0.398 |
| Indentation frequencyHow rapidly indentation changes from line to line. | 12 | −0.322 |
| Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom. | 11.811 | −0.245 |
| Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *. | 0.077 | +0.198 |
Intercept 0.07 + feature contributions = 2.047 (log-odds).
Score = sigmoid(2.047) = 0.886.
| Score | 0.693 |
|---|
| Score | 4 |
|---|
Run 1
The code is highly readable due to its simple, flat structure and clear purpose. It defines a minimal interface with four members, each on a single line, which makes it easy to scan. There is no nesting or complex logic, and the naming is conventional (e.g., 'NodeList', 'length', 'item'). The use of annotations (@Interface) and the 'native' keyword is concise and appropriately communicates intent to developers familiar with Java-based web APIs. The code length is minimal, and the reading flow is natural, with fields and methods grouped logically. The only minor deduction is that the 'prototype' static field and '$get' method are slightly non-standard without additional context, but this is acceptable given the domain.
Run 2
The code is concise, well-structured, and easy to read. It defines a single interface-like abstract class with two related properties and three native methods, all clearly separated with minimal nesting. Intent is clear: NodeList provides indexed access to Node objects. Each declaration is on its own line, and the use of JavaDoc/annotations is consistent. The only minor deductions are the lack of explanatory comments for the native methods and the slightly arbitrary ordering of members (length, item, $get, prototype), but overall the code is highly readable.
Run 3
The code is concise and clearly structured, representing a minimal interface definition. It uses a flat structure with no nesting, making it easy to follow. The intent—defining a NodeList DOM interface with a length property and methods for accessing nodes—is unambiguous. Each member is declared on its own line, adhering to good action granularity and reading flow. The native keyword and annotation are appropriate for the context. However, the score is slightly lowered because the use of the $get method name is non-standard and could confuse readers unfamiliar with the JSweet transpiler conventions. Additionally, the static prototype field is a low-level detail that might seem out of place in a modern TypeScript/Java hybrid. Overall, the code is highly readable but carries minor domain-specific quirks.
Run 1
Code Structure: A small, logically organized class groups the length field, node-access methods, and prototype field. Nesting: Only the class scope is present, making the code easy to scan. Clarity of intent: NodeList, length, and item clearly indicate a DOM collection binding; $get, the native declarations, and the interface annotation require some JSweet knowledge. Code length: Concise, with no unnecessary implementation or boilerplate. Action granularity: Each declaration occupies its own line. Reading flow: Consistent indentation and blank lines provide a natural progression, though placing the static prototype field with the other field could slightly improve grouping.
Run 2
Code Structure: The class is logically organized, with the length field, access methods, and prototype field clearly separated. Nesting: There is no nesting beyond the class body. Clarity of intent: NodeList, length, and item communicate a DOM collection interface; however, $get and prototype require familiarity with JSweet bindings. Code length: The declaration is concise, with no unnecessary implementation or boilerplate. Action granularity: Each field or method declaration occupies its own line. Reading flow: The package, annotation, class, and members follow a straightforward order, though the unconventional 'native public' modifier order slightly disrupts familiar Java reading patterns.
Run 3
Code Structure: A small, logically organized class groups its length field, access methods, and prototype field clearly. Nesting: No nested control flow; only the class scope. Clarity of intent: NodeList, length, and item communicate a DOM collection interface, although $get and the JSweet annotation require framework knowledge. Code length: Concise, with no unnecessary implementation or boilerplate. Action granularity: Each declaration occupies its own line. Reading flow: Package, annotation, class, and members follow a straightforward sequence, with blank lines separating declarations. Minor readability limitations are the unconventional native public modifier order and the framework-specific $get naming.