Sample
pyint-dae0e7c10a14-I13
Lower every eligible synchronous for loop to a while loop
Scores
| Method | Score | Scale |
|---|---|---|
| Posnett | 0 | 0–1; higher is more readable |
| Dorn | 0.589 | 0–1; higher is more readable |
| Mi | 0.615 | 0–1; higher is more readable |
| LLOC | 44 | Logical lines; fewer is more readable |
| DeepSeek V4 Pro | 17.33 | 0–20; mean of three runs |
| GPT-6.1 Sol | 18 | 0–20; mean of three runs |
| BTTF | 0.677 | 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. | 2844.331 | −93.863 |
| Source linesThe number of non-empty source lines. | 83 | +33.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.669 | −7.004 |
Intercept 8.87 + feature contributions = -58.796 (log-odds).
Score = sigmoid(-58.796) = 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. | 84 | −1.938 |
| Indentation frequencyHow rapidly indentation changes from line to line. | 76 | +1.892 |
| Number layout frequencyHow rapidly the number of numeric values per line changes through the code. | 76 | −1.323 |
| Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom. | 82.918 | +0.749 |
| Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right. | 82.024 | +0.519 |
| Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *. | 0.068 | +0.283 |
| 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. | 83.952 | +0.109 |
Intercept 0.07 + feature contributions = 0.361 (log-odds).
Score = sigmoid(0.361) = 0.589.
| Score | 0.615 |
|---|
| Score | 44 |
|---|
Run 1
The code is well-structured and highly readable. It follows Django model conventions with clear separation of concerns. The class is organized logically: fields are grouped together, followed by the manager, constants, Meta class, and methods. Nesting is minimal — the main indentation comes from field definition arguments, which is idiomatic for Django models. Each model field and method has a clear purpose, enhanced by descriptive names and docstrings. The code is concise but not overly compressed; field definitions are multi-line for readability. Action granularity is good, with one logical operation per line. Reading flow is natural, moving from field definitions to class constants to methods. Minor issues include the unused imports at the top (e.g., `Iterable`, `apps`, `ContentType`, `PermissionDenied`, `EmptyManager`) which could be removed, and a slight inconsistency in using string formatting (`"%s %s"`) versus f-strings, but these don't significantly impact readability.
Run 2
The code is highly readable and well-structured. It follows Django conventions, with clear separation of imports, model fields, Meta class, and methods. The field definitions are logically grouped and formatted consistently, with descriptive help_text and error messages. Nesting is minimal, with only one level in the Meta class and field definitions. Each field and method has a clear purpose, and the docstrings explain intent briefly. Action granularity is appropriate—most lines perform a single action, such as defining a field or returning a value. The reading flow is natural, starting with fields and progressing to methods. The only minor drawbacks are the slightly verbose field definitions (e.g., help_text strings) and the presence of unused imports (e.g., apps, ContentType, EmptyManager), which could confuse readers. Overall, the code is concise for what it accomplishes and maintains a clear, logical structure.
Run 3
The code is highly readable. It follows a logical structure with clear section separation: imports, class definition, fields, manager, Meta, and methods. Nesting is minimal and flat, with no deeply nested logic. Intent is clear due to descriptive names, helpful help_text attributes, and concise docstrings. Code length is appropriate for a Django model; repeated field patterns are idiomatic. Action granularity is good, with each model field and method body containing one primary action. Reading flow is natural, progressing from field definitions to methods. Minor deductions: the get_full_name method could use an f-string, and the imports at the top are somewhat verbose, but this is typical for Django. Overall, the code is well-organized, maintainable, and follows Django best practices.
Run 1
Code Structure: Clearly organized into imports, model fields, configuration, metadata, and methods. Nesting: Shallow, with indentation primarily used for field arguments and the Meta class rather than complex control flow. Clarity of intent: Descriptive names, docstrings, and field help text make the model's purpose clear; however, PermissionsMixin and UserManager are not defined or imported in the snippet, and several imports are unused. Code length: Appropriate for a declarative Django model, though unused imports add clutter. Action granularity: Statements generally perform one action each, and multiline field declarations improve scanning. Reading flow: Natural progression from user attributes to configuration and behavior, with consistent formatting and short, focused methods.
Run 2
Code Structure: Fields, manager, configuration, metadata, and methods are grouped logically. Nesting: Minimal control-flow nesting; multiline field declarations remain easy to follow. Clarity of intent: Descriptive names, help text, and method docstrings clearly explain the user model, though PermissionsMixin and UserManager are undefined in this snippet. Code length: Appropriate for the model, but several unused imports add clutter. Action granularity: Statements generally perform one action each, with readable formatting for complex declarations. Reading flow: The progression from model fields to configuration and behavior is natural and consistent. Minor dependency gaps and import noise prevent a higher score.
Run 3
Code Structure: Fields, manager, configuration, metadata, and methods are logically grouped. Nesting: Shallow nesting makes the class easy to scan; multiline field declarations remain manageable. Clarity of intent: Descriptive names, docstrings, and field help text clearly communicate purpose, although PermissionsMixin and UserManager are not defined or imported in the snippet. Code length: Mostly concise, with useful declarative detail, but several unused imports add clutter. Action granularity: Each statement performs one clear action, and methods have narrowly focused responsibilities. Reading flow: The progression from model fields to configuration and behavior is natural and consistent. Minor import clutter and unresolved dependencies prevent a higher score.