Sample
pyint-bbeb82f65ed0-I12
Inline all eligible single-use intermediate local variables
Scores
| Method | Score | Scale |
|---|---|---|
| Posnett | 0 | 0–1; higher is more readable |
| Dorn | 0.35 | 0–1; higher is more readable |
| Mi | 0.64 | 0–1; higher is more readable |
| LLOC | 13 | Logical lines; fewer is more readable |
| DeepSeek V4 Pro | 14.67 | 0–20; mean of three runs |
| GPT-6.1 Sol | 17 | 0–20; mean of three runs |
| BTTF | 0.406 | 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. | 1099.534 | −36.285 |
| 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.656 | −6.985 |
Intercept 8.87 + feature contributions = -25.999 (log-odds).
Score = sigmoid(-25.999) = 0.
Feature contributions
| Feature | Value | Contribution (log-odds) |
|---|---|---|
| Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right. | 0 | −0.804 |
| Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code. | 22 | +0.257 |
| Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom. | 20.888 | −0.118 |
| Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *. | 0.085 | +0.112 |
| 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. | 88 | −0.062 |
| Number layout frequencyHow rapidly the number of numeric values per line changes through the code. | 21 | −0.061 |
| Indentation frequencyHow rapidly indentation changes from line to line. | 21 | −0.011 |
Intercept 0.07 + feature contributions = -0.617 (log-odds).
Score = sigmoid(-0.617) = 0.35.
| Score | 0.64 |
|---|
| Score | 13 |
|---|
Run 1
The code is reasonably structured but has readability issues. The DistanceLookupFromFunction class has a single method with moderate complexity. The `spheroid` variable uses a tuple comparison that's somewhat convoluted, making intent unclear. The method chains multiple operations like `resolve_expression` and `compiler.compile`, which compresses several actions. Variable naming is adequate but not self-documenting. The return statement combining string formatting and tuple unpacking is dense. Nesting is minimal, which is good, but the logic would benefit from breaking into smaller, named steps to improve clarity of intent and action granularity.
Run 2
The code has a relatively clear purpose and follows Django conventions, but it suffers from several readability issues. The main method is fairly flat, but the first statement uses a complex conditional expression that combines assignment and a boolean check with an 'or None' fallback, making intent somewhat ambiguous. The method performs multiple actions including conditional logic, obtaining an expression, compiling SQL, processing distance, and constructing a return tuple, which could be broken into smaller pieces. The string formatting with '%(func)s %(op)s %(dist)s' is reasonably clear, but the return tuple mixes formatting with parameter unpacking in a way that requires careful reading. Variable names are mostly good ('distance_expr', 'dist_sql', 'dist_params'), but 'spheroid' being assigned a boolean or None is confusing. Overall, it's readable for experienced Django developers familiar with the ORM internals, but could benefit from more explicit conditionals and perhaps splitting the return value construction into a separate variable.
Run 3
The code is generally readable with a clear structure and good action granularity. Each logical step—computing spheroid, building the distance expression, compiling SQL, and formatting the result—is separated into its own line, aiding clarity. Nesting is minimal, and variable names are descriptive. However, readability is reduced by the implicit boolean-to-None idiom `(... ) or None` and the packed tuple return, which obscure intent slightly. The method also assumes familiarity with Django internals, limiting accessibility for readers unfamiliar with the ORM's spatial lookup machinery. Overall, it is concise and well-organized, but a few expressions could be made more explicit to improve clarity.
Run 1
Code Structure: The method follows a logical sequence: determine spheroid use, build and compile the distance expression, process the threshold, and return SQL with parameters. Nesting: Minimal nesting keeps the logic easy to follow. Clarity of intent: Descriptive method and variable names communicate the spatial lookup purpose, although the boolean-or-None idiom and framework-specific calls require some familiarity. Code length: The implementation is concise, but several imports are unused in the shown snippet. Action granularity: Most statements perform one clear operation; the combined resolve-and-compile call adds slight density. Reading flow: Formatting and sequential organization support smooth reading, though the unshown DistanceLookupBase definition limits standalone understanding.
Run 2
Code Structure: The method logically separates spheroid selection, distance-expression construction, compilation, and SQL assembly. Several imports appear unused in this snippet, and the base class is not shown. Nesting: The code is flat, with no nested control flow. Clarity of intent: Descriptive method and variable names communicate the SQL-generation purpose, though the boolean-or-None spheroid expression and positional parameter check require interpretation. Code length: The implementation is concise without substantial repetition. Action granularity: Most statements perform one clear action, although expression resolution and compilation are combined on one line. Reading flow: Operations proceed naturally from configuration to the returned SQL and parameters; consistent formatting helps, while dictionary-based string interpolation adds minor visual complexity.
Run 3
Code Structure: The method follows a logical sequence: determine spheroid usage, construct and compile the distance expression, process the distance, and return SQL with parameters. Nesting: It is flat, with no nested control flow. Clarity of intent: Descriptive method and variable names communicate the purpose, though the boolean-or-None expression and positional spheroid check require interpretation. The undefined base class limits standalone understanding. Code length: The implementation is concise, although several imports are unused in the provided snippet. Action granularity: Most statements perform one clear step; resolving and compiling the expression on one line slightly compresses distinct actions. Reading flow: Consistent formatting and sequential processing make the method easy to follow, but a blank line before the class and brief context for spheroid handling would improve readability.