Sample
pyint-9cb8773f159a-I10
Deterministically remove some optional blank lines and bracketed line breaks
Scores
| Method | Score | Scale |
|---|---|---|
| Posnett | 0 | 0–1; higher is more readable |
| Dorn | 0.078 | 0–1; higher is more readable |
| Mi | 0.654 | 0–1; higher is more readable |
| LLOC | 135 | Logical lines; fewer is more readable |
| DeepSeek V4 Pro | 7.67 | 0–20; mean of three runs |
| GPT-6.1 Sol | 14 | 0–20; mean of three runs |
| BTTF | 0.441 | 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. | 9001.476 | −297.049 |
| Source linesThe number of non-empty source lines. | 270 | +108 |
| 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.405 | −6.607 |
Intercept 8.87 + feature contributions = -186.786 (log-odds).
Score = sigmoid(-186.786) = 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. | 271 | −8.559 |
| Indentation frequencyHow rapidly indentation changes from line to line. | 204 | +6.319 |
| Number layout frequencyHow rapidly the number of numeric values per line changes through the code. | 204 | −4.26 |
| Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom. | 269.888 | +3.363 |
| Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right. | 105.982 | +0.906 |
| 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. | 105.974 | −0.823 |
| Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *. | 0.044 | +0.516 |
Intercept 0.07 + feature contributions = -2.469 (log-odds).
Score = sigmoid(-2.469) = 0.078.
| Score | 0.654 |
|---|
| Score | 135 |
|---|
Run 1
The code has reasonable structure but suffers from significant formatting inconsistencies that harm readability. Import blocks and function signatures show erratic spacing that suggests automated formatting issues. Multiple actions are crammed onto single lines in several places, particularly in the `resolve_redirects` method where function calls, conditionals, and assignments are chunked together. The nesting is moderate but acceptable. Method names and docstrings are clear, showing good intent. However, the inconsistent indentation patterns and cramped expressions make the reading flow choppy. Specific examples include the awkward parenthesis alignment in `should_strip_auth` and `resolve_redirects`, and compressed import statements. The core logic is understandable but formatting problems create unnecessary cognitive overhead. The code would benefit from consistent PEP 8 formatting and breaking complex expressions into multiple steps.
Run 2
The code has several readability issues. The import section is cluttered with awkwardly aligned items (e.g., 'cookiejar_from_dict, extract_cookies_to_jar, merge_cookies'), making it visually noisy. Method signatures use inconsistent and unnatural spacing in parameters (e.g., 'def resolve_redirects( self, resp: Response,'). The resolve_redirects method is very long with multiple conditional blocks, mutating state, and complex control flow, increasing cognitive load. Deeply nested logic, especially in should_strip_auth and the redirect loop, makes it harder to follow. However, the code does include docstrings and explanatory comments that clarify intent, and line-level actions are mostly separated. Overall, the inconsistent formatting, unwieldy method lengths, and tangled redirect-handling flow significantly reduce readability.
Run 3
The code is moderately readable but suffers from several issues. Imports are logically grouped, but some formatting is inconsistent (e.g., misaligned imports in `cookies`, `models`, `utils`). The `resolve_redirects` method is very long (~90 lines), mixing many concerns (URL parsing, header cleanup, cookie handling, proxy/auth rebuilding, rewind logic) without helper decomposition. Nesting is generally shallow, but some conditionals have awkward line breaks and spacing that hurt readability. Several function signatures and call sites use inconsistent multi-line formatting, making the code feel disorganized. Intent is mostly clear via comments, but the density of logic and inconsistent whitespace reduce clarity. Action granularity is acceptable—most lines perform one logical step—but excessive blank lines inside expressions and misaligned arguments disrupt flow. Overall, readable enough for experienced developers familiar with the codebase, but it would benefit from refactoring, formatting normalization, and breaking large methods into smaller, focused ones.
Run 1
Code Structure: Related redirect operations are organized into focused methods, but resolve_redirects combines many responsibilities. Nesting: Mostly shallow conditionals, with moderate nesting inside the redirect loop. Clarity of intent: Descriptive method names, type hints, docstrings, and explanatory comments clarify HTTP-specific behavior; abbreviated variables and unresolved annotation references add friction. Code length: Most helpers are concise, but the lengthy redirect method and extensive commentary increase reading effort. Action granularity: Executable statements generally perform one action per line, although crowded imports and argument lists impair visual separation. Reading flow: The redirect sequence is logically ordered, but inconsistent whitespace, awkward line wrapping, and missing blank lines between some methods interrupt scanning. Overall, the implementation is understandable but would benefit from consistent formatting and decomposition of the main redirect loop.
Run 2
Code Structure: Responsibilities are logically separated into redirect, authentication, proxy, and method helpers, but resolve_redirects combines many operations in one lengthy method. Nesting: Mostly shallow conditionals and early returns; the redirect loop adds moderate nesting without becoming deeply tangled. Clarity of intent: Descriptive method names, type annotations, docstrings, and protocol-specific comments explain purpose well, although unexplained or unresolved annotation names such as _t and CookieJar introduce ambiguity. Code length: Most helpers are concise, but redirect handling and extensive comments make the central method demanding to read. Action granularity: Executable statements generally perform one action per line; crowded imports, parameters, and keyword arguments reduce visual clarity. Reading flow: Processing follows a coherent redirect lifecycle, but inconsistent spacing, awkward line wrapping, and missing blank lines between some methods interrupt scanning. Overall, the code is understandable and organized, but formatting and the oversized redirect method prevent high readability.
Run 3
Code Structure: Responsibilities are logically divided into redirect, authentication, proxy, and method helpers, but resolve_redirects combines many concerns. Nesting: Mostly shallow conditionals and early returns; the redirect loop adds moderate nesting without becoming deeply tangled. Clarity of intent: Descriptive method names, type annotations, docstrings, and protocol-specific comments explain purpose well, although unexplained _t annotations and CookieJar references introduce ambiguity. Code length: Much of the length reflects necessary HTTP edge cases, but the long redirect method and extensive comments slow comprehension. Action granularity: Statements generally perform one action each; several imports and keyword arguments share crowded lines, reducing visual clarity. Reading flow: Redirect processing follows a sensible sequence, but inconsistent spacing, awkward line wrapping, and missing blank lines between some methods interrupt scanning. Overall, the code is understandable and reasonably organized, with formatting and method size being its main readability weaknesses.