Sample
pyint-050fc5fdfe2d-I01
Remove comments and docstrings
Scores
| Method | Score | Scale |
|---|---|---|
| Posnett | 0 | 0–1; higher is more readable |
| Dorn | 0.64 | 0–1; higher is more readable |
| Mi | 0.486 | 0–1; higher is more readable |
| LLOC | 40 | Logical lines; fewer is more readable |
| DeepSeek V4 Pro | 16 | 0–20; mean of three runs |
| GPT-6.1 Sol | 16.67 | 0–20; mean of three runs |
| BTTF | 0.549 | 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. | 2291.567 | −75.622 |
| Source linesThe number of non-empty source lines. | 64 | +25.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.544 | −6.817 |
Intercept 8.87 + feature contributions = -47.968 (log-odds).
Score = sigmoid(-47.968) = 0.
Feature contributions
| Feature | Value | Contribution (log-odds) |
|---|---|---|
| Indentation frequencyHow rapidly indentation changes from line to line. | 64 | +1.477 |
| Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code. | 65 | −1.265 |
| Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right. | 0 | −0.804 |
| Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom. | 63.933 | +0.484 |
| 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.069 | +0.276 |
| 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. | 87.938 | −0.06 |
Intercept 0.07 + feature contributions = 0.575 (log-odds).
Score = sigmoid(0.575) = 0.64.
| Score | 0.486 |
|---|
| Score | 40 |
|---|
Run 1
The code is generally well-structured and readable. It follows Django conventions, has clear class and method names, and logical organization. The imports are grouped logically, and the class structure is coherent. However, there are minor issues: the blank line after the class declaration is unnecessary, and the method 'clean' has some awkward whitespace (blank line before return in the last if-else block) and could be slightly simplified. The nesting level is low, intent is clear, and each action is mostly on its own line, though the conditional blocks in '__init__' and 'clean' are slightly verbose. Overall, it is readable but could be polished for slightly better flow and consistency.
Run 2
The code is generally readable with clear imports, logical class structure, and straightforward method definitions. The __init__ method is well-structured with sensible parameter handling. However, there are some inconsistencies that reduce readability: unnecessary blank lines between the class declaration and its first attribute, inconsistent intent in the clean method where one branch returns None and others return parent_instance without clear explanation, and the presence of whitespace-only lines that disrupt flow. The nesting is minimal and action granularity is good—each line performs a single logical operation. The reading flow is natural for experienced Django developers, though the logic around pk_field and to_field could benefit from a brief comment. Overall, the code is maintainable and clear, with only minor style issues preventing a higher score.
Run 3
The code is generally well-structured and readable, with clear imports, consistent naming, and logical class organization. The `clean` method has moderate nesting (two `if` statements), and action granularity is mostly one action per line. However, there are some minor issues: the `__init__` method could be slightly more concise, and a few blank/indentation lines affect flow. Overall, intent is clear and the code follows Django conventions, but there is room for slight improvement in reducing nesting in `clean` and tightening spacing.
Run 1
Code Structure: The class is logically organized into initialization, validation, and change detection, though numerous unused imports add clutter. Nesting: Conditional nesting is shallow and manageable; early returns simplify validation. Clarity of intent: Descriptive class, method, and attribute names make the purpose clear, although 'orig' is vague and has_changed() returning False without explanation may puzzle readers. Code length: The class is concise, but unused imports and excess blank lines unnecessarily lengthen the snippet. Action granularity: Statements generally perform one action per line, and the multiline exception construction is easy to scan. Reading flow: Methods follow a natural lifecycle and validation proceeds clearly, with minor disruption from whitespace inconsistencies and repeated selection of the parent key.
Run 2
Code Structure: The class is logically organized into initialization, validation, and change detection, but many unused imports clutter the snippet. Nesting: Conditional nesting is shallow and easy to follow, with early returns simplifying validation. Clarity of intent: Descriptive class and attribute names communicate the foreign-key validation purpose, though 'orig' is vague and the unconditional has_changed() result lacks explanation. Code length: Methods are concise, but excessive imports and stray blank lines add unnecessary length. Action granularity: Each statement generally performs one action, and multiline expressions are formatted clearly. Reading flow: Initialization naturally precedes validation and change detection; consistent indentation supports readability, while whitespace artifacts and missing documentation slightly interrupt the flow.
Run 3
Code Structure: The class is logically organized into configuration, initialization, validation, and change detection, though many unrelated imports clutter the excerpt. Nesting: Mostly shallow, with only a few two-level conditionals; early returns keep validation straightforward. Clarity of intent: Descriptive class and method names communicate the purpose, but pk_field, to_field, and orig require some Django knowledge, and the absence of documentation leaves behavioral assumptions unexplained. Code length: The class is concise without unnecessary abstraction, although unused imports and whitespace add noise. Action granularity: Statements generally perform one action per line, with readable multiline formatting. Reading flow: Initialization naturally precedes validation and change detection; stray blank lines slightly disrupt the otherwise clear flow.