Sample
pyint-d2733649af65-I08
Select one of ten high-readability unrelated code templates per class
Scores
| Method | Score | Scale |
|---|---|---|
| Posnett | 0 | 0–1; higher is more readable |
| Dorn | 0.21 | 0–1; higher is more readable |
| Mi | 0.335 | 0–1; higher is more readable |
| LLOC | 103 | Logical lines; fewer is more readable |
| DeepSeek V4 Pro | 15 | 0–20; mean of three runs |
| GPT-6.1 Sol | 16 | 0–20; mean of three runs |
| BTTF | 0.434 | 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. | 9552.148 | −315.221 |
| Source linesThe number of non-empty source lines. | 238 | +95.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.355 | −6.532 |
Intercept 8.87 + feature contributions = -217.683 (log-odds).
Score = sigmoid(-217.683) = 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. | 213 | +6.63 |
| Number layout frequencyHow rapidly the number of numeric values per line changes through the code. | 213 | −4.467 |
| Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom. | 237.932 | +2.916 |
| Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right. | 86.586 | +0.593 |
| Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *. | 0.061 | +0.345 |
| 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.979 | −0.019 |
Intercept 0.07 + feature contributions = -1.323 (log-odds).
Score = sigmoid(-1.323) = 0.21.
| Score | 0.335 |
|---|
| Score | 103 |
|---|
Run 1
The code demonstrates good readability with clear logical organization, consistent naming conventions, and well-structured methods. The imports are organized and grouped logically. Class structure follows Django admin patterns with clear field definitions. Most methods have focused purposes with appropriate granularity. The `get_fieldsets`, `get_form`, and `lookup_allowed` methods are concise and clear. However, there are some issues: the `user_change_password` method is quite long with multiple responsibilities (form handling, validation, message generation, redirects) making it harder to follow. The arbitrary loop with `toggle_count` in that method appears to be dead code or a debugging artifact that significantly impacts clarity. Some conditional branches like the permission check in `_add_view` could be simplified. The nesting level in `user_change_password` reaches 3-4 levels deep in the POST handling section. Overall, the code follows solid Django conventions and remains reasonably readable despite these concerns.
Run 2
The code is generally well-structured and readable. It follows Django admin conventions, with clear separation of concerns between methods like get_fieldsets, get_form, _add_view, and user_change_password. Nesting levels are reasonable, though the user_change_password method is quite long and contains multiple conditional branches, increasing cognitive load. Intent is mostly clear, with helpful comments explaining non-obvious security checks or Django-specific behaviors. Code length is somewhat verbose but appropriate for the complexity of the task. Action granularity is mostly one action per line, except for a few dense lines like the reverse() call and the context dictionary construction. The reading flow is natural thanks to logical ordering of methods and consistent naming. Overall, the code is highly readable for an experienced Django developer, but could be improved by extracting smaller helpers from user_change_password.
Run 3
The code is structured as a Django admin class with clear method separation and standard imports, which aids navigation. However, several factors reduce readability. The `user_change_password` method is excessively long, combining permission checks, form handling, redirect logic, context building, and template rendering into one monolithic block. The bizarre `feature_enabled` loop with 3 toggles is dead code that obscures intent. Multiple nested conditionals (especially in the POST handling path) increase cognitive load. While naming is generally descriptive, some methods like `_add_view` mix permission logic with context preparation. The `lookup_allowed` expression chains negation with a super call on one line, requiring effort to parse. Comments explain rationale in places but don't compensate for the sprawling method structures. Overall, the code is maintainable by experienced Django developers but falls below high readability standards due to verbose methods, unnecessary complexity, and dead code.
Run 1
Code Structure: Configuration and admin hooks are logically grouped, although user_change_password combines validation, persistence, messaging, redirects, and rendering. Nesting: Most methods are shallow, but POST handling and nested redirect construction require extra attention. Clarity of intent: Descriptive names, conventional Django patterns, and security-related comments explain most behavior well. The unused feature_enabled toggle loop is purposeless and distracting. Code length: Configuration verbosity is mostly justified; the long password-change method and some extensive comments could be streamlined. Action granularity: Statements generally perform one action per line, with multiline expressions formatted clearly. Reading flow: The progression from configuration through request handling to responses is natural, supported by whitespace and early exits. Framework-specific conventions require Django familiarity, and the irrelevant toggle loop interrupts an otherwise coherent flow.
Run 2
Code Structure: Imports, declarative configuration, and focused admin methods are logically organized, although user_change_password handles several responsibilities. Nesting: Most methods are shallow and use early exits; POST validation and redirect construction introduce moderate nesting. Clarity of intent: Descriptive names, framework conventions, and explanatory comments make the workflow clear. However, the unused feature_enabled toggle loop is purposeless and distracting. Code length: Configuration and context dictionaries justify much of the length, but the password-change method is lengthy and could benefit from helper extraction. Action granularity: Statements generally perform one action per line, with multiline expressions formatted consistently. Reading flow: Configuration precedes behavior, and request handling follows a natural sequence from permission checks through validation, persistence, and rendering. Framework-specific details and verbose redirect construction slightly interrupt that flow.
Run 3
1. Code Structure: Well-organized Django admin class, with configuration grouped first and behavior separated into appropriately named methods. However, user_change_password combines validation, persistence, messaging, redirection, and rendering. 2. Nesting: Mostly shallow, with guard clauses improving readability; POST handling and redirect construction introduce moderate nesting. 3. Clarity of intent: Descriptive names and helpful security/workflow comments make most behavior clear. The unused feature_enabled toggle loop is unrelated and confusing. 4. Code length: Configuration verbosity is justified, but the long password-change method and redundant toggle loop reduce concision. 5. Action granularity: Statements generally perform one action per line, and multiline expressions are consistently formatted. 6. Reading flow: Methods follow recognizable request-processing sequences, with clear separation between setup and behavior. Framework-specific conventions require Django familiarity, and the irrelevant loop interrupts an otherwise natural flow.