Sample
pyint-a716b32f6e6a-I02
Shorten method, parameter, and local names without collisions
Scores
| Method | Score | Scale |
|---|---|---|
| Posnett | 0 | 0–1; higher is more readable |
| Dorn | 0.849 | 0–1; higher is more readable |
| Mi | 0.634 | 0–1; higher is more readable |
| LLOC | 20 | Logical lines; fewer is more readable |
| DeepSeek V4 Pro | 10 | 0–20; mean of three runs |
| GPT-6.1 Sol | 13 | 0–20; mean of three runs |
| BTTF | 0.735 | 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. | 679.461 | −22.422 |
| Source linesThe number of non-empty source lines. | 31 | +12.4 |
| 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.707 | −7.06 |
Intercept 8.87 + feature contributions = -8.213 (log-odds).
Score = sigmoid(-8.213) = 0.
Feature contributions
| Feature | Value | Contribution (log-odds) |
|---|---|---|
| Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *. | 0.042 | +0.532 |
| Number layout frequencyHow rapidly the number of numeric values per line changes through the code. | 1 | +0.398 |
| Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right. | 74.219 | +0.393 |
| 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. | 78.969 | +0.32 |
| Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code. | 32 | −0.097 |
| Indentation frequencyHow rapidly indentation changes from line to line. | 24 | +0.093 |
| Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom. | 30.775 | +0.02 |
Intercept 0.07 + feature contributions = 1.73 (log-odds).
Score = sigmoid(1.73) = 0.849.
| Score | 0.634 |
|---|
| Score | 20 |
|---|
Run 1
The code has some positive aspects: clear imports, a concise class definition, and a helpful docstring explaining the purpose. The __init__ method is clear with reasonable parameter naming ('hea' is slightly unclear though). However, there are notable issues: 'inf()' method name is ambiguous and doesn't convey its purpose (should likely be 'info()'), the 'get()' method is missing a return statement, making it appear to return None despite presumably intended to return header values. The parameter names 'hea' and 'nam' are unnecessarily abbreviated, reducing clarity. The overall structure is flat and straightforward, but the action granularity is broken by the missing return in get(). The reading flow is interrupted by the confused method naming and incomplete implementation, suggesting the code may be unfinished or poorly maintained.
Run 2
The code has some strengths like type hints, docstrings, and a clear class structure, but several issues hurt readability. The MockResponse class is short and conceptually simple, yet method names like 'inf' and 'hea' are confusingly abbreviated. The get() method calls getheaders() but doesn't return the result, which makes intent ambiguous and likely indicates a bug. The imports are overly broad, mixing stdlib, third-party, and local modules without clear grouping, and several imports appear unused. The class docstring uses informal language ('...what?'), which is unclear for documentation. These factors make the code harder to understand than necessary, resulting in a moderate readability score.
Run 3
The code has some redeeming qualities: it uses type hints, follows import ordering partially, and includes docstrings. However, readability is severely undermined by several competing factors. The class and method names are structurally unclear—MockResponse has a method inf() that seems to return headers, but the docstring says it mocks httplib.HTTPMessage, and there's no explanation of why inf exists. The get() method lacks a return statement, which would silently return None—likely a bug but certainly ambiguous intent. Some imported modules (calendar, copy, threading) and type names are unused, adding noise. Naming inconsistencies like hea and nam instead of headers and name obscure meaning. Although the code is short and mostly flat, the lack of clear purpose, missing return, and abbreviated identifiers make it difficult to follow at a glance. Correcting these issues would significantly improve readability.
Run 1
Code Structure: The small class logically groups header-wrapper behavior, but numerous unused imports and an out-of-order threading import add clutter. Nesting: Methods are flat and easy to scan. Clarity of intent: The class docstring explains the adapter's purpose, but abbreviated names such as hea, inf, and nam obscure meaning. The constructor documentation refers to headers rather than its actual parameter, and get discards the underlying result, making its intended behavior unclear. Code length: The implementation is concise, although imports dominate this short snippet unnecessarily. Action granularity: Each statement performs a single action, with no compressed multi-action lines. Reading flow: The class and methods follow a natural sequence, but import organization, inconsistent naming, and informal documentation interrupt an otherwise straightforward reading experience.
Run 2
Code Structure: The small class is logically organized, but numerous unused imports and the misplaced threading import add clutter. Nesting: Methods are flat and easy to scan. Clarity of intent: The class docstring explains its adapter role, but abbreviated names such as hea, inf, and nam obscure meaning. The constructor documentation names headers rather than hea, and get does not return the retrieved value, making its intended behavior unclear. Code length: The class is concise, although the import block is disproportionately long for the functionality shown. Action granularity: Each statement performs a single action. Reading flow: Methods follow a natural constructor-then-accessors sequence, but inconsistent import organization, limited spacing, and the conversational docstring interrupt an otherwise straightforward flow.
Run 3
Code Structure: A small, logically organized wrapper class, but numerous unused imports and inconsistent import grouping add clutter. Nesting: Very shallow, with straightforward methods and no nested control flow. Clarity of intent: The class docstring explains its purpose, but abbreviated names such as hea, inf, and nam obscure meaning; the constructor documentation names headers rather than hea. The get method does not return the underlying result, making its intent less clear. Code length: The class is concise, though the import block is disproportionately large for the functionality shown. Action granularity: Each executable line performs one clear action. Reading flow: Methods follow a natural constructor-then-accessors sequence, but informal documentation, cramped top-level spacing, and threading imported after local imports interrupt consistency.