Sample
pyint-d02f2ee6f861-I11
Split eligible integer literals into pairs of short-named intermediate variables
Scores
| Method | Score | Scale |
|---|---|---|
| Posnett | 0 | 0–1; higher is more readable |
| Dorn | 0.205 | 0–1; higher is more readable |
| Mi | 0.335 | 0–1; higher is more readable |
| LLOC | 102 | Logical lines; fewer is more readable |
| DeepSeek V4 Pro | 14.67 | 0–20; mean of three runs |
| GPT-6.1 Sol | 16 | 0–20; mean of three runs |
| BTTF | 0.472 | 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. | 9520.545 | −314.178 |
| Source linesThe number of non-empty source lines. | 237 | +94.8 |
| 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.529 |
Intercept 8.87 + feature contributions = -217.037 (log-odds).
Score = sigmoid(-217.037) = 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. | 238 | −7.391 |
| Indentation frequencyHow rapidly indentation changes from line to line. | 212 | +6.596 |
| Number layout frequencyHow rapidly the number of numeric values per line changes through the code. | 212 | −4.444 |
| Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom. | 236.932 | +2.902 |
| Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right. | 86.605 | +0.593 |
| Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *. | 0.062 | +0.339 |
| 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.962 | −0.018 |
Intercept 0.07 + feature contributions = -1.353 (log-odds).
Score = sigmoid(-1.353) = 0.205.
| Score | 0.335 |
|---|
| Score | 102 |
|---|
Run 1
The code follows Django admin conventions with clear imports, logical class structure, and mostly flat, readable methods. However, readability is negatively impacted by several factors: (1) the `user_change_password` method is excessively long with nested conditionals, multiple responsibilities, and a complex return path; (2) the `valid_submission` logic relies on non-obvious fallback behavior; (3) `response_add` contains unnecessary variable indirection (`a = 2; b = -1; request.POST['_continue'] = (a + b)`) which obscures intent; (4) some comments are verbose while critical logic remains unexplained; (5) method decorators and transaction wrapping split `add_view` into two methods, adding indirection. Positives include sensible use of `fieldsets`, declarative configuration, and clear permission checks. Overall, the code is maintainable by experienced Django developers but less readable for newcomers due to action density and unclear flow in key methods.
Run 2
The code is generally readable, well-structured, and follows Django admin conventions. Imports are logically grouped, class-level configuration is declarative, and methods have clear single responsibilities. However, there are a few detractors: `response_add` has an overly terse section (`a = 2; b = -1`) where a direct `1` would be clearer, and `user_change_password` is quite long with multiple nested conditionals, reducing flow. Nesting is mostly controlled but deep enough in password handling to require careful reading. Intent is mostly clear, with helpful comments in key decision points like `_add_view`. Overall, this is professional-grade Django code with good granularity and flow, but a few avoidable complexities and minor clarity issues drop the score slightly below excellent.
Run 3
The code is reasonably structured with clear sections and consistent formatting, but several issues reduce readability. The import block is lengthy but logically organized. Class attributes like fieldsets and add_fieldsets are well-formatted and readable. However, the user_change_password method is quite long and contains multiple nested conditionals, increasing cognitive load. The response_add method has a confusing section where 'a = 2' and 'b = -1' then 'request.POST["_continue"] = (a + b)' — this is ambiguous and unnecessarily unclear; simply setting it to 1 would be cleaner. Some methods use decorators that add complexity, but they are properly applied. The _add_view method includes lengthy comments that, while informative, interrupt the flow. Overall, the code follows Django conventions well and has clear intent, but the long methods, ambiguous variable naming, and nested logic prevent it from being highly readable.
Run 1
Code Structure: Well organized into a configuration block and focused admin methods, though user_change_password combines validation, persistence, messaging, redirection, and rendering. Nesting: Mostly shallow, with deeper POST/form-validation branches and a nested redirect expression adding complexity. Clarity of intent: Descriptive method names, standard Django conventions, and security comments make most behavior clear. However, the unexplained a and b variables and arithmetic assignment to request.POST['_continue'] obscure a simple action. Code length: Configuration and context dictionaries justify much of the length, but the password-change method and some comments could be more concise. Action granularity: Statements generally perform one action per line, with consistent multiline formatting for complex expressions. Reading flow: Imports, configuration, and methods follow a natural sequence; guard clauses help, while framework-specific details and the long password workflow require additional attention.
Run 2
Code Structure: Configuration and behavior are logically organized within UserAdmin, with focused overrides, although user_change_password handles several responsibilities. Nesting: Most methods are shallow and use early exits; the password-change handler has moderately nested validation and redirect logic. Clarity of intent: Descriptive names, standard Django patterns, and explanatory security comments clarify purpose. However, the arbitrary a and b variables and their arithmetic obscure the intent of setting _continue. Code length: Most verbosity is justified by configuration and context construction, but the lengthy password handler and unnecessary arithmetic reduce concision. Action granularity: Statements generally perform one action per line, with readable formatting for complex expressions. Reading flow: Configuration precedes related methods, and request handling follows a natural sequence; framework-specific knowledge and the anomalous response_add arithmetic slightly disrupt readability.
Run 3
Code Structure: Configuration and behavior are logically organized within UserAdmin, with focused overrides; user_change_password handles several responsibilities in one long method. Nesting: Most methods are shallow, but POST validation and redirect construction introduce deeper nesting. Clarity of intent: Descriptive names, decorators, and explanatory comments make permissions and authentication workflows clear. However, the unexplained a and b variables and arithmetic assignment in response_add obscure a simple intent. Code length: Mostly justified by Django configuration and security handling, though some comments and the password-change method are lengthy. Action granularity: Statements generally perform one action per line, with consistent multiline formatting for complex expressions. Reading flow: Configuration precedes methods, and guard clauses support natural progression; framework-specific details, nested success handling, and the arbitrary arithmetic near the end slightly disrupt readability.