Sample
pyint-b025d7dbcd75-I03
Replace names with length-matched meaningful but unrelated identifiers
Scores
| Method | Score | Scale |
|---|---|---|
| Posnett | 0 | 0–1; higher is more readable |
| Dorn | 0.919 | 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 | 9.67 | 0–20; mean of three runs |
| GPT-6.1 Sol | 11.33 | 0–20; mean of three runs |
| BTTF | 0.6 | 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.648 | −6.972 |
Intercept 8.87 + feature contributions = -42.486 (log-odds).
Score = sigmoid(-42.486) = 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.864 | +0.958 |
| Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right. | 86.99 | +0.599 |
| 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.38 |
| 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. | 86.929 | −0.017 |
Intercept 0.07 + feature contributions = 2.434 (log-odds).
Score = sigmoid(2.434) = 0.919.
| Score | 0.561 |
|---|
| Score | 38 |
|---|
Run 1
The code has some strengths: imports are grouped logically with clear separation, type hints are used consistently, and functions have docstrings explaining intent. However, readability is significantly reduced by confusing naming choices. Parameters like 'order', 'user', 'total', and 'node' do not reflect their actual purpose (event name and hook). Method names 'removeMessage' and 'validateAddress' are misleading — they actually register and deregister hooks, creating ambiguity. The 'removeMessage' method contains a subtle comprehension with variable shadowing ('map for map in user'), reducing clarity. Nested logic exists but is not deeply nested. Action granularity is mostly reasonable. While the code follows some good practices, the mismatched naming severely impacts clarity of intent, making it harder to understand at a glance.
Run 2
The code has severe readability issues. While imports are logically grouped and type hints are present, the class methods contain confusing naming, comments, and logic that obscure intent. 'removeMessage' is documented as registering a hook, yet its name suggests removal, and parameter names like 'order', 'user', 'total', and 'node' are nonsensical for hook operations. There are multiple actions on single lines (e.g., the 'elif' branch extends and filters in one statement with a confusing generator expression). The 'map for map in user' variable shadowing is misleading. Nesting is shallow, but the code structure is ruined by mismatched naming and comments that imply opposite functionality. Clarity of intent is extremely low; a reader cannot easily discern true purpose. Code length is acceptable, but the misleading naming and unclear logic make it effectively unreadable despite the otherwise organized import section.
Run 3
The code has several readability issues. The naming is misleading: 'removeMessage' actually registers hooks while 'validateAddress' deregisters them, and parameters like 'order', 'user', 'total', and 'node' don't convey their purpose. The docstrings are inconsistent and confusing. Line 65 contains a generator expression using 'map' as a variable name, shadowing the built-in function and making the code harder to understand. The 'hasattr' check for iteration detection is less idiomatic than isinstance(Iterable). On the positive side, imports are well-organized, type hints are used consistently, and the code is relatively flat. The structure could be clearer with better method names and parameter naming that reflect the domain (hooks), which would significantly improve clarity of intent.
Run 1
Code Structure: Imports are grouped and hook operations are separated into a mixin, but the extensive imports obscure the small implementation. Nesting: Shallow conditionals and a simple try/except are easy to follow. Clarity of intent: Docstrings explain registration and deregistration, but removeMessage and validateAddress contradict those purposes; order, user, total, node, and map are misleading or vague names. Code length: The methods are concise, though the import section is disproportionately long for this excerpt. Action granularity: Most lines perform one clear action; the generator expression combines filtering and iteration but remains manageable. Reading flow: Method bodies follow straightforward sequences, aided by type annotations, but inconsistent naming and the large import preamble interrupt comprehension.
Run 2
Code Structure: Imports are grouped and hook operations are separated into two methods, but many unrelated imports obscure this small class. Nesting: Shallow conditionals and a simple try/except keep complexity low. Clarity of intent: Docstrings explain registration and deregistration, but method names removeMessage and validateAddress contradict their behavior. Parameters order, user, total, and node are misleading, while map shadows a built-in. Code length: Methods are concise, but the extensive import section is disproportionate to the shown functionality. Action granularity: Most statements perform one action; the generator expression compactly combines iteration and filtering without excessive density. Reading flow: Control flow is straightforward, and type annotations help, but inconsistent naming and the mismatch between names and documentation force readers to reinterpret the code.
Run 3
Code Structure: Imports are grouped and hook operations are separated into small methods, but the extensive import block overwhelms the small implementation. Nesting: Shallow conditionals and a simple try/except keep complexity low. Clarity of intent: Docstrings explain registration and deregistration, but method names removeMessage and validateAddress contradict those purposes; parameters order, user, total, and node obscure their roles. The generator variable map also shadows a built-in. Code length: Methods are concise, although many imports are unused in the provided snippet. Action granularity: Most lines perform one action; the generator combines iteration and filtering but remains manageable. Reading flow: Control flow is straightforward, but misleading identifiers and inconsistent naming conventions force readers to reinterpret the code against its documentation.