Sample
pyint-04c5d06d6374-I02
Shorten method, parameter, and local names without collisions
Scores
| Method | Score | Scale |
|---|---|---|
| Posnett | 0.251 | 0–1; higher is more readable |
| Dorn | 0.855 | 0–1; higher is more readable |
| Mi | 0.747 | 0–1; higher is more readable |
| LLOC | 9 | Logical lines; fewer is more readable |
| DeepSeek V4 Pro | 13 | 0–20; mean of three runs |
| GPT-6.1 Sol | 17 | 0–20; mean of three runs |
| BTTF | 0.79 | 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. | 245.345 | −8.096 |
| 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.445 | −6.667 |
| Source linesThe number of non-empty source lines. | 12 | +4.8 |
Intercept 8.87 + feature contributions = -1.094 (log-odds).
Score = sigmoid(-1.094) = 0.251.
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. | 40.462 | +1.951 |
| Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right. | 0 | −0.804 |
| Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code. | 13 | +0.576 |
| Number layout frequencyHow rapidly the number of numeric values per line changes through the code. | 1 | +0.398 |
| Indentation frequencyHow rapidly indentation changes from line to line. | 12 | −0.322 |
| Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom. | 11.69 | −0.246 |
| Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *. | 0.081 | +0.155 |
Intercept 0.07 + feature contributions = 1.778 (log-odds).
Score = sigmoid(1.778) = 0.855.
| Score | 0.747 |
|---|
| Score | 9 |
|---|
Run 1
The code is fairly readable due to its short length and simple structure. It has minimal nesting and clear, simple actions. The imports are organized but include unused modules (`re`, `typing`, `attrs`), which can confuse readers. The class uses both `attr.s` and `__init__`, creating ambiguity about intent—the custom `__init__` overrides the decorator’s potential automated initialization, making the code’s purpose unclear. The parameter name `x2` adds minor confusion. Overall, the code is concise and has a natural reading flow, but unused imports and conflicting decorator/init patterns reduce clarity.
Run 2
The code is concise and uses clear imports, but several issues reduce readability. The class mixes `attr.s` and a custom `__init__`, which conflicts with the decorator’s purpose and creates ambiguity. The parameter `x2` is unclear; a more descriptive name or consistent positional naming would improve clarity. The `List`, `Dict`, `Tuple`, `Any`, and `re` imports are unused, adding noise. The structure is flat and logically organized, but the intent of `AutoDetect` is not obvious. The custom `__init__` may override `attr.s` behavior, causing confusion. Overall, it is readable but could be much clearer by removing unused imports and simplifying the class definition.
Run 3
The code is concise and readable, but it has a critical contradiction: using both `attr.s(auto_detect=True)` and a manual `__init__` prevents auto-detection from working as intended. This creates ambiguity in intent. The imports are ordered but include both `attr` and `attrs`, which is redundant. Class structure is clear, though the duplicate import and conflict slightly reduce clarity. Nesting is nonexistent, and each action is simple. Overall, the code is easy to read but reflects a misunderstanding that hurts maintainability.
Run 1
Code Structure: The imports and single class are logically organized, though spacing between import groups and the class could improve. Nesting: Minimal nesting makes the code easy to follow. Clarity of intent: The annotated attribute and constructor clearly show initialization, but AutoDetect and x2 are generic names, and the decorator's behavior requires familiarity with attr. Code length: The implementation is concise, although annotations, re, typing names, and attrs are unused here. Action granularity: Each statement performs one action. Reading flow: Reading proceeds naturally from imports to the class and constructor, with unused imports adding minor distraction.
Run 2
Code Structure: Imports and a single class are logically organized, though several imports are unused and importing both attr and attrs adds clutter. Nesting: Minimal, with only a class and its initializer. Clarity of intent: The annotated field and assignment are straightforward, but AutoDetect and x2 are vague names, and the decorator's interaction with the explicit initializer requires familiarity with attr. Code length: Very concise, although unused imports unnecessarily lengthen it. Action granularity: Each statement performs one action. Reading flow: Natural top-to-bottom progression; an additional blank line before the class would improve conventional formatting.
Run 3
Code Structure: The imports and single class are logically organized, although several unused imports add clutter. Nesting: Minimal nesting makes the code easy to scan. Clarity of intent: The annotated field and initializer clearly assign an integer value, but generic names such as AutoDetect, x, and x2 provide little domain context, and the decorator's behavior requires familiarity with attrs. Code length: Very concise, though unused imports could be removed. Action granularity: Each statement performs a single action. Reading flow: Natural top-to-bottom flow, with minor formatting improvements possible through import grouping and additional spacing before the class.