Sample
pyint-5aa9a9be5a4d-I11
Split eligible integer literals into pairs of short-named intermediate variables
Scores
| Method | Score | Scale |
|---|---|---|
| Posnett | 0.569 | 0–1; higher is more readable |
| Dorn | 0.901 | 0–1; higher is more readable |
| Mi | 0.699 | 0–1; higher is more readable |
| LLOC | 10 | Logical lines; fewer is more readable |
| DeepSeek V4 Pro | 18 | 0–20; mean of three runs |
| GPT-6.1 Sol | 17.33 | 0–20; mean of three runs |
| BTTF | 0.811 | 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. | 218.725 | −7.218 |
| 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.384 | −6.576 |
| Source linesThe number of non-empty source lines. | 13 | +5.2 |
Intercept 8.87 + feature contributions = 0.277 (log-odds).
Score = sigmoid(0.277) = 0.569.
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. | 33.429 | +2.249 |
| 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. | 14 | +0.541 |
| 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. | 13 | −0.287 |
| Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *. | 0.068 | +0.278 |
| Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom. | 12.686 | −0.233 |
Intercept 0.07 + feature contributions = 2.212 (log-odds).
Score = sigmoid(2.212) = 0.901.
| Score | 0.699 |
|---|
| Score | 10 |
|---|
Run 1
The code is very readable with clear structure and intent. It uses modern Python features (from __future__ import annotations, attrs library) and defines a simple class with a single attribute. Each import is on a separate line, the class definition is clean, and the __init__ method clearly assigns the attribute. One minor point: the explicit __init__ method is redundant if auto_detect=True is used, which could be slightly confusing. However, overall the code is concise, flat, and easy to follow.
Run 2
The code is highly readable due to its clear structure, minimal nesting, and concise length. It imports only necessary modules, defines a single attrs-decorated class with straightforward intent, and uses one action per line. The reading flow is natural, with type hints and future annotations improving clarity. A minor redundancy exists: auto_detect=True with an explicit __init__ could be simplified, and unused imports (copy, re, sys, Any) slightly detract from cleanliness, preventing a perfect score.
Run 3
The code is short, clear, and logically organized. The imports are grouped properly, and the class uses modern Python typing syntax with the attrs library. The structure is flat and easy to understand. The only minor issue is the __init__ method, which is somewhat redundant since attrs.define already generates an initializer. This redundancy slightly reduces clarity of intent and adds unnecessary length, but overall the code remains very readable with a natural flow and one action per line.
Run 1
Code Structure: Imports and the class are logically organized, although several imports are unused. Nesting: Minimal nesting makes the code easy to scan. Clarity of intent: The class clearly stores an integer, but the generic names AutoDetect and x provide little domain context; the decorator's relationship to the explicit initializer may require familiarity with attrs. Code length: Very concise, though unused imports and the explicit initializer add avoidable clutter for a simple attrs class. Action granularity: Each statement performs one action. Reading flow: Natural top-to-bottom flow, with minor formatting issues such as insufficient spacing before the top-level class and no separation between standard-library and third-party imports.
Run 2
Code Structure: Imports and the class are logically organized, though unused imports add clutter and import groups could be separated. Nesting: Minimal, with only a class and its initializer. Clarity of intent: The decorator, typed field, and explicit initializer clearly describe a simple attrs class, although the name AutoDetect is generic and the reason for a custom initializer is not explained. Code length: Very concise, but unused imports are unnecessary. Action granularity: Each statement performs one action. Reading flow: Straightforward from imports to class declaration to initialization; an additional blank line before the top-level class would improve formatting.
Run 3
Code Structure: Imports and the class are logically organized, though unused imports add clutter. Nesting: Minimal nesting makes the code easy to scan. Clarity of intent: The class clearly stores an integer, but generic names such as AutoDetect and x provide little domain context, and the purpose of auto_detect is not explained. Code length: Very concise, although attrs could generate the initializer, making the explicit constructor potentially redundant. Action granularity: Each statement performs one action. Reading flow: Straightforward top-to-bottom flow; an additional blank line before the top-level class and separation of third-party imports would improve formatting.