Sample
pyint-1fcdfca830a4-I05
Rewrite eligible decimal integer literals in hexadecimal notation
Scores
| Method | Score | Scale |
|---|---|---|
| Posnett | 0 | 0–1; higher is more readable |
| Dorn | 0.775 | 0–1; higher is more readable |
| Mi | 0.377 | 0–1; higher is more readable |
| LLOC | 18 | Logical lines; fewer is more readable |
| DeepSeek V4 Pro | 15.67 | 0–20; mean of three runs |
| GPT-6.1 Sol | 18 | 0–20; mean of three runs |
| BTTF | 0.449 | 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. | 712.555 | −23.514 |
| Source linesThe number of non-empty source lines. | 24 | +9.6 |
| 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.726 | −7.088 |
Intercept 8.87 + feature contributions = -12.133 (log-odds).
Score = sigmoid(-12.133) = 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.48 | +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.92 | +0.407 |
| Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *. | 0.064 | +0.319 |
| Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code. | 25 | +0.151 |
| Number layout frequencyHow rapidly the number of numeric values per line changes through the code. | 22 | −0.084 |
| Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom. | 23.795 | −0.077 |
| Indentation frequencyHow rapidly indentation changes from line to line. | 22 | +0.024 |
Intercept 0.07 + feature contributions = 1.239 (log-odds).
Score = sigmoid(1.239) = 0.775.
| Score | 0.377 |
|---|
| Score | 18 |
|---|
Run 1
The code is highly readable. It has clear imports, a single class with two small methods, and flat logic. The purpose is explicit: detect dictionaries and serialize them with tagged values. The comment clarifies a design decision about key handling. Variable names are concise and appropriate. Each method performs one logical action per line. The overall flow is natural and easy to follow.
Run 2
The code shows reasonable organization and intent clarity. Import statements are neatly separated, and the class structure is straightforward. The `to_json` method handles dict serialization with a clear dict comprehension. UTF-8 encoding for the JSON key is handled inline reasonably. However, there are readability concerns: `__slots__ = ()` is unusual, and the `check` method uses a `pass` statement followed by actual logic, which is confusing. The method `to_json` and the alias `tag = to_json` add unnecessary complexity, and the comment is slightly misleading since it mentions 'tagging the key' but the code appears to simply serialize values recursively. Action granularity is generally acceptable but could be improved by splitting the comprehension into clearer intermediate steps. The reading flow is slightly disorganized due to the `pass` stub and redundant method alias.
Run 3
The code is clean and highly readable. It has a flat structure with minimal nesting. Each method has a single, clear responsibility: check, to_json, and a tag alias. Naming is explicit and follows common conventions. Type hints improve clarity. The logic is concise without unnecessary verbosity. The only minor issues are the redundant `tag = to_json` assignment, which could confuse intent at a glance, and the comment about string keys assumes prior knowledge of JSON semantics, but it still adds useful context. Overall, the code reads naturally from top to bottom and is easy to follow.
Run 1
Code Structure: A compact class groups related dictionary-checking and serialization behavior logically, though several imports are unused in the excerpt. Nesting: Minimal nesting, with a straightforward dictionary comprehension. Clarity of intent: Method names, type hints, and the explanatory comment make the purpose clear; however, JSONTag is not defined or imported in the excerpt, and the tag alias requires some contextual knowledge. Code length: The implementation is concise without excessive compression, but the import block adds irrelevant length here. Action granularity: Statements generally perform one action per line; the comprehension expresses a single cohesive transformation. Reading flow: Methods follow a natural progression from checking eligibility to converting values, although missing context for the superclass and serializer slightly interrupts understanding.
Run 2
Code Structure: The class is logically organized into a type check and serialization method, although several unused imports and the undefined JSONTag base class add distracting context. Nesting: Minimal nesting; the dictionary comprehension is straightforward. Clarity of intent: Method names, type annotations, and the comment clearly communicate dictionary handling, though the tag alias requires some inference. Code length: The implementation is concise, but the unused imports unnecessarily lengthen the snippet. Action granularity: Each statement performs a clear action; the comprehension combines iteration and tagging idiomatically. Reading flow: Imports lead naturally into the class and its methods, with consistent formatting and no tangled control flow.
Run 3
Code Structure: The class is logically organized into type checking and serialization methods, though numerous unused imports clutter the snippet. Nesting: Minimal nesting and a straightforward dictionary comprehension make the code easy to follow. Clarity of intent: Method names and the comment clearly convey dictionary handling, but the external JSONTag base class and serializer behavior require context; broad Any annotations provide little additional guidance. Code length: The implementation is concise without unnecessary logic. Action granularity: Each statement performs a focused action, and the comprehension expresses one cohesive transformation. Reading flow: The progression from checking the value to serializing it is natural, although the tag alias may require familiarity with the surrounding framework.