Sample
pyint-5b2741242938-I12
Inline all eligible single-use intermediate local variables
Scores
| Method | Score | Scale |
|---|---|---|
| Posnett | 0 | 0–1; higher is more readable |
| Dorn | 0.43 | 0–1; higher is more readable |
| Mi | 0.463 | 0–1; higher is more readable |
| LLOC | 74 | Logical lines; fewer is more readable |
| DeepSeek V4 Pro | 17 | 0–20; mean of three runs |
| GPT-6.1 Sol | 17.33 | 0–20; mean of three runs |
| BTTF | 0.407 | 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. | 5514.733 | −181.986 |
| Source linesThe number of non-empty source lines. | 144 | +57.6 |
| 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.464 | −6.695 |
Intercept 8.87 + feature contributions = -122.211 (log-odds).
Score = sigmoid(-122.211) = 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. | 145 | −4.098 |
| Indentation frequencyHow rapidly indentation changes from line to line. | 135 | +3.932 |
| Number layout frequencyHow rapidly the number of numeric values per line changes through the code. | 135 | −2.677 |
| Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom. | 143.795 | +1.6 |
| Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right. | 86.938 | +0.598 |
| Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *. | 0.065 | +0.31 |
| 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 = -0.283 (log-odds).
Score = sigmoid(-0.283) = 0.43.
| Score | 0.463 |
|---|
| Score | 74 |
|---|
Run 1
The code is well-structured and readable. It follows a logical organization with clear separation of concerns, using a single class with focused methods. Nesting is minimal, with only one small conditional inside a method. The intent of the class and each method is clear, with descriptive names and a helpful docstring. Code length is appropriate for the functionality, and actions are mostly one per line, improving readability. The reading flow is natural, with related properties grouped together and a logical progression from initialization to context building to data handling. Minor deductions for slightly verbose imports and a couple of long lines, but overall the code is highly readable.
Run 2
The code is well-structured with clear separation of concerns: class definition, initialization, deepcopy, properties, and methods. The __init__ method is slightly long but logically organized with comments explaining non-obvious decisions like the cascade deletion check. Nesting is minimal, mostly limited to conditional blocks. Intent is clear - this is a Django admin widget wrapper for related objects. Variable names are descriptive and follow Django conventions. Action granularity is appropriate with one logical operation per line. Reading flow is natural, progressing from setup through properties to context generation. The code could be improved by extracting the url_params construction or the context dict building into helper methods to reduce __init__ and get_context length, but overall it maintains strong readability through consistent patterns and clear naming.
Run 3
The code is well-structured with clear separation of concerns, following Django's widget wrapper pattern. It uses flat nesting with only necessary conditional blocks, and each method has a single responsibility. Naming is descriptive and consistent, making intent clear. The code is concise without sacrificing readability, with reasonable line lengths and logical grouping of related operations. Reading flow is natural, progressing from initialization through properties to context building. Minor deductions: the `get_context` method has a slightly dense middle section with URL parameter construction, and some conditional blocks could benefit from additional spacing. The import block is somewhat lengthy but includes only necessary imports. Overall, this is production-quality Django code that maintains high readability standards while handling complex admin widget functionality.
Run 1
Code Structure: Well-organized class with distinct initialization, delegation, URL construction, and context-building methods. Nesting: Shallow conditionals and no deeply nested control flow make scanning easy. Clarity of intent: Descriptive method names, permission flags, and explanatory comments communicate purpose, although Django-specific relationships require background knowledge and the docstring understates the supported actions. Code length: Mostly concise; repetitive delegation methods are reasonable for a wrapper, while unused imports add clutter. Action granularity: Statements generally perform one action each, with readable multiline expressions and dictionaries. Reading flow: Methods follow a logical progression, and context construction proceeds naturally from metadata to permissions and URLs. Minor distractions include mixed string-formatting styles, a local import, and AutocompleteMixin being referenced without a visible definition or import.
Run 2
Code Structure: Well organized into initialization, delegated properties, URL generation, context construction, and widget forwarding methods. Nesting: Shallow conditionals and no deeply nested control flow make scanning easy. Clarity of intent: Descriptive method names, permission flags, and comments clearly communicate the wrapper's purpose, although Django-specific conventions, abbreviated names such as rel and info, and the unexplained __fk__ placeholder require background knowledge. Code length: Mostly concise; repetitive delegation is understandable, but several unused imports add clutter. Action granularity: Statements generally perform one action per line, with multiline expressions formatted clearly. Reading flow: Methods follow a logical sequence, and context creation proceeds naturally from metadata to optional URLs. The lengthy initializer and framework-specific details modestly increase reading effort.
Run 3
Code Structure: Well-organized class with initialization, delegated properties, URL construction, and rendering context separated into methods. Nesting: Shallow conditionals and a straightforward comprehension keep complexity low. Clarity of intent: Descriptive method names, permission flags, and explanatory comments make the wrapper's purpose clear, though abbreviated names such as rel and info require framework familiarity. Code length: Mostly concise; delegation methods are justified, but several unused imports add clutter. Action granularity: Statements generally perform one action each, with multiline formatting making larger calls and dictionaries easy to scan. Reading flow: Methods follow a logical progression, and context construction precedes conditional additions naturally. Minor distractions include the local import, dense URL parameter formatting, and the externally defined AutocompleteMixin reference.