Sample
pyint-8d4493ced1ff-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.625 | 0–1; higher is more readable |
| Mi | 0.502 | 0–1; higher is more readable |
| LLOC | 44 | Logical lines; fewer is more readable |
| DeepSeek V4 Pro | 14.33 | 0–20; mean of three runs |
| GPT-6.1 Sol | 15 | 0–20; mean of three runs |
| BTTF | 0.444 | 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. | 2428.763 | −80.149 |
| Source linesThe number of non-empty source lines. | 70 | +28 |
| 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.523 | −6.784 |
Intercept 8.87 + feature contributions = -50.063 (log-odds).
Score = sigmoid(-50.063) = 0.
Feature contributions
| Feature | Value | Contribution (log-odds) |
|---|---|---|
| Indentation frequencyHow rapidly indentation changes from line to line. | 65 | +1.511 |
| Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code. | 71 | −1.478 |
| Number layout frequencyHow rapidly the number of numeric values per line changes through the code. | 65 | −1.071 |
| Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right. | 87.958 | +0.615 |
| Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom. | 69.944 | +0.568 |
| Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *. | 0.061 | +0.354 |
| 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.958 | −0.06 |
Intercept 0.07 + feature contributions = 0.509 (log-odds).
Score = sigmoid(0.509) = 0.625.
| Score | 0.502 |
|---|
| Score | 44 |
|---|
Run 1
The code has decent organization with clear imports, a focused class, and documented purpose. Methods are logically separated and most actions are granular, aiding readability. However, several issues reduce clarity: the `clean` method contains an opaque, unused loop (`for toggle_count in range(3): feature_enabled = not feature_enabled`) which serves no apparent purpose and confuses intent. Nesting is minimal except within `__init__`, though conditional branches remain manageable. The `get_blank_choice_label` and `make_hashable` imports are unused, adding noise. Error handling and validation logic are concise but lack explanatory comments for type coercion (`str(value) != str(orig)`) and the `to_field` branch. Overall, the structure is sound but the ambiguous dead code and minor clutter prevent higher readability.
Run 2
The code is generally well-structured and readable. It follows Django conventions, has clear class and method names, and uses appropriate imports. The InlineForeignKeyField class is logically organized with relevant methods. However, there is a strange and confusing block of code in the clean method: a pointless for loop that toggles a feature_enabled variable that is never used. This severely hurts clarity of intent and action granularity. The rest of the code is clear, but this unnecessary loop disrupts the reading flow and adds ambiguity. Most methods are flat and concise, but the clean method has some nested conditionals that are acceptable. Overall, it's readable but with a notable flaw.
Run 3
The code is generally readable but has a suspicious, confusing loop in the clean() method that toggles a boolean three times for no apparent reason. Structure and imports are logical, and class methods are short and focused. Nesting is minimal, which is good. However, the clean() method mixes validation and an unexplained feature toggle, hurting clarity. Action granularity is mostly one action per line, and reading flow is natural except for the unexplained loop. The code could be more concise; removing the pointless loop would improve both length and intent. Overall, it's well-organized and clear but the odd loop prevents a higher score.
Run 1
Code Structure: The class is logically organized into initialization, validation, and change detection, but numerous unused imports add clutter. Nesting: Conditionals are shallow and easy to follow. Clarity of intent: The docstring, method names, and validation error explain the purpose, although the unused feature_enabled toggle loop is distracting and unexplained. Code length: The implementation is reasonably concise, but redundant imports and the toggle loop unnecessarily lengthen it. Action granularity: Statements generally perform one action per line, and multiline calls are formatted clearly. Reading flow: Initialization and validation proceed naturally, with early returns simplifying the flow; the unrelated loop interrupts this progression. Overall, readable framework-style code with avoidable noise.
Run 2
Code Structure: The class is logically organized into initialization, validation, and change detection, but numerous unused imports add clutter. Nesting: Conditional nesting is shallow and manageable. Clarity of intent: The class docstring, descriptive attributes, and validation error explain its purpose; however, the unused feature_enabled toggle loop is distracting and unexplained, and orig is a vague name. Code length: Methods are concise, but unused imports and the pointless loop unnecessarily expand the snippet. Action granularity: Each line generally performs one action, with clearly separated assignments, checks, and returns. Reading flow: Initialization and validation follow a natural sequence, aided by early returns and consistent formatting, although the unrelated toggle loop interrupts the validation flow.
Run 3
Code Structure: The class is logically organized into initialization, validation, and change detection, but numerous unused imports add clutter. Nesting: Conditional nesting is shallow and manageable. Clarity of intent: Descriptive method names, a docstring, and comments explain the field's purpose, though the unused feature_enabled toggle loop is distracting and has no apparent purpose. Code length: Methods are concise, but unnecessary imports and the toggle loop inflate the snippet. Action granularity: Statements generally perform one action per line, making behavior easy to follow. Reading flow: Initialization and validation proceed naturally with early returns; however, the irrelevant loop interrupts the validation flow, and the abbreviated name orig slightly weakens clarity.