Sample
pyint-c18701bccdcc-I03
Replace names with length-matched meaningful but unrelated identifiers
Scores
| Method | Score | Scale |
|---|---|---|
| Posnett | 0 | 0–1; higher is more readable |
| Dorn | 0.489 | 0–1; higher is more readable |
| Mi | 0.419 | 0–1; higher is more readable |
| LLOC | 49 | Logical lines; fewer is more readable |
| DeepSeek V4 Pro | 4.67 | 0–20; mean of three runs |
| GPT-6.1 Sol | 13 | 0–20; mean of three runs |
| BTTF | 0.378 | 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. | 2686.78 | −88.664 |
| Source linesThe number of non-empty source lines. | 115 | +46 |
| 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.513 | −6.77 |
Intercept 8.87 + feature contributions = -40.564 (log-odds).
Score = sigmoid(-40.564) = 0.
Feature contributions
| Feature | Value | Contribution (log-odds) |
|---|---|---|
| Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code. | 116 | −3.071 |
| Indentation frequencyHow rapidly indentation changes from line to line. | 74 | +1.822 |
| Number layout frequencyHow rapidly the number of numeric values per line changes through the code. | 74 | −1.277 |
| Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom. | 114.864 | +1.196 |
| Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *. | 0.032 | +0.635 |
| Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right. | 86.871 | +0.597 |
| 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.974 | −0.019 |
Intercept 0.07 + feature contributions = -0.046 (log-odds).
Score = sigmoid(-0.046) = 0.489.
| Score | 0.419 |
|---|
| Score | 49 |
|---|
Run 1
The code is structurally organized into methods, but variable and method names are misleading and do not reflect their actual purpose (e.g., validateAccount handles user agents, finalCount holds a user agent string, data holds host). Nesting is generally shallow but logic flow is unnatural. Intent is ambiguous due to poor naming and comments that do not match the code actions. Length is acceptable but action granularity is poor in places where multiple unrelated checks happen in one method. Reading flow is disjointed, and code does not read like standard Django middleware, making it hard to follow.
Run 2
The code is highly unreadable due to confused naming and structure. Function names like validateAccount, validateRequest, validateSession, and validateAddress do not reflect their actual purposes, making intent ambiguous. Variables such as finalCount, currentAccount, nextKey, node, nextMode, step, payload, feature, schedule, and data are misleading or meaningless, obscuring logic. The flow is disorganized, with comments describing the original Django behavior but names unrelated to it. While nesting is relatively flat and some lines are concise, overall clarity is severely compromised. Several methods lack clear separation of concerns, and action granularity is inconsistent. The code appears deliberately obfuscated, making it nearly impossible to follow without prior knowledge of the underlying framework.
Run 3
The code is severely unreadable due to poor naming and misleading structure. Methods like validateAccount, validateRequest, validateSession, and validateAddress have names that do not reflect their actual purposes (user-agent checking, URL validation, slash appending, and response handling). This obscures intent significantly. The class and method docstrings are present but are internally inconsistent with the actual code, adding confusion. While the nesting depth is relatively low and structure is mostly linear, the disorganized naming erodes overall clarity. The flow of logic is hard to follow because the method names create false expectations. Code length is only moderate, but many lines are dedicated to confusing variable names (e.g., 'finalCount', 'currentAccount', 'nextMode') which hurt readability. Overall, despite some good structural elements, the pervasive misnaming renders the code very difficult to understand.
Run 1
Code Structure: Responsibilities are logically separated into small methods, although unused imports add clutter. Nesting: Mostly manageable, but user-agent checking and slash validation reach three conditional/loop levels. Clarity of intent: Docstrings and comments explain behavior well, but misleading names such as validateAccount, validateSession, finalCount, and schedule obscure request/response handling. One docstring references a nonexistent should_redirect_with_slash method. Code length: Generally proportionate to the functionality; lengthy documentation and error text are mostly justified. Action granularity: Statements generally perform one action per line, with no compressed multi-statement lines. Reading flow: The sequence from access checks to redirects and response headers is natural, but inconsistent naming and terminology force readers to repeatedly consult documentation.
Run 2
Code Structure: Responsibilities are reasonably separated into methods, but unrelated validation-style names obscure their middleware roles, and several imports are unused. Nesting: Most code is shallow, although user-agent checks and slash validation reach three conditional or loop levels. Clarity of intent: Docstrings and comments explain behavior well, but names such as feature, finalCount, nextKey, and validateSession misleadingly describe requests, user agents, URL configurations, and path construction. A docstring also references a nonexistent should_redirect_with_slash method. Code length: Implementation is fairly concise; extensive documentation and the long error message add length but mostly provide useful context. Action granularity: Statements generally perform one action per line, with readable multiline formatting. Reading flow: The progression from request checks to URL validation, redirect construction, and response handling is logical, but inconsistent terminology and generic variable names require frequent consultation of comments.
Run 3
Code Structure: Responsibilities are sensibly separated into methods within one middleware class, although unused imports add clutter. Nesting: Mostly manageable, but user-agent checks and slash validation reach three conditional or loop levels. Clarity of intent: Docstrings and comments explain behavior well, but misleading method names such as validateAccount and validateSession, and variables such as finalCount, feature, and schedule, obscure request/response semantics. A docstring also references a nonexistent should_redirect_with_slash method. Code length: Reasonably concise overall; lengthy documentation and the error message are largely justified. Action granularity: Statements generally perform one action per line, with straightforward intermediate assignments. Reading flow: The progression from request checks to redirect helpers and response handling is logical, but inconsistent terminology and nonstandard middleware method names make the execution lifecycle harder to follow.