Sample
pyint-1c00ffbdb396-I02
Shorten method, parameter, and local names without collisions
Scores
| Method | Score | Scale |
|---|---|---|
| Posnett | 0.536 | 0–1; higher is more readable |
| Dorn | 0.902 | 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.816 | 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. | 221.138 | −7.298 |
| 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.419 | −6.628 |
| Source linesThe number of non-empty source lines. | 13 | +5.2 |
Intercept 8.87 + feature contributions = 0.145 (log-odds).
Score = sigmoid(0.145) = 0.536.
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.357 | +2.252 |
| 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.285 |
| 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.221 (log-odds).
Score = sigmoid(2.221) = 0.902.
| Score | 0.699 |
|---|
| Score | 10 |
|---|
Run 1
The code is highly readable. It has clear imports, a single class with a logical structure, and flat nesting. The intent is evident: define an attrs class with custom init logic. The length is concise, and each action (importing, defining class, defining init, assignment) is on its own line. The use of attrs and `__future__` annotations shows modern practice. Minor deduction for slight duplication in naming (`x` vs `x2`) which could be slightly clearer, but overall the flow is natural and straightforward.
Run 2
The code is highly readable. It has a clear, logical structure: imports are grouped, a single dataclass-like class is defined, and the constructor is simple. Nesting is minimal (one class, one method). Intent is clear: define a class with an integer attribute and a custom initializer. Length is concise. Action granularity is one action per line. Reading flow is natural. Minor deductions: the unusual combination of attrs auto-detection with an explicit __init__ and a renamed parameter (x2) slightly reduces clarity, and the unused imports/copy/re/sys/Any could be removed for even higher readability.
Run 3
The code is highly readable: it has a clear import section, a single well-defined class with minimal nesting, and an explicit `__init__` method that directly assigns a parameter to an attribute. The use of `attrs.define` with `auto_detect=True` is slightly ambiguous because the class manually defines `__init__`, which may conflict with attrs' auto-detection, but the intent is still understandable. The code is concise, with one action per line and a natural reading flow from imports to class definition to method body. The only minor issues are the somewhat redundant `auto_detect=True` and the parameter/attribute name mismatch (`x2` vs `x`), which slightly reduce clarity of intent but do not significantly harm readability.
Run 1
Code Structure: Imports and the class are logically organized, though several unused imports add clutter. Nesting: Shallow nesting makes the code easy to scan. Clarity of intent: Type annotations and the simple assignment are clear, but names such as AutoDetect, x, and x2 provide little domain context, and the interaction between attrs auto-detection and the custom initializer requires library knowledge. Code length: The implementation is concise, although unnecessary imports lengthen it. Action granularity: Each line performs a single action. Reading flow: The progression from imports to decorator, class, and initializer is natural; additional spacing between import groups and the class would improve visual separation.
Run 2
Code Structure: The class and initializer are logically organized, though unused imports add clutter and import grouping could improve. Nesting: Minimal nesting makes the code easy to follow. Clarity of intent: The typed attribute and assignment are clear, but AutoDetect, x, and x2 are generic names, and the purpose of auto_detect=True requires familiarity with attrs. Code length: The implementation is concise, although several imports are unnecessary for the shown code. Action granularity: Each line performs a single action. Reading flow: The progression from imports to class definition to initialization is natural; an additional blank line before the top-level class would improve formatting.
Run 3
Code Structure: Imports and a single class are logically organized, although several imports are unused. Nesting: Minimal nesting makes the code easy to follow. Clarity of intent: The typed attribute and simple initializer are clear, but the generic class name, parameter name x2, and attrs auto-detection behavior provide limited context. Code length: Very concise, with unnecessary imports adding minor clutter. Action granularity: Each line performs one action. Reading flow: Natural top-to-bottom progression, though additional spacing between imports and the class would improve visual separation.