Sample
pyint-295a13937749-I12
Inline all eligible single-use intermediate local variables
Scores
| Method | Score | Scale |
|---|---|---|
| Posnett | 0 | 0–1; higher is more readable |
| Dorn | 0.158 | 0–1; higher is more readable |
| Mi | 0.335 | 0–1; higher is more readable |
| LLOC | 97 | Logical lines; fewer is more readable |
| DeepSeek V4 Pro | 16 | 0–20; mean of three runs |
| GPT-6.1 Sol | 16.33 | 0–20; mean of three runs |
| BTTF | 0.432 | 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. | 9358.855 | −308.842 |
| Source linesThe number of non-empty source lines. | 235 | +94 |
| 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.353 | −6.53 |
Intercept 8.87 + feature contributions = -212.502 (log-odds).
Score = sigmoid(-212.502) = 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. | 236 | −7.32 |
| Indentation frequencyHow rapidly indentation changes from line to line. | 210 | +6.527 |
| Number layout frequencyHow rapidly the number of numeric values per line changes through the code. | 210 | −4.398 |
| Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom. | 234.931 | +2.874 |
| Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right. | 99.975 | +0.809 |
| 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. | 99.97 | −0.569 |
| Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *. | 0.063 | +0.334 |
Intercept 0.07 + feature contributions = -1.673 (log-odds).
Score = sigmoid(-1.673) = 0.158.
| Score | 0.335 |
|---|
| Score | 97 |
|---|
Run 1
The code is generally well-structured and readable, following Django admin conventions. It has a clear logical organization with fieldsets, permissions, and custom methods separated appropriately. The imports are comprehensive and organized. The nesting level is moderate—the user_change_password method has some deeper nesting but remains manageable. The code's intent is clearly communicated through method names and comments. However, there are some readability issues: the `_add_view` method contains a long comment block that could be more concise, the `user_change_password` method is quite long and handles multiple responsibilities, and some dictionary construction in `TemplateResponse` is inconsistently formatted. The `extra_context.update(({...}))` has unnecessary parentheses. The code length is appropriate for the complexity of User admin functionality. Action granularity is mostly good with one action per line, though some lines like the `self.log_change` call are quite long. The reading flow is natural, progressing logically from setup to specific handlers.
Run 2
The code demonstrates strong readability through clear imports, logical class structure, and descriptive method names. Configuration attributes like fieldsets, list_display, and filter_horizontal are well-organized. Helpful comments explain non-obvious business logic, such as permission checks in _add_view and the response_add customization. However, the user_change_password method is notably long, containing multiple actions like validation, logging, messaging, and redirection. It could be refactored into smaller helper methods to improve readability. Some sections have unnecessary blank lines and a few verbose expressions, like constructing the HttpResponseRedirect, could be simplified. Overall, the code follows Django conventions and is generally easy to follow, but a few methods are long and could be broken down for better clarity.
Run 3
The code demonstrates good readability with clear organization, logical structure, and descriptive method names. It follows Django conventions well, making the intent clear. However, a few sections are overly verbose, particularly in _add_view with its long explanatory comment and in user_change_password with deeply nested conditionals and repetitive template context construction. The response_dict formatting could be improved for consistency. While the code is generally maintainable, some methods could benefit from extraction of smaller helpers to reduce nesting and improve flow. The flat structure for the most part and clear separation of concerns contribute positively. Overall, it's readable but could be more concise and have slightly better granularity.
Run 1
Code Structure: Well-organized Django admin class, with declarative configuration followed by focused methods; user_change_password handles several responsibilities. Nesting: Most methods are shallow, but password processing has nested POST, validation, and submission checks plus a deeply formatted redirect. Clarity of intent: Descriptive names, standard framework conventions, and security-focused comments make the purpose clear, though understanding requires Django familiarity. Code length: Mostly justified by configuration and workflows, but lengthy comments and the password-change method reduce concision. Action granularity: Generally one action per line; the long log_change call is harder to scan but remains a single operation. Reading flow: Methods follow coherent validation, processing, and response sequences, aided by early exits. Redundant parentheses, inconsistent dictionary indentation, extra whitespace, and a few long expressions interrupt otherwise natural reading.
Run 2
Code Structure: Configuration and behavior are logically grouped in a single admin class with focused methods. Nesting: Most methods are shallow, but password handling combines POST, validation, submission checks, and success branches with moderately deep nesting. Clarity of intent: Descriptive names, familiar Django conventions, and explanatory security comments make the purpose clear, though framework knowledge is required. Code length: Most verbosity is justified by configuration and workflow requirements; the password-change method and template context are lengthy. Action granularity: Statements generally perform one action per line, although the long log_change call compresses several operations visually. Reading flow: Imports, configuration, and methods follow a natural progression, with early permission checks helping navigation. Redundant parentheses, inconsistent dictionary indentation, extra blank lines, and a long unwrapped call introduce avoidable visual friction.
Run 3
Code Structure: Clearly organized into declarative admin configuration and focused methods, although user_change_password combines several responsibilities. Nesting: Most methods are shallow, but POST handling, form validation, and submission checks create moderately deep nesting. Clarity of intent: Descriptive names, familiar Django conventions, and explanatory security comments make the purpose clear; framework knowledge is needed for some details. Code length: Mostly justified by configuration and workflow requirements, though lengthy comments and context dictionaries add reading overhead. Action granularity: Statements generally perform one action per line, with no compressed multi-statement lines; one long log_change call is harder to scan. Reading flow: Guard clauses and orderly processing support natural reading, but redundant parentheses, inconsistent dictionary indentation, and stray whitespace interrupt the otherwise consistent formatting.