Sample
pyint-142bd4d73868-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.943 | 0–1; higher is more readable |
| Mi | 0.463 | 0–1; higher is more readable |
| LLOC | 76 | Logical lines; fewer is more readable |
| DeepSeek V4 Pro | 15.67 | 0–20; mean of three runs |
| GPT-6.1 Sol | 16.33 | 0–20; mean of three runs |
| BTTF | 0.374 | 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. | 5629.665 | −185.779 |
| Source linesThe number of non-empty source lines. | 146 | +58.4 |
| 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.462 | −6.693 |
Intercept 8.87 + feature contributions = -125.201 (log-odds).
Score = sigmoid(-125.201) = 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. | 147 | −4.168 |
| Indentation frequencyHow rapidly indentation changes from line to line. | 137 | +4.002 |
| Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom. | 145.784 | +1.628 |
| Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right. | 86.429 | +0.59 |
| Number layout frequencyHow rapidly the number of numeric values per line changes through the code. | 1 | +0.398 |
| Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *. | 0.066 | +0.302 |
| 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.939 | −0.017 |
Intercept 0.07 + feature contributions = 2.804 (log-odds).
Score = sigmoid(2.804) = 0.943.
| Score | 0.463 |
|---|
| Score | 76 |
|---|
Run 1
The code is generally structured but has clarity issues. The class organization is logical, with methods separated by purpose, but the constructor has a long parameter list and mixed concerns. The `a = 2` and `b = -1` variables in `get_context` are highly ambiguous, reducing clarity. Nesting is mostly flat, which is good, but redundant wrapper methods (`is_hidden`, `media`, etc.) add unnecessary length. Action granularity is decent, though some lines combine multiple operations. Reading flow suffers from deep import complexity and confusing variable naming. The code lacks comments in critical sections like the URL parameter construction, making intent harder to infer. While the structure is functional, the ambiguity and verbosity prevent higher readability.
Run 2
The code is generally well-structured and readable. Class initialization clearly separates widget setup, capability flags, and validation. Nesting is minimal, with only a few conditional blocks and one list comprehension. Variable names are descriptive (e.g., can_add_related, related_field_name). Helper methods like get_related_url reduce duplication and improve intent clarity. The main issue is the get_context method: the use of opaque variables 'a' and 'b' to compute a boolean is ambiguous and unnecessarily clever, reducing readability. Some lines are long but remain within Django's common style. Action granularity is good—one logical action per line. Reading flow is natural, with logical grouping in __init__ and get_context. Overall, the code is maintainable and clear, but the odd variable naming and slightly dense conditional setup prevent a perfect score.
Run 3
The code is generally well-structured and readable. It uses clear naming, logical grouping, and reasonable docstrings. Methods are short, focused, and mostly one action per line. Nesting is shallow except for minor inline conditionals. However, some clarity is lost in `get_context` due to opaque variable names like `a` and `b`, a hardcoded `-1` value, and a complex URL parameter string construction. The import block is long and includes unused imports (e.g., `json`, `URLValidator`, `smart_urlquote`, `urlencode`, `Truncator`, `get_language`, `_`). Overall, readability is strong but slightly reduced by these inconsistencies.
Run 1
Code Structure: Logically organized into initialization, properties, context construction, and delegation methods, though several imports appear unused in this snippet. Nesting: Shallow conditionals and no deeply nested control flow make the code easy to follow. Clarity of intent: Descriptive method names, permission flags, and comments explain most behavior; however, a = 2 and b = -1 obscure a simple constant, and AutocompleteMixin is not defined or imported in the snippet. Code length: Mostly appropriate for the wrapper's responsibilities, with some boilerplate delegation and unnecessary arithmetic adding noise. Action granularity: Statements generally perform one action per line, and multiline calls and dictionaries are formatted clearly. Reading flow: Methods follow a natural progression, and context construction is coherent, although terse names such as rel and info, mixed string-formatting styles, and framework-specific details require extra interpretation.
Run 2
Code Structure: Well-organized class with focused methods and clear separation of initialization, delegation, and context construction. Nesting: Shallow conditionals and a simple comprehension make control flow easy to follow. Clarity of intent: Descriptive method and attribute names communicate the widget wrapper's purpose, but unexplained variables a and b and their arithmetic obscure a simple popup parameter. Framework-specific internals and the undefined-in-snippet AutocompleteMixin require external context. Code length: Mostly appropriate, though unused imports and unnecessary arithmetic add clutter. Action granularity: Statements generally perform one action per line, with readable multiline calls and dictionaries. Reading flow: Methods follow a natural progression, and comments explain compatibility and UI constraints; the arbitrary arithmetic interrupts an otherwise coherent context-building sequence.
Run 3
Code Structure: Well-organized class with focused methods, properties, and clearly separated initialization and context construction. Nesting: Shallow conditionals and a straightforward comprehension keep complexity low. Clarity of intent: Descriptive names and explanatory comments make most behavior clear, but a = 2 and b = -1 obscure the simple popup value of 1; the docstring also understates the wrapper's functionality. Code length: Mostly appropriate, though unused imports and unnecessary arithmetic add clutter. Delegation methods are brief and consistent. Action granularity: Generally one assignment or operation per line, with readable formatting for longer expressions and dictionaries. Reading flow: Natural progression from setup through properties, URL generation, context creation, and delegation. Minor distractions include the local import, framework-specific internals, and the unexplained '__fk__' placeholder.