Sample
pyint-7f1a33c42b86-I05
Rewrite eligible decimal integer literals in hexadecimal notation
Scores
| Method | Score | Scale |
|---|---|---|
| Posnett | 0 | 0–1; higher is more readable |
| Dorn | 0.351 | 0–1; higher is more readable |
| Mi | 0.642 | 0–1; higher is more readable |
| LLOC | 13 | Logical lines; fewer is more readable |
| DeepSeek V4 Pro | 7.67 | 0–20; mean of three runs |
| GPT-6.1 Sol | 16 | 0–20; mean of three runs |
| BTTF | 0.291 | 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.673 | −7.01 |
Intercept 8.87 + feature contributions = -26.024 (log-odds).
Score = sigmoid(-26.024) = 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.843 | −0.118 |
| Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *. | 0.085 | +0.115 |
| 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.614 (log-odds).
Score = sigmoid(-0.614) = 0.351.
| Score | 0.642 |
|---|
| Score | 13 |
|---|
Run 1
The code has clear purpose but uses hexadecimal numeric literals (0x2, -0x1) that are needlessly obscure - standard integers would be more readable. The `spheroid` assignment combines a boolean check with None in a single line, making the logic hard to follow. The `return` statement constructs SQL and unpacks parameters across multiple lines, mixing string formatting with tuple concatenation in a dense way. While the method is concise and follows a logical sequence, the terseness sacrifices clarity. Variable names are mostly clear, and the method is reasonably flat, but the unusual literal choices and compressed expressions make intent ambiguous without deeper Django knowledge. The code would benefit from intermediate variables and standard integer notation to improve readability.
Run 2
The code struggles significantly with readability. The function defines a 'spheroid' variable with an overly complex expression using magic numbers and hexadecimal notation (0x2, -0x1), making the intent unclear. The 'distance_expr' resolution is difficult to follow and lacks intermediate explanation. The return statement uses string formatting to construct SQL, which obscures the logic. The 'process_distance' method call and tuple unpacking add to the cognitive load. While the function is relatively short, the density of complex operations, unclear variable naming, and lack of comments or clear structure result in poor readability. The action granularity is low, with multiple operations combined into single statements, and the reading flow is disrupted by the obscure conditions and formatting.
Run 3
The code has a clear single-method purpose but suffers from readability issues. The hex numeric literals (0x2, -0x1) are needlessly obscure, making comparison logic harder to follow than standard decimal/literal notation. The nested call in the second line creates a dense multi-action expression that obscures the flow of data. While the method is reasonably structured and not deeply nested, the use of tuple unpacking with formatting strings reduces clarity; string formatting with a dictionary provides less visual separation than f-strings or direct concatenation. The ternary-like assignment of spheroid is compact but not self-documenting. Additionally, the absence of docstrings or comments leaves the 'distance_expr_for_lookup' and 'resolve_expression' intentions ambiguous to a reader without deep Django internals knowledge. Overall, the code is functional and organized but could be significantly improved by replacing hex literals, breaking the expression into named intermediate variables, and using clearer string interpolation.
Run 1
Code Structure: The method is logically organized into expression construction, compilation, distance processing, and SQL assembly. Nesting: It is flat, with no nested control flow. Clarity of intent: Descriptive method and variable names communicate the lookup's purpose, but hexadecimal literals obscure ordinary indexing and length checks, and the boolean-or-None idiom requires interpretation. DistanceLookupBase is not defined or imported in the snippet, limiting context. Code length: The implementation is concise, although the displayed imports are unused. Action granularity: Most statements perform one coherent action; the compilation statement combines resolution and compilation but remains manageable. Reading flow: Execution progresses naturally toward the returned SQL and parameters, though nested calls and dictionary-based string formatting add minor cognitive overhead.
Run 2
Code Structure: The method is logically organized into expression construction, compilation, distance processing, and result assembly. Nesting: It is flat, with no nested control flow. Clarity of intent: Descriptive names communicate SQL generation for a distance lookup, but hexadecimal literals (0x2 and -0x1) obscure ordinary indexing, and 'or None' requires interpretation. The undefined base class in this excerpt limits context. Code length: The implementation is concise, although several imports appear unused in the snippet. Action granularity: Most statements perform one clear operation; expression resolution and compilation are combined on one line but remain understandable. Reading flow: Processing follows a natural sequence, and multiline formatting helps readability, though the final dictionary-based SQL interpolation is somewhat visually dense.
Run 3
Code Structure: The method is logically organized into determining spheroid usage, building and compiling a distance expression, processing the comparison distance, and returning SQL with parameters. Nesting: Minimal nesting makes the implementation easy to scan. Clarity of intent: Descriptive method and variable names communicate the purpose, but hexadecimal constants for 2 and -1 obscure simple parameter checks, and 'or None' is less explicit than a conditional. The undefined DistanceLookupBase and apparently unused imports reduce clarity in this standalone snippet. Code length: The method is concise, although the imports add unnecessary length as shown. Action granularity: Most statements perform one clear step; the compilation statement combines expression resolution and compilation but remains manageable. Reading flow: Execution follows a natural sequence, with multiline formatting keeping the SQL construction readable.