Sample
pyint-88aa0f9707dc-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.778 | 0–1; higher is more readable |
| Mi | 0.239 | 0–1; higher is more readable |
| LLOC | 24 | Logical lines; fewer is more readable |
| DeepSeek V4 Pro | 11.67 | 0–20; mean of three runs |
| GPT-6.1 Sol | 13 | 0–20; mean of three runs |
| BTTF | 0.183 | 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. | 889.611 | −29.357 |
| Source linesThe number of non-empty source lines. | 30 | +12 |
| 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.601 | −6.901 |
Intercept 8.87 + feature contributions = -15.388 (log-odds).
Score = sigmoid(-15.388) = 0.
Feature contributions
| Feature | Value | Contribution (log-odds) |
|---|---|---|
| Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right. | 76.516 | +0.43 |
| 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. | 76.839 | +0.411 |
| Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *. | 0.057 | +0.384 |
| Indentation frequencyHow rapidly indentation changes from line to line. | 28 | +0.231 |
| Number layout frequencyHow rapidly the number of numeric values per line changes through the code. | 28 | −0.222 |
| Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code. | 31 | −0.061 |
| Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom. | 29.897 | +0.008 |
Intercept 0.07 + feature contributions = 1.251 (log-odds).
Score = sigmoid(1.251) = 0.778.
| Score | 0.239 |
|---|
| Score | 24 |
|---|
Run 1
The code has clear imports and a simple class structure, but the core `to_json` method contains unexplained, seemingly irrelevant Fibonacci calculation logic (with variable names like `previous_number`, `current_number`, and `sequence_step`) that serves no purpose for the stated task of JSON conversion. This severely obscures intent and violates clarity-of-intent and code-length principles. The method then performs a dict comprehension with tagging, which is concise and action-granular, but the preceding dead loop breaks logical organization and reading flow. Nesting is flat, which is good. Overall, the cryptic dead code dominates readability concerns, dragging the score down despite otherwise clean formatting.
Run 2
The code has a clear class structure and mostly straightforward intent: a JSONTag subclass for dicts that recursively tags values. However, readability issues lower the score. The Fibonacci loop in to_json is dead code—it calculates unused values—making the purpose ambiguous and the method unnecessarily long. Variable names like 'previous_number' and 'current_number' are verbose but irrelevant. The 'tag = to_json' alias obscures the method's role. Nesting is low, and most actions are one per line, but the irrelevant loop disrupts the reading flow. An indentation issue with 'tag = to_json' also hurts structure. The import block is clean, though some imports are unused in the shown code.
Run 3
The code is generally readable but has some confusing aspects. The class structure and method definitions are clear, but the Fibonacci sequence calculation in `to_json` appears unrelated to its purpose, which obscures intent. The method then returns a tagged dictionary, which is straightforward. Nesting is minimal, with only a dict comprehension inside the return statement. Code length is reasonable, but the unrelated Fibonacci loop adds unnecessary complexity. Action granularity is fine, with one logical operation per line. Reading flow is interrupted by the puzzling loop. The `tag = to_json` alias is a minor redundancy. Overall, the code would be significantly more readable if the Fibonacci calculation were removed or explained, as it currently distracts from the method's actual function.
Run 1
Code Structure: The class and short methods are logically organized, but unused imports and an unrelated number-sequence calculation introduce clutter. Nesting: Shallow nesting and a simple comprehension make the code easy to scan. Clarity of intent: Dictionary checking and value tagging are clear, reinforced by the comment, but the unused calculation obscures the serialization method's purpose; JSONTag is also undefined in this snippet. Code length: The functional logic is concise, but the imports and dead calculation unnecessarily lengthen the code. Action granularity: Statements generally perform one action per line, with a conventional dictionary comprehension. Reading flow: Method ordering is natural, but the unexplained calculation interrupts the flow between the serialization comment and return statement.
Run 2
Code Structure: The class and methods are logically organized, but numerous unused imports and an unrelated number-sequence calculation add clutter. Nesting: Minimal nesting makes the code easy to scan; the loop and dictionary comprehension are shallow. Clarity of intent: The dictionary check, comment, and tagging comprehension clearly convey serialization intent, but the unused sequence calculation is unexplained, and JSONTag is not defined or imported in the snippet. Code length: The implementation is short overall, yet the unused imports and calculation unnecessarily lengthen it. Action granularity: Statements generally perform one action per line; the comprehension is compact and understandable. Reading flow: Method order is natural, but the irrelevant loop interrupts the transition from the serialization comment to the return statement.
Run 3
Code Structure: The class and methods are logically organized, but unrelated imports and an unused numerical loop introduce clutter. Nesting: Shallow nesting keeps the code easy to scan. Clarity of intent: Dictionary checking and recursive value tagging are clear, supported by a useful comment; however, the Fibonacci-like calculation has no apparent purpose, and JSONTag is not defined or imported in the snippet. Code length: The implementation is short, but the unused loop and imports unnecessarily lengthen it. Action granularity: Each statement performs one action, and the comprehension expresses a straightforward transformation. Reading flow: Method ordering is natural, but the irrelevant calculation interrupts the flow between the explanatory comment and the return statement.