Sample
MBJP/18
Human rating uses the original dataset scale.
Scores
| Method | Score | Scale | Dataset rank (0–100) |
|---|---|---|---|
| Posnett | 0 | 0–1; higher is more readable | 31.2Δ 40.6 |
| Scalabrino | 0.742 | 0–1; higher is more readable | 50.0Δ 21.9 |
| Dorn | 0.504 | 0–1; higher is more readable | 25.0Δ 46.9 |
| Mi | 0.617 | 0–1; higher is more readable | 43.8Δ 28.1 |
| LLOC | 14 | Logical lines; fewer is more readable | 28.1Δ 43.8 |
| DeepSeek V4 Pro | 14 | 0–20; mean of three runs | 43.8Δ 28.1 |
| GPT-6.1 Sol | 16 | 0–20; mean of three runs | 37.5Δ 34.4 |
| BTTF | 0.591 | 0–1; higher is more readable | 68.8Δ 3.1 |
| Human | 4.5 | 1–5; original rating | 71.9 |
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. | 815.405 | −26.908 |
| Source linesThe number of non-empty source lines. | 35 | +14 |
| 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.246 | −6.368 |
Intercept 8.87 + feature contributions = -10.407 (log-odds).
Score = sigmoid(-10.407) = 0.
| Score | 0.742 |
|---|
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. | 108 | −0.909 |
| Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right. | 105.086 | +0.891 |
| Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code. | 35 | −0.203 |
| Number layout frequencyHow rapidly the number of numeric values per line changes through the code. | 26 | −0.176 |
| Indentation frequencyHow rapidly indentation changes from line to line. | 26 | +0.162 |
| Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *. | 0.085 | +0.118 |
| Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom. | 33.862 | +0.063 |
Intercept 0.07 + feature contributions = 0.017 (log-odds).
Score = sigmoid(0.017) = 0.504.
| Score | 0.617 |
|---|
| Score | 14 |
|---|
Run 1
The code is generally readable but has several weaknesses. The structure is logical with a single method and a clear purpose. However, nesting is moderate with an if statement inside a while loop inside a for loop, making the logic somewhat harder to follow. Clarity of intent is decent—the method name and variable names are reasonable, but the use of a flag variable and manual while loop for character matching is less clear than using built-in methods like indexOf or contains. The code length is acceptable but could be shortened significantly. Action granularity is mostly one action per line, which helps. Reading flow is natural but disrupted by the nested loops. The algorithm could be simplified by using a HashSet for constant-time lookups or String.indexOf to avoid manual character comparison, which would improve both readability and performance.
Run 2
The code is reasonably readable: it has clear method naming, a logical structure, and moderate nesting. However, it could be improved by using a Set for characters to avoid the nested while loop, reducing complexity. The flag and k variables add unnecessary verbosity. Variable names like 'string' and 'secondString' are clear but not ideal. The intent is understandable, but the implementation is longer than needed. Overall, it is concise enough but not optimized for clarity or efficiency.
Run 3
The code is generally readable due to clear variable names, simple logic, and a straightforward, flat structure. The method name and parameter names communicate intent well. However, readability is reduced by the use of an unnecessary boolean flag and an inefficient while loop with manual index increment, which obscures the simple purpose of checking if a character exists in the second string. The action granularity is adequate but could be improved by using a for-each loop and a HashSet for clarity. Overall, the code is concise and logically organized, but minor improvements could make the intent clearer and reduce cognitive load.
Run 1
Code Structure: The method is logically organized into initialization, character checking, filtering, and return. Nesting: The outer loop, inner while loop, and conditional introduce moderate nesting, but remain easy to follow. Clarity of intent: The method name and documentation clearly explain the purpose; generic names such as flag, sb, and secondString are less expressive. Code length: The implementation is reasonably concise, although a membership check could replace the manual inner scan, and unused wildcard imports add clutter. Action granularity: Each statement performs one action, making individual steps easy to understand. Reading flow: Execution proceeds naturally from examining each character to appending allowed characters. Continuing the inner scan after finding a match adds unnecessary work and slightly obscures the decision point.
Run 2
Code Structure: The method is logically organized into initialization, character filtering, and result construction. Nesting: The outer loop, inner loop, and conditional create moderate nesting, but remain easy to follow. Clarity of intent: The method name and documentation clearly describe the purpose, though names such as flag, sb, and secondString could be more descriptive. Code length: The implementation is reasonably short, but the manual inner search and unused wildcard imports add unnecessary verbosity. Action granularity: Each statement performs a single action, with conventional loop syntax. Reading flow: Execution proceeds naturally from input traversal to membership checking and output assembly. Using a clearer membership check or breaking after a match would simplify the search and improve readability.
Run 3
Code Structure: The method is logically organized into initialization, character filtering, and result return. Nesting: The outer loop, inner while loop, and conditional create moderate nesting, but remain easy to follow. Clarity of intent: The method name and documentation clearly explain the purpose, although names such as flag, sb, and secondString could be more descriptive. Code length: The implementation is reasonably concise, but unnecessary wildcard imports and the explicit inner-loop counter add clutter. Action granularity: Each statement performs a single action, making individual steps easy to understand. Reading flow: Execution proceeds naturally from input traversal to membership checking and output construction. A clearer membership test or helper would reduce the mental effort required to follow the nested search.