Sample
pyint-403d4e0be826-I08
Select one of ten high-readability unrelated code templates per class
Scores
| Method | Score | Scale |
|---|---|---|
| Posnett | 0.001 | 0–1; higher is more readable |
| Dorn | 0.859 | 0–1; higher is more readable |
| Mi | 0.381 | 0–1; higher is more readable |
| LLOC | 18 | Logical lines; fewer is more readable |
| DeepSeek V4 Pro | 7.67 | 0–20; mean of three runs |
| GPT-6.1 Sol | 13.33 | 0–20; mean of three runs |
| BTTF | 0.527 | 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. | 654.687 | −21.605 |
| Source linesThe number of non-empty source lines. | 32 | +12.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.643 | −6.964 |
Intercept 8.87 + feature contributions = -6.899 (log-odds).
Score = sigmoid(-6.899) = 0.001.
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. | 71.97 | +0.617 |
| Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *. | 0.038 | +0.575 |
| Number layout frequencyHow rapidly the number of numeric values per line changes through the code. | 1 | +0.398 |
| Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right. | 63.242 | +0.216 |
| Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code. | 32 | −0.097 |
| Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom. | 31.849 | +0.035 |
| Indentation frequencyHow rapidly indentation changes from line to line. | 21 | −0.011 |
Intercept 0.07 + feature contributions = 1.804 (log-odds).
Score = sigmoid(1.804) = 0.859.
| Score | 0.381 |
|---|
| Score | 18 |
|---|
Run 1
The code has clear docstrings and logical class inheritance, but contains irrelevant temperature variables inside __init__ that introduce ambiguity and unnecessary code. These variables serve no purpose in constructing the error, violating clarity of intent and code length. Structure is mostly organized, but the pointless block disrupts reading flow and suggests leftover debug code. Nesting is minimal and action granularity is mostly one action per line, but the irrelevant lines lower overall readability.
Run 2
The code has clear structure with logical imports and well-documented methods, but introduces confusing unrelated logic (temperature variables) inside __init__ that breaks clarity of intent. Nesting is minimal and action granularity is mostly appropriate, though the temperature block adds disorganized, dead code that interrupts reading flow. The __reduce__ method is concise and well-explained, but __init__ mixes setup logic with irrelevant variable assignments, making it unnecessarily long and ambiguous. Overall readability is moderate but undermined by the temperature code.
Run 3
The code is highly unreadable. The most glaring issue is dead, irrelevant code in the __init__ method that defines temperature variables and performs an if-comparison, none of which relates to JSON error handling. This violates clarity of intent and makes the code confusing. The class hierarchy is tangled and unclear: it inherits from InvalidJSONError and CompatJSONDecodeError, but the __init__ calls both parent constructors in an order that is not self-evident. Docstrings are lengthy and explanatory but do not fix the logic. Nesting is not the main issue, but action granularity and structure are poor due to the irrelevant temperature logic and opaque multiple inheritance. The __reduce__ method is somewhat clear, but the surrounding problems dominate. Overall, the code lacks a coherent purpose, includes pointless logic, and fails to present a clear, maintainable strategy for error construction.
Run 1
Code Structure: The class and methods are logically organized, but unrelated temperature calculations interrupt exception initialization. Nesting: Only one shallow conditional, so nesting is easy to follow. Clarity of intent: Method names, type hints, and docstrings explain initialization and pickling behavior, but the unused temperature logic is confusing, and InvalidJSONError is not defined or imported in the snippet. Code length: Generally concise, though the irrelevant calculations and unused imports add clutter. Action granularity: Each statement performs one action, with explicit superclass initialization calls. Reading flow: Imports, class definition, initialization, and pickling follow a natural order, but the temperature block breaks the flow between the constructor explanation and its actual work.
Run 2
Code Structure: The exception class is logically divided into initialization and serialization methods, but unrelated temperature calculations disrupt cohesion. Nesting: Only one shallow conditional keeps the code easy to scan. Clarity of intent: Type annotations and docstrings explain the multiple-inheritance behavior well, but unused temperature variables obscure initialization intent, and InvalidJSONError is not defined or imported in the snippet. Code length: The implementation is short, though unnecessary calculations and somewhat verbose docstrings add clutter. Action granularity: Each statement performs one action, making individual operations clear. Reading flow: Imports, class declaration, and methods follow a natural order, but unused imports and the abrupt temperature block interrupt the otherwise straightforward flow.
Run 3
Code Structure: The class and methods are logically organized, but unrelated temperature calculations interrupt exception initialization. Nesting: Only one shallow conditional keeps the code easy to scan. Clarity of intent: Docstrings explain the multiple-inheritance initialization and pickling behavior, but unused temperature variables obscure the constructor's purpose, and InvalidJSONError is not defined or imported in the snippet. Code length: The implementation is short, though the temperature block and unused imports add unnecessary content. Action granularity: Each line performs a single action, making individual statements straightforward. Reading flow: Method order and explicit parent calls are natural, but the irrelevant constructor block disrupts the progression from documentation to initialization.