Sample
pyint-fc2df7c20a74-I10
Deterministically remove some optional blank lines and bracketed line breaks
Scores
| Method | Score | Scale |
|---|---|---|
| Posnett | 0 | 0–1; higher is more readable |
| Dorn | 0.599 | 0–1; higher is more readable |
| Mi | 0.023 | 0–1; higher is more readable |
| LLOC | 20 | Logical lines; fewer is more readable |
| DeepSeek V4 Pro | 12.67 | 0–20; mean of three runs |
| GPT-6.1 Sol | 17 | 0–20; mean of three runs |
| BTTF | 0.47 | 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. | 1252.248 | −41.324 |
| Source linesThe number of non-empty source lines. | 31 | +12.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.73 | −7.095 |
Intercept 8.87 + feature contributions = -27.149 (log-odds).
Score = sigmoid(-27.149) = 0.
Feature contributions
| Feature | Value | Contribution (log-odds) |
|---|---|---|
| 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. | 128.969 | −1.797 |
| Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right. | 129 | +1.277 |
| Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *. | 0.052 | +0.436 |
| Number layout frequencyHow rapidly the number of numeric values per line changes through the code. | 1 | +0.398 |
| Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code. | 32 | −0.097 |
| Indentation frequencyHow rapidly indentation changes from line to line. | 24 | +0.093 |
| Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom. | 30.862 | +0.022 |
Intercept 0.07 + feature contributions = 0.401 (log-odds).
Score = sigmoid(0.401) = 0.599.
| Score | 0.023 |
|---|
| Score | 20 |
|---|
Run 1
The code has a clear purpose and handles a specific edge case with a helpful comment. However, readability is undermined by inconsistent formatting (e.g., misaligned continuation on the first line of the `split_having_qualify` call), which creates visual clutter. Nesting is minimal, and the reading flow is mostly logical, but the long `if` condition and dense SQL-related string formatting reduce clarity. Action granularity is mostly one action per line, though the initial call formatting is confusing. The code is concise overall but the tangled first statement and lack of consistent indentation make it harder to parse than necessary. Improving line breaks and aligning parameters would significantly enhance readability.
Run 2
The code has a logical structure and clear purpose, but several readability issues reduce its score. The main problems are: (1) inconsistent indentation in the `split_having_qualify` call, making the argument continuation visually confusing; (2) multi-line method call formatting lacks clear visual separation between arguments; (3) the inline comments are helpful but the comment block is lengthy relative to the code; (4) variable reuse of `params` from `from_sql` before being extended by `where_params` creates ambiguity about its origin. Positive aspects: flat nesting (only one level for the try/except and if/else), one action per line in most cases, and clear naming. The reading flow is somewhat disrupted by the formatting issue and the implicit dependency on `params` from `get_from_clause()`. Overall, the intent is understandable, but the formatting and variable scoping prevent higher readability.
Run 3
The code is moderately readable. It uses clear variable names and has some helpful comments explaining the 'why' behind the logic. However, readability suffers from a few issues. The split_having_qualify call has awkward indentation and line breaking, which disrupts the reading flow. The comment block is informative but verbose, making it slightly longer than necessary. Action granularity is mostly one action per line, but the split_having_qualify line packs too much into one line. The try/except/else structure adds moderate nesting, though it is straightforward. Overall, the intent is clear, but formatting and line structure could be improved for better readability.
Run 1
Code Structure: Imports and a single compiler override are logically organized, with a clear fallback followed by SQL construction. Nesting: Shallow conditionals and a try/except/else keep complexity manageable. Clarity of intent: Descriptive names and comments explain the database-specific optimization and its restrictions, though understanding compiler internals requires Django knowledge. Code length: Concise, with comments that justify non-obvious behavior rather than repeat it. Action granularity: Statements generally perform one action per line. Reading flow: Execution proceeds naturally from eligibility checking to query assembly and return, but excessive spacing in the split_having_qualify call disrupts readability. The empty exception handler also requires readers to infer that a full result set needs no WHERE clause.
Run 2
Code Structure: The compiler override is logically organized into eligibility checks, SQL construction, condition compilation, and return. Nesting: An early return keeps nesting shallow; the try/except/else block is straightforward. Clarity of intent: Descriptive names and comments clearly explain the optimized DELETE syntax and its limitations, though Django compiler knowledge is needed. Code length: The implementation is concise, with useful rather than excessive commentary. Action granularity: Statements generally perform one action per line, and SQL assembly is separated into clear steps. Reading flow: Execution proceeds naturally from validation to construction, but the excessive whitespace and misplaced argument on the split_having_qualify call interrupt readability. Overall, the code is highly readable aside from that formatting defect and some unavoidable framework-specific complexity.
Run 3
Code Structure: Imports and a single compiler override are logically organized, with SQL construction proceeding in clear stages. Nesting: An early return keeps control flow flat; the try/except/else adds only modest complexity. Clarity of intent: Descriptive names and comments explain the database-specific optimization and fallback conditions, although understanding Django compiler internals requires domain knowledge. Code length: The implementation is concise, and the explanatory comments are relevant rather than redundant. Action granularity: Statements generally perform one action per line, making query assembly easy to follow. Reading flow: The progression from eligibility checks to FROM and WHERE construction and final output is natural. However, excessive spacing on the split_having_qualify call and insufficient separation before the class definition reduce formatting consistency.