Sample
pyint-834df07fd5b0-I12
Inline all eligible single-use intermediate local variables
Scores
| Method | Score | Scale |
|---|---|---|
| Posnett | 0 | 0–1; higher is more readable |
| Dorn | 0.788 | 0–1; higher is more readable |
| Mi | 0.806 | 0–1; higher is more readable |
| LLOC | 16 | Logical lines; fewer is more readable |
| DeepSeek V4 Pro | 15.33 | 0–20; mean of three runs |
| GPT-6.1 Sol | 17 | 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. | 774.702 | −25.565 |
| Source linesThe number of non-empty source lines. | 21 | +8.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.661 | −6.992 |
Intercept 8.87 + feature contributions = -15.287 (log-odds).
Score = sigmoid(-15.287) = 0.
Feature contributions
| Feature | Value | Contribution (log-odds) |
|---|---|---|
| Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right. | 91 | +0.664 |
| 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.274 |
| Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code. | 22 | +0.257 |
| 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. | 90.955 | −0.187 |
| Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom. | 20.815 | −0.119 |
| Indentation frequencyHow rapidly indentation changes from line to line. | 20 | −0.045 |
Intercept 0.07 + feature contributions = 1.312 (log-odds).
Score = sigmoid(1.312) = 0.788.
| Score | 0.806 |
|---|
| Score | 16 |
|---|
Run 1
The code is concise, well-structured, and easy to follow. Imports are organized and the class has a clear purpose. There is minimal nesting, with only one comprehension in the as_sql method, and the flow is logical. Naming conventions are descriptive (ExtraWhere, sqls, params), and the docstring-like comment adds context. The main weakness is that the as_sql signature includes unused parameters (compiler, connection) with a trailing blank line, which slightly obscures intent, and the variable `sqls` is slightly ambiguous but still understandable. Overall, it is highly readable.
Run 2
The code is highly readable. It has a clear, logical structure with a single, well-named class (`ExtraWhere`). Nesting is minimal; the only semi-complex part is the `as_sql` method’s list comprehension that wraps SQL fragments in parentheses and joins them with 'AND'. The intent is unambiguous — a wrapper for extra SQL conditions with parameters. Length is appropriate, with no redundant code. Actions are granular: attributes are set in one line, and the return statement combines logically-related operations (wrapping and joining) in one readable expression. The reading flow is natural, aided by the concise docstring-style comment explaining the 'black box' assumption. Minor deductions: `sqls` and `params` type hints could improve clarity, and the double parentheses in the join expression are slightly redundant, slightly affecting visual noise. Overall, this is clean, maintainable code.
Run 3
The code is relatively concise and each line performs a single action, but several readability issues exist. The imports are mostly unused (operator, reduce, EmptyResultSet, FullResultSet, Case, When, Mod, Exact, tree, cached_property), creating ambiguity about intent. The ExtraWhere class has two class attributes without explanations, and the comment is minimal. The as_sql method uses a nested tuple/list construction in one line, combining list comprehension with string formatting and parameter expansion, which hurts readability. The flow is natural but could be clearer with better documentation and simplified expression construction.
Run 1
Code Structure: The class is logically organized, with metadata, initialization, and SQL rendering clearly separated, though many imports are unused in this snippet. Nesting: Control flow is flat; the only comprehension is straightforward. Clarity of intent: The class name, method names, and comment explain its SQL-fragment role, although sqls is a slightly vague identifier. Code length: The implementation is concise, but redundant parentheses and unused imports add clutter. Action granularity: Assignments each occupy their own line; the return statement combines SQL formatting, joining, and parameter normalization, making it mildly dense. Reading flow: The sequence is natural and easy to follow, with minor formatting distractions from the blank line inside as_sql and the long return expression.
Run 2
Code Structure: The small class logically groups SQL fragments, parameters, and SQL rendering, though numerous unused imports add clutter. Nesting: Minimal nesting makes the code easy to scan. Clarity of intent: Names and the comment communicate the purpose, but the comment's assumptions and class flags require Django context. Code length: The implementation is concise, although the import list and redundant parentheses are unnecessary. Action granularity: Most lines perform one action; the return statement combines SQL formatting, joining, and parameter normalization. Reading flow: Initialization naturally precedes rendering, but the extra blank line inside as_sql and dense return expression slightly disrupt readability.
Run 3
Code Structure: The small class logically groups metadata, initialization, and SQL rendering, although numerous unused imports add clutter. Nesting: There is no deep nesting; the comprehension is straightforward. Clarity of intent: Names and the comment make the SQL-fragment wrapper's purpose reasonably clear, though the unused compiler and connection arguments may require framework context. Code length: The implementation is concise, but redundant parentheses, unused imports, and an empty line inside as_sql reduce polish. Action granularity: Initialization uses one assignment per line; the return statement combines SQL assembly and parameter normalization but remains manageable. Reading flow: The class reads naturally from attributes to initialization to output, with minor formatting distractions.