Sample
pyint-7120cb631091-I02
Shorten method, parameter, and local names without collisions
Scores
| Method | Score | Scale |
|---|---|---|
| Posnett | 0 | 0–1; higher is more readable |
| Dorn | 0.923 | 0–1; higher is more readable |
| Mi | 0.561 | 0–1; higher is more readable |
| LLOC | 38 | Logical lines; fewer is more readable |
| DeepSeek V4 Pro | 14.33 | 0–20; mean of three runs |
| GPT-6.1 Sol | 14.67 | 0–20; mean of three runs |
| BTTF | 0.585 | 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. | 2532.846 | −83.584 |
| Source linesThe number of non-empty source lines. | 98 | +39.2 |
| 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.666 | −6.998 |
Intercept 8.87 + feature contributions = -42.512 (log-odds).
Score = sigmoid(-42.512) = 0.
Feature contributions
| Feature | Value | Contribution (log-odds) |
|---|---|---|
| Indentation frequencyHow rapidly indentation changes from line to line. | 94 | +2.514 |
| Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code. | 99 | −2.469 |
| Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom. | 97.826 | +0.958 |
| Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right. | 84.98 | +0.567 |
| Number layout frequencyHow rapidly the number of numeric values per line changes through the code. | 1 | +0.398 |
| Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *. | 0.058 | +0.374 |
| 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. | 84.929 | +0.068 |
Intercept 0.07 + feature contributions = 2.479 (log-odds).
Score = sigmoid(2.479) = 0.923.
| Score | 0.561 |
|---|
| Score | 38 |
|---|
Run 1
The code is generally structured well with clear sections for imports and class definition. The import statements are organized logically, grouping standard library, third-party, and local imports. Nesting is minimal, with only one level of conditionals in methods. However, clarity of intent is compromised by cryptic parameter names like 'eve', 'hoo', 'eve2', and 'hoo2' instead of more descriptive names like 'event' and 'hook'. The action granularity is acceptable, though the generator expression with a defensive runtime filter could be more readable if expanded. Reading flow is mostly natural but interrupted by the unconventional parameter naming. The type hints are thorough, which aids readability. Overall, the code is relatively readable but suffers from poor variable naming choices that obscure intent without documentation.
Run 2
The code is generally readable with clear imports, type hints, and docstrings. The RequestHooksMixin class is logically structured with two methods that each perform focused actions. Error handling is straightforward and nesting is minimal. However, readability is slightly reduced by unclear parameter names like 'eve', 'hoo', 'eve2', and 'hoo2', which obscure intent despite the docstrings. The defensive generator expression in register() is somewhat dense and could be split for clarity. Import organization is good but lengthy. Overall the code is maintainable but would benefit from more descriptive naming.
Run 3
The code has a clear structure with organized imports and a cohesive class definition, but readability suffers in several areas. The nesting is mostly flat, which is positive, but the logic for registering hooks is slightly tangled with mixed type checking and a defensive generator expression. Intent is reasonably clear due to docstrings and type hints, but variable names like 'eve', 'hoo', 'eve2', and 'hoo2' are ambiguous and hurt clarity. Code length is moderate, though the extensive import block feels verbose. Action granularity is mostly one action per line, except for the generator expression which packs multiple steps into one line. Reading flow is generally natural, but the abrupt variable naming and inconsistent event/hook parameter naming break mental flow. Overall, the code is functional but not highly readable without renaming variables and simplifying the registration logic.
Run 1
Code Structure: Imports are grouped logically, and hook registration and deregistration are separated into focused methods, though most imports are unused in this excerpt. Nesting: Shallow conditionals and a simple try/except keep complexity low. Clarity of intent: Method names, type annotations, and docstrings communicate purpose, but abbreviated parameters such as eve, hoo, eve2, and hoo2 obscure meaning and lack consistency. Code length: The methods are concise, but the extensive import section overwhelms the small implementation shown. Action granularity: Statements generally perform one action each; the generator expression compactly combines filtering and iteration without becoming difficult to follow. Reading flow: The class follows a natural register/deregister sequence, but the long import preamble and awkward line wrapping interrupt readability.
Run 2
Code Structure: Imports are grouped logically, and hook operations are cleanly separated into two methods, though the extensive imports overwhelm this small excerpt. Nesting: Shallow conditionals and a straightforward try/except keep complexity low. Clarity of intent: Class and method names, type annotations, and docstrings communicate purpose, but abbreviated and inconsistent parameter names (eve, hoo, eve2, hoo2, h2) obscure meaning. Code length: Methods are concise, while the large import block adds substantial reading overhead and includes many names unused in the excerpt. Action granularity: Statements generally perform one action per line; the generator expression combines filtering and iteration but remains manageable. Reading flow: Registration followed by deregistration is natural, although awkward signature wrapping, inconsistent naming, and limited spacing before the class slightly disrupt scanning.
Run 3
1. Code Structure: Imports are grouped and hook operations are encapsulated in a focused mixin, but the extensive imports obscure the small implementation. 2. Nesting: Shallow conditionals and a simple try/except keep control flow easy to follow. 3. Clarity of intent: Method names, docstrings, and type annotations explain the purpose, but abbreviated parameters (eve, hoo, eve2, hoo2) and h2 reduce clarity. 4. Code length: Methods are concise, though the import section is disproportionately long for the shown code. 5. Action granularity: Statements generally perform one action per line; the generator expression combines filtering and iteration compactly without excessive complexity. 6. Reading flow: Registration followed by deregistration is natural, but inconsistent parameter naming and awkward line wrapping interrupt otherwise straightforward reading.