Sample
pyint-756292089cf6-I11
Split eligible integer literals into pairs of short-named intermediate variables
Scores
| Method | Score | Scale |
|---|---|---|
| Posnett | 0.277 | 0–1; higher is more readable |
| Dorn | 0.853 | 0–1; higher is more readable |
| Mi | 0.751 | 0–1; higher is more readable |
| LLOC | 9 | Logical lines; fewer is more readable |
| DeepSeek V4 Pro | 16 | 0–20; mean of three runs |
| GPT-6.1 Sol | 17.33 | 0–20; mean of three runs |
| BTTF | 0.782 | 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. | 242.899 | −8.016 |
| 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.411 | −6.616 |
| Source linesThe number of non-empty source lines. | 12 | +4.8 |
Intercept 8.87 + feature contributions = -0.961 (log-odds).
Score = sigmoid(-0.961) = 0.277.
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.846 | +1.935 |
| 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.786 | −0.245 |
| Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *. | 0.082 | +0.148 |
Intercept 0.07 + feature contributions = 1.755 (log-odds).
Score = sigmoid(1.755) = 0.853.
| Score | 0.751 |
|---|
| Score | 9 |
|---|
Run 1
The code is highly readable due to its simplicity and clean structure. It demonstrates a clear, focused purpose: defining a single attrs class with an explicit initializer. The structure is logical, with imports grouped, followed by the class definition. Nesting is minimal, with only a single method inside the class. Intent is unambiguous; the class name and attribute type hint make the purpose clear. Code length is concise, with no unnecessary logic. Each action (import statements, decorator, attribute, method, assignment) is on its own line, improving granularity. The reading flow is natural, from imports to class to method. Minor deductions are for the redundant `@attr.s(auto_detect=True)` decorator when a manual `__init__` is provided, which could confuse intent slightly, and the import of `re`, `Any`, `Dict`, `List`, `Tuple`, and `attrs` are unused. These unused imports slightly reduce clarity but do not significantly impact readability.
Run 2
The code is clean, concise, and well-structured. It imports only what is needed, uses type hints consistently, and defines a simple, single-purpose class. The class has one action per line, minimal nesting, and a clear intent. The only minor issue is the redundant explicit __init__ method, since @attr.s(auto_detect=True) already generates an initializer, making the manual constructor unnecessary and slightly reducing clarity. Overall, it is highly readable.
Run 3
The code is fairly readable due to its short length and clear imports. However, it has several issues: the class 'AutoDetect' uses both the deprecated attr.s decorator with auto_detect=True and a manual __init__, which is redundant and confusing. The typing imports (Any, Dict, List, Tuple) are unused, adding clutter. Naming is reasonable but not descriptive of the class's purpose. Structure is flat and simple, but the redundancy and unused imports reduce clarity. Overall, it's understandable but could be cleaner.
Run 1
Code Structure: Imports and a single class are logically organized, though unused imports add clutter. Nesting: Minimal nesting makes the code easy to follow. Clarity of intent: The typed attribute and explicit initializer clearly show how the class stores x, although the generic class name and decorator's auto-detection behavior provide limited context. Code length: Very concise, with some unnecessary imports. Action granularity: Each line performs one distinct action. Reading flow: Natural top-to-bottom progression from imports to class definition and initialization; additional spacing before the decorated class would improve formatting.
Run 2
Code Structure: Imports and a single class are logically organized, though several imports are unused and importing both attr and attrs is distracting. Nesting: Minimal, with only a class and its initializer. Clarity of intent: The typed x attribute and straightforward initialization are clear, but the generic class name and unexplained auto_detect setting provide limited context. Code length: Very concise, aside from unused imports. Action granularity: Each statement performs one action. Reading flow: Natural top-to-bottom flow, although a blank line between the imports and class decorator would improve visual separation.
Run 3
Code Structure: Imports and the class are logically organized, though several imports are unused and importing both attr and attrs adds clutter. Nesting: Minimal nesting makes the code easy to follow. Clarity of intent: The typed field and explicit constructor clearly show how x is initialized, but the generic class name and unexplained auto_detect setting obscure the broader purpose. Code length: Very concise, although unused imports are unnecessary. Action granularity: Each line performs a single action. Reading flow: Natural top-to-bottom flow, with minor formatting improvements possible through grouping imports and adding another blank line before the class.