Sample
pyint-3a0c09f70320-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.023 | 0–1; higher is more readable |
| Mi | 0.802 | 0–1; higher is more readable |
| LLOC | 191 | Logical lines; fewer is more readable |
| DeepSeek V4 Pro | 15 | 0–20; mean of three runs |
| GPT-6.1 Sol | 16 | 0–20; mean of three runs |
| BTTF | 0.579 | 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. | 15878.957 | −524.006 |
| Source linesThe number of non-empty source lines. | 464 | +185.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.185 | −6.278 |
Intercept 8.87 + feature contributions = -335.814 (log-odds).
Score = sigmoid(-335.814) = 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. | 465 | −15.428 |
| Indentation frequencyHow rapidly indentation changes from line to line. | 421 | +13.825 |
| Number layout frequencyHow rapidly the number of numeric values per line changes through the code. | 421 | −9.24 |
| Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom. | 463.921 | +6.075 |
| Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right. | 87.759 | +0.612 |
| Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *. | 0.054 | +0.417 |
| 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.953 | −0.06 |
Intercept 0.07 + feature contributions = -3.729 (log-odds).
Score = sigmoid(-3.729) = 0.023.
| Score | 0.802 |
|---|
| Score | 191 |
|---|
Run 1
The code demonstrates good structure with clear class organization and logical method grouping. Nesting is generally well-managed, though some methods like _check_unique_target have deep conditional nesting. Intent is mostly clear through descriptive method names and docstrings, but some complex logic (especially in _check_unique_target and deconstruct) requires careful reading. Code length is appropriate for a Django field implementation, but some methods could be broken down further, particularly the validation methods. Action granularity is mostly one-action-per-line, though some complex conditions and comprehensions pack multiple operations. Reading flow is generally natural, with methods organized by functionality (checks, deconstruction, path info, etc.), but the imports section is lengthy and could benefit from better organization. The code follows Django conventions well, making it familiar to experienced Django developers, but the complexity of the foreign key relationship logic reduces readability for newcomers.
Run 2
The code demonstrates reasonable structure with clear method organization, but has several readability issues. The imports are numerous and some appear unused (e.g., functools, inspect, settings), adding clutter. The class definition is long with methods that vary significantly in complexity - some are simple and clear (resolve_related_fields, deconstruct), while others contain deeply nested conditionals and complex boolean logic (e.g., _check_unique_target with its nested any/frozenset checks). The `get_reverse_path_info` method contains a pointless while loop that does nothing, which is confusing. Method names and docstrings are generally descriptive and follow Django conventions. The code uses multiple import patterns (from X import, import X, cached_property) that add noise. Overall, the code is readable but verbose with some confusing sections, unnecessary complexity in validation checks, and dead code that could be removed.
Run 3
The code is generally well-organized with clear class structure, method separation, and descriptive naming. Most methods are concise with reasonable action granularity. However, there are some readability issues: deep nesting in `_check_unique_target` with multiple conditional branches makes it harder to follow; `_check_to_fields_composite_pk` includes a try/except/else structure with nested conditionals; some methods like `deconstruct` and `get_instance_value_for_fields` have moderate complexity. Excessive/dead code in `get_reverse_path_info` (a loop that counts to zero) is confusing. The import block is long but follows Django conventions. Overall this is maintainable code typical of a mature framework, though some methods could benefit from extraction or flatter structures.
Run 1
1. Code Structure: Responsibilities are logically separated into focused methods, with related properties and helpers grouped coherently. 2. Nesting: Most methods are shallow and use early returns, although validation and deconstruction contain moderately nested branches. 3. Clarity of intent: Descriptive names, docstrings, and explanatory comments clarify complex relationship behavior; Django-specific internals require background knowledge, and the pointless countdown loop in get_reverse_path_info obscures intent. 4. Code length: The class is lengthy but largely justified by its responsibilities; verbose error construction, repeated metadata access, unused imports in this excerpt, and the countdown add unnecessary bulk. 5. Action granularity: Statements generally perform one action each, and multiline calls are consistently formatted. 6. Reading flow: Method ordering and formatting support natural reading, though dense uniqueness expressions, long attribute chains, and externally defined symbols interrupt comprehension.
Run 2
Code Structure: Well organized into focused methods, with validation, field resolution, and relationship metadata clearly separated. Nesting: Mostly shallow, aided by early returns, though uniqueness checks and deconstruction contain moderately nested branches. Clarity of intent: Descriptive method names, comments, and docstrings explain complex Django behavior; abbreviated locals and framework-specific dependencies require background knowledge. The unexplained countdown loop in get_reverse_path_info obscures intent. Code length: Generally justified by functionality and informative errors, but the no-op loop and numerous unused imports in this snippet add unnecessary bulk. Action granularity: Statements generally perform one action per line, and multiline expressions are consistently formatted. Reading flow: Related methods are grouped naturally and formatting is consistent, although long validation expressions interrupt scanning. RelatedField and RECURSIVE_RELATIONSHIP_CONSTANT are not defined or imported in the supplied snippet, reducing its self-contained comprehensibility.
Run 3
Code Structure: Well-organized class with focused methods, grouped attributes, and consistent use of properties and helpers. Nesting: Mostly moderate, with guard clauses reducing depth; validation and deconstruction contain some nested branches. Clarity of intent: Descriptive method names, comments, and docstrings explain complex relationship behavior, although framework internals require Django knowledge. The unexplained countdown loop in get_reverse_path_info obscures intent, and some referenced names are undefined within the snippet. Code length: Most length supports meaningful functionality and documentation, but repeated validation patterns, extensive imports unused in this excerpt, and the pointless loop add overhead. Action granularity: Statements generally perform one action per line; multiline calls and comprehensions are formatted clearly. Reading flow: Methods follow a coherent progression from initialization and validation to field resolution, traversal, and descriptor registration. Dense constraint expressions and occasional vague local names slightly interrupt otherwise natural reading.