Sample
Schnappinger/jsweet/def.dom.TextEvent
Human rating uses the original dataset scale.
Scores
| Method | Score | Scale | Dataset rank (0–100) |
|---|---|---|---|
| Posnett | 0 | 0–1; higher is more readable | 64.9Δ 17.8 |
| Scalabrino | 0.632 | 0–1; higher is more readable | 27.1Δ 55.6 |
| Dorn | 0.026 | 0–1; higher is more readable | 24.4Δ 58.3 |
| Mi | 0.173 | 0–1; higher is more readable | 13.5Δ 69.1 |
| LLOC | 16 | Logical lines; fewer is more readable | 64.9Δ 17.8 |
| DeepSeek V4 Pro | 14.67 | 0–20; mean of three runs | 34.8Δ 47.9 |
| GPT-6.1 Sol | 16.33 | 0–20; mean of three runs | 45.9Δ 36.8 |
| BTTF | 0.551 | 0–1; higher is more readable | 50.8Δ 31.8 |
| Human | 3.97 | 1–4; original rating | 82.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. | 550.016 | −18.151 |
| Source linesThe number of non-empty source lines. | 20 | +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.991 | −7.487 |
Intercept 8.87 + feature contributions = -8.768 (log-odds).
Score = sigmoid(-8.768) = 0.
| Score | 0.632 |
|---|
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. | 164.952 | −3.322 |
| 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 |
| Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *. | 0.039 | +0.559 |
| Number layout frequencyHow rapidly the number of numeric values per line changes through the code. | 1 | +0.398 |
| Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code. | 21 | +0.293 |
| Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom. | 19.777 | −0.133 |
Intercept 0.07 + feature contributions = -3.642 (log-odds).
Score = sigmoid(-3.642) = 0.026.
| Score | 0.173 |
|---|
| Score | 16 |
|---|
Run 1
The code is straightforward and easy to understand due to its simple, flat structure. It follows a consistent pattern of declaring public fields and a native method, making the intent clear. There is no deep nesting, and each field declaration is on its own line, which aids readability. However, the code is somewhat verbose due to the many similar constant declarations, and it lacks comments or documentation, which could make the purpose of the constants less clear. The constructor and prototype declaration are standard, but the overall organization could be improved by grouping related constants or adding explanatory comments. The reading flow is logical but not particularly optimized for quick comprehension.
Run 2
The code is logically organized and flat, with one member per line, which aids readability. However, clarity of intent is reduced by the generic 'def.dom' package and lack of comments explaining the event's purpose. Method parameters and constants use partially unclear names, such as 'data' and 'inputMethod'. Code length is concise, but the empty constructor and static 'prototype' field are boilerplate-like, slightly reducing reading flow.
Run 3
The code is a simple class definition with a clear structure. Fields are grouped logically (instance state, then constants, then static/prototype). Indentation is consistent and the class is flat with no nested blocks. Intent is straightforward: define a DOM TextEvent with associated constants and a native initializer. Action granularity is one field/method per line, aiding scanability. However, readability is slightly reduced by the use of primitive types (String, double, Boolean) where enums or more descriptive types might clarify intent, and by the lack of comments explaining the meaning of DOM_INPUT_METHOD_* constants. The constructor is empty but minimally acceptable. Overall, the code is concise and easy to read for a platform API binding, though it assumes familiarity with DOM event specifications.
Run 1
Code Structure: A straightforward class declaration groups event data, an initializer, input-method fields, and construction, though spacing would make these groups clearer. Nesting: Minimal nesting makes the code easy to scan. Clarity of intent: Descriptive names and inheritance communicate its purpose, but the input-method fields resemble constants without being declared static final. Code length: Concise, with little unnecessary code, although the initializer signature is long. Action granularity: Each declaration occupies its own line, avoiding bundled actions. Reading flow: Generally natural, but the unwrapped method signature, lack of blank lines, unconventional modifier order, and tightly formatted empty constructor reduce readability.
Run 2
Code Structure: A straightforward class declaration, though grouping instance fields, input-method constants, and static members more distinctly would improve organization. Nesting: Minimal nesting makes scanning easy. Clarity of intent: The class and most member names clearly describe a text-event binding, but the native method lacks documentation, and constant-like fields are mutable doubles rather than explicit constants. Code length: Concise, with no unnecessary implementation. Action granularity: Each declaration occupies its own line, although the long method signature is harder to scan. Reading flow: Generally natural, but missing blank lines between logical groups, unconventional modifier order, and the tightly formatted empty constructor reduce polish.
Run 3
Code Structure: A straightforward class declaration, though grouping input-method constants separately from instance fields would improve organization. Nesting: Minimal, with only the class body and an empty constructor. Clarity of intent: The TextEvent name, inheritance, and descriptive fields communicate purpose; however, uppercase input-method fields look like constants but are neither static nor final. Code length: Concise, with no unnecessary implementation. Action granularity: Each declaration occupies its own line, although the long initTextEvent signature would benefit from multiline formatting. Reading flow: Generally natural, but blank lines between fields, the native method, constants, and constructor would make scanning easier.