Sample
Schnappinger/jsweet/def.dom.CanvasRenderingContext2D
Human rating uses the original dataset scale.
Scores
| Method | Score | Scale | Dataset rank (0–100) |
|---|---|---|---|
| Posnett | 0 | 0–1; higher is more readable | 18.1Δ 33.3 |
| Scalabrino | 0.816 | 0–1; higher is more readable | 66.8Δ 15.5 |
| Dorn | 0 | 0–1; higher is more readable | 7.6Δ 43.7 |
| Mi | 0 | 0–1; higher is more readable | 0.7Δ 50.7 |
| LLOC | 91 | Logical lines; fewer is more readable | 26.2Δ 25.1 |
| DeepSeek V4 Pro | 4.33 | 0–20; mean of three runs | 1.0Δ 50.3 |
| GPT-6.1 Sol | 14 | 0–20; mean of three runs | 16.2Δ 35.1 |
| BTTF | 0.403 | 0–1; higher is more readable | 34.0Δ 17.3 |
| Human | 3.9 | 1–4; original rating | 51.3 |
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. | 9684.694 | −319.595 |
| Source linesThe number of non-empty source lines. | 96 | +38.4 |
| 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.737 | −7.106 |
Intercept 8.87 + feature contributions = -279.43 (log-odds).
Score = sigmoid(-279.43) = 0.
| Score | 0.816 |
|---|
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. | 213.948 | −5.397 |
| Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code. | 97 | −2.398 |
| Number layout frequencyHow rapidly the number of numeric values per line changes through the code. | 95 | −1.759 |
| Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom. | 95.944 | +0.931 |
| 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.061 | +0.347 |
Intercept 0.07 + feature contributions = -9.712 (log-odds).
Score = sigmoid(-9.712) = 0.
| Score | 0 |
|---|
| Score | 91 |
|---|
Run 1
This code is highly unreadable. While it is logically organized as a class definition with fields and methods, the structure is undermined by massive method overloading and repetitive parameter lists. Nesting is not an issue (flat structure), but clarity of intent is severely hampered by ambiguous parameter names like 'imageDataOrSw' and overloaded methods with no documentation. Code length is excessive and unnecessarily long due to dozens of near-duplicate overloads for drawImage, putImageData, and createImageData. Action granularity is acceptable (one declaration per line), but reading flow is poor because related overloads are scattered and interleaved rather than grouped logically. The lack of comments or separation between overload variants makes it difficult to discern which version serves what purpose.
Run 2
This is an auto-generated or machine-written type declaration file that is extremely unreadable by human standards. The structure is technically flat, but the class is a disorganized dump of fields and overloaded methods. There is no logical grouping, comments, or sectioning. Nesting is minimal, which is the only positive. Clarity of intent is low—method names follow DOM API names, but parameter names like 'imageDataOrSw' and 'dirtyX' are unclear, and the excessive overloading creates ambiguity. Code length is unnecessarily long due to repetitive overloads that could be organized or documented. Action granularity is technically one method per line, but lines are extremely long and overloaded, reducing readability. Reading flow is poor: fields are listed first, then methods, then overloads in a near-random sequence (e.g., createImageData appears repeatedly in different forms). Overall, the code is machinable but not human-friendly.
Run 3
This code is a machine-generated type definition file for the Canvas 2D API. While it has a flat structure with one method declaration per line, it suffers from severe readability issues. The main problems are extreme repetition (especially the drawImage overloads with 12+ nearly identical variants), ambiguous parameter names like 'imageDataOrSw', and poor organization where overloaded methods are scattered throughout the file rather than grouped together. The mix of type unions, native declarations, and inconsistent parameter ordering creates cognitive overhead. The code length is unnecessarily inflated by redundant overloads that could be handled with optional parameters or union types. Reading flow is disrupted by jumping between different method overloads across the file. While it's technically parseable and follows Java/JSweet conventions, it reads like auto-generated boilerplate rather than human-maintained code, making it difficult to scan or understand at a glance.
Run 1
Code Structure: Fields precede methods, but related overloads are scattered and lack functional grouping. Nesting: Completely flat declarations make individual members easy to scan. Clarity of intent: The class and most member names clearly describe a canvas API; abbreviated parameters and absent documentation obscure some signatures. Code length: Extensive repetitive overloads create substantial scanning overhead, although they serve an API-binding purpose rather than redundant implementation logic. Action granularity: Each field or method declaration occupies its own line, providing consistent granularity. Reading flow: Consistent indentation helps, but missing blank-line separators, very long signatures, and interleaved overload variants interrupt navigation. Grouping overloads together and separating functional sections would improve readability.
Run 2
Code Structure: Fields precede methods, but related overloads are scattered and the prototype and constructor interrupt the method list. Nesting: Completely flat apart from the class scope, making individual declarations easy to inspect. Clarity of intent: The class and method names clearly identify a canvas API binding, although abbreviated or overloaded parameter names and absent documentation obscure some signatures. Code length: Concise declarations suit a native binding, but numerous repetitive overloads and very long signatures make scanning tedious. Action granularity: Each line contains a single declaration, with no compound operations. Reading flow: Consistent indentation and an initially alphabetical method sequence help, but missing whitespace between sections and inconsistent overload grouping weaken navigation.
Run 3
1. Code Structure: Fields precede methods, but related overloads are scattered and lack functional grouping. 2. Nesting: Entirely flat declarations make the code easy to scan; there is no nested logic. 3. Clarity of intent: The class and method names clearly identify a canvas API binding, though abbreviated parameters and undocumented overload differences reduce clarity. 4. Code length: Individual declarations are concise, but numerous repetitive overloads and very long signatures make the class cumbersome to read. Some repetition is inherent to this binding style. 5. Action granularity: Each line contains one field, method, or constructor declaration, providing consistent granularity. 6. Reading flow: Consistent indentation helps, but missing blank lines, dispersed overload families, and interleaved image types interrupt natural navigation.