Sample
pyint-804c228cd491-I08
Select one of ten high-readability unrelated code templates per class
Scores
| Method | Score | Scale |
|---|---|---|
| Posnett | 0 | 0–1; higher is more readable |
| Dorn | 0.522 | 0–1; higher is more readable |
| Mi | 0.224 | 0–1; higher is more readable |
| LLOC | 43 | Logical lines; fewer is more readable |
| DeepSeek V4 Pro | 15 | 0–20; mean of three runs |
| GPT-6.1 Sol | 16 | 0–20; mean of three runs |
| BTTF | 0.519 | 0–1; higher is more readable |
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. | 1953.574 | −64.468 |
| Source linesThe number of non-empty source lines. | 108 | +43.2 |
| 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.591 | −6.887 |
Intercept 8.87 + feature contributions = -19.285 (log-odds).
Score = sigmoid(-19.285) = 0.
Feature contributions
| Feature | Value | Contribution (log-odds) |
|---|---|---|
| Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code. | 109 | −2.823 |
| Indentation frequencyHow rapidly indentation changes from line to line. | 58 | +1.269 |
| Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom. | 107.825 | +1.097 |
| Number layout frequencyHow rapidly the number of numeric values per line changes through the code. | 58 | −0.91 |
| Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *. | 0.034 | +0.616 |
| Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right. | 77.56 | +0.447 |
| 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. | 78.936 | +0.322 |
Intercept 0.07 + feature contributions = 0.088 (log-odds).
Score = sigmoid(0.088) = 0.522.
| Score | 0.224 |
|---|
| Score | 43 |
|---|
Run 1
The code is generally well-structured with clear docstrings and type hints, but some issues reduce readability. The class attributes are documented but interleaved with unrelated logic. The 'response' method contains a dead-code block comparing 'first_score' and 'second_score', which is confusing and unrelated to JSON serialization. Nesting in conditional expressions is moderate. The addition of these unused variables breaks the 'one action per line' principle and obscures intent. The rest of the methods are concise and readable, but the overall flow is disrupted by this extraneous logic. The code would score higher if the dead code were removed and the logic were more straightforward.
Run 2
The code is generally readable but has a significant unrelated block. Class structure is logical with clear class-level documentation and docstrings, and methods are concise with one action per line (e.g., setdefault calls). However, the `response` method contains extraneous scoring logic (`first_score`, `second_score`, `higher_score`) that is completely unrelated to JSON serialization, breaking intent and reading flow. This block adds confusing nesting and distracts from the method's actual purpose. While the rest of the method is clear—using flat conditionals and descriptive variable names—the unexpected code undermines clarity. Attributes are well-documented and defaults are understandable. Overall, readability is moderate.
Run 3
The code is mostly clean and well-documented. The class has a logical structure, clear attributes with docstrings, and methods that each do one clear thing. Nesting is minimal, and the reading flow is generally natural. However, a block of unrelated score-comparison code at the start of the `response` method is confusing and breaks the clarity of intent. The method’s docstring does not mention it, and its purpose is unclear. Additionally, while the `dumps`/`loads` methods are concise, the overall file length is extended by verbose docstrings, though these improve clarity. Action granularity is good; most lines perform one operation. Removing the stray score logic and perhaps adding a note about it (if necessary) would improve readability.
Run 1
Code Structure: Methods and configuration attributes are logically organized, but the unrelated score-comparison block disrupts response generation. Nesting: Shallow conditionals keep the code easy to follow. Clarity of intent: Descriptive names, type annotations, and thorough docstrings clearly explain JSON operations; unused higher_score and externally defined dependencies reduce standalone clarity. Code length: Implementations are concise, although extensive documentation and irrelevant score calculations add length. Action granularity: Each line generally performs one clear action. Reading flow: Serialization, deserialization, and response construction follow a natural sequence, but the arbitrary score comparison interrupts that flow, and several imports appear unused in this snippet.
Run 2
Code Structure: The class cleanly separates configuration, serialization, deserialization, and response generation, but unrelated score-comparison code disrupts response(). Nesting: Shallow conditionals keep the code easy to follow. Clarity of intent: Descriptive method names, type annotations, and thorough docstrings explain most behavior; undefined external names and the unused higher_score variable reduce clarity within this snippet. Code length: Implementation is concise overall, although documentation is extensive and the score-comparison block is unnecessary. Action granularity: Statements generally perform one action per line, with readable multiline formatting for the final response construction. Reading flow: Configuration followed by focused methods provides a natural progression, but unused imports and the irrelevant comparison interrupt an otherwise coherent flow.
Run 3
Code Structure: The class separates configuration, serialization, deserialization, and response creation logically, but response contains an unrelated, unused score-comparison block. Nesting: Shallow conditionals and short methods keep complexity low. Clarity of intent: Descriptive names, type annotations, and detailed docstrings clearly explain JSON behavior; undefined external references such as JSONProvider and _default reduce standalone clarity. Code length: Implementation is concise overall, although extensive documentation increases length and the score block is unnecessary. Action granularity: Statements generally perform one action per line, making execution easy to follow. Reading flow: Configuration followed by focused methods creates a natural progression, but the arbitrary score calculation interrupts the response logic, and several imports appear unused in this excerpt.