Sample
Schnappinger/jsweet/def.dom.MediaSource
Human rating uses the original dataset scale.
Scores
| Method | Score | Scale | Dataset rank (0–100) |
|---|---|---|---|
| Posnett | 0 | 0–1; higher is more readable | 67.6Δ 1.9 |
| Scalabrino | 0.841 | 0–1; higher is more readable | 73.6Δ 4.2 |
| Dorn | 0.564 | 0–1; higher is more readable | 63.4Δ 6.1 |
| Mi | 0.298 | 0–1; higher is more readable | 20.1Δ 49.3 |
| LLOC | 11 | Logical lines; fewer is more readable | 70.6Δ 1.2 |
| DeepSeek V4 Pro | 15.33 | 0–20; mean of three runs | 41.3Δ 28.2 |
| GPT-6.1 Sol | 17 | 0–20; mean of three runs | 55.3Δ 14.2 |
| BTTF | 0.605 | 0–1; higher is more readable | 58.1Δ 11.4 |
| Human | 3.95 | 1–4; original rating | 69.5 |
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. | 491.143 | −16.208 |
| 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.56 | −6.84 |
| Source linesThe number of non-empty source lines. | 16 | +6.4 |
Intercept 8.87 + feature contributions = -7.777 (log-odds).
Score = sigmoid(-7.777) = 0.
| Score | 0.841 |
|---|
Feature contributions
| Feature | Value | Contribution (log-odds) |
|---|---|---|
| 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. | 17 | +0.434 |
| 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.058 | +0.374 |
| Indentation frequencyHow rapidly indentation changes from line to line. | 15 | −0.218 |
| 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. | 82 | +0.192 |
| Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom. | 15.759 | −0.19 |
Intercept 0.07 + feature contributions = 0.256 (log-odds).
Score = sigmoid(0.256) = 0.564.
| Score | 0.298 |
|---|
| Score | 11 |
|---|
Run 1
The code is generally clear and well-structured. It is a simple class definition with fields, methods, and constructors, organized logically. There is minimal nesting, and intent is straightforward: the class represents a MediaSource DOM interface with native implementations. Action granularity is good—each field and method declaration is on its own line. However, readability is slightly hindered by inconsistent formatting: missing indentation between members, inconsistent use of `native` with `public`, and overloaded methods (`endOfStream`) placed apart without grouping. The constructor is empty and placed near the bottom before static methods, which disrupts natural reading flow. Overall, the code is concise and easy to follow but could benefit from consistent formatting and better member ordering.
Run 2
The code is generally readable with a clear class structure and straightforward field/method declarations. Each member is on its own line, demonstrating good action granularity and flat nesting. Method names like addSourceBuffer and removeSourceBuffer clearly express intent. However, the class lacks documentation explaining its purpose or relationships to other classes. The mixed access modifiers (public, static, native) and inconsistent method overload placement (endOfStream appears separated from its overload) slightly impede reading flow. The magic numbers for readyState states are not documented, reducing clarity. Overall, the code is concise and well-organized but could benefit from comments and more consistent member ordering.
Run 3
The code is relatively readable but has some structural issues. The class definition is logically organized, grouping fields and methods together, but the ordering of methods (addSourceBuffer, endOfStream, removeSourceBuffer, then isTypeSupported, then endOfStream again) disrupts natural reading flow. Nesting is flat and acceptable. Clarity of intent is good—method names clearly indicate their purpose, and the native keyword signals platform-specific implementations. Code length is concise; the class is not overly long. Action granularity is mostly one action per line, which is good. However, the public fields at the top lack access modifiers or encapsulation, and the static prototype field appears odd. The duplicate endOfStream method with different signatures is slightly confusing without documentation. Overall, the code is understandable but could benefit from better organization and grouping of related methods.
Run 1
Code Structure: The class is straightforward, but interleaving instance methods, the static prototype field, the constructor, and static methods weakens organization. Nesting: No nested logic, making it easy to scan. Clarity of intent: Descriptive class and member names communicate a media-source API, although numeric readyState and error types obscure their meaning. Code length: Concise, with no unnecessary implementation detail. Action granularity: Each declaration occupies its own line. Reading flow: Generally natural, but grouping fields and related methods, placing endOfStream overloads together, and adding consistent spacing would improve readability.
Run 2
Code Structure: A straightforward class declaration, though mixing instance methods, a static field, the constructor, and static methods weakens organization. Nesting: Flat, with no nested control flow. Clarity of intent: Descriptive class, field, and method names make the media API understandable; numeric readyState and error types are less expressive. Code length: Concise, with no unnecessary implementation detail. Action granularity: Each field or method declaration occupies its own line. Reading flow: Generally easy to scan, but grouping related declarations, placing endOfStream overloads together, adding spacing, and using conventional modifier order would improve readability.
Run 3
Code Structure: A straightforward class with fields and native API declarations, though grouping static members, constructors, and overloaded methods would improve organization. Nesting: Almost entirely flat, with no nested control flow. Clarity of intent: Descriptive class, field, and method names make the media-source interface understandable, although numeric readyState and error parameters are less self-explanatory. Code length: Concise, with no unnecessary implementation detail. Action granularity: Each member occupies its own line, making declarations easy to distinguish. Reading flow: Generally easy to scan, but inconsistent member ordering, separated endOfStream overloads, unconventional modifier order, and minimal whitespace slightly disrupt the flow.