Sample
pyint-f7d3062cfe8f-I05
Rewrite eligible decimal integer literals in hexadecimal notation
Scores
| Method | Score | Scale |
|---|---|---|
| Posnett | 0 | 0–1; higher is more readable |
| Dorn | 0.828 | 0–1; higher is more readable |
| Mi | 0.182 | 0–1; higher is more readable |
| LLOC | 20 | Logical lines; fewer is more readable |
| DeepSeek V4 Pro | 15.67 | 0–20; mean of three runs |
| GPT-6.1 Sol | 18 | 0–20; mean of three runs |
| BTTF | 0.528 | 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. | 32 | +12.8 |
| 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.732 | −7.098 |
Intercept 8.87 + feature contributions = -26.752 (log-odds).
Score = sigmoid(-26.752) = 0.
Feature contributions
| Feature | Value | Contribution (log-odds) |
|---|---|---|
| Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right. | 85 | +0.567 |
| Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *. | 0.052 | +0.435 |
| 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. | 33 | −0.132 |
| Indentation frequencyHow rapidly indentation changes from line to line. | 25 | +0.128 |
| 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. | 84.939 | +0.068 |
| Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom. | 31.837 | +0.035 |
Intercept 0.07 + feature contributions = 1.569 (log-odds).
Score = sigmoid(1.569) = 0.828.
| Score | 0.182 |
|---|
| Score | 20 |
|---|
Run 1
The code is moderately readable. Structure is logical with a clear single-method class. Nesting is shallow with only one try/except block, and action granularity is mostly one action per line. However, the intent is somewhat obscured by domain-specific Django/MySQL knowledge and a dense explanatory comment. Variable names like 'result' and 'params' are generic, and the mixed string formatting styles (%s and f-strings) slightly disrupt flow. The conditional logic requires understanding of SQL compiler internals, making it less accessible to non-specialists.
Run 2
The code is generally readable with a clear structure and logical flow. It starts with straightforward imports and a single class overriding one method. The method begins with a helpful comment explaining the rationale for the custom SQL generation, which strongly improves clarity of intent. The logic branches only once, avoiding deep nesting, and the path for non-aggregate queries remains flat and easy to follow. Lines are mostly self-contained, though some calls like split_having_qualify and join reduce compactness. The exception handling for FullResultSet is concise but slightly opaque without additional context. One minor issue is the string formatting using the old % operator, which is a bit less natural than modern f-strings but acceptable in legacy Django code. Overall, the method balances conciseness and explicitness well, with clear separation between SQL fragment construction, parameter management, and branch logic.
Run 3
The code is well-structured and readable due to its clear intent, logical organization, and effective use of comments to explain non-obvious behavior. The single method is concise, avoids unnecessary nesting, and maintains a natural reading flow. Action granularity is appropriate—each logical step is separated into distinct lines or blocks. The only minor deductions are for slight complexity in understanding the SQL generation logic and the implicit reliance on superclass behavior, which requires some domain knowledge of Django internals.
Run 1
Code Structure: Imports and a single focused compiler override are logically organized, with SQL assembled in clear stages. Nesting: An early return keeps control flow mostly flat; the try/except/else adds only modest complexity. Clarity of intent: Descriptive names and detailed comments explain both the database-specific optimization and fallback conditions, though Django compiler knowledge is needed to understand the implementation fully. Code length: The method is concise without omitting important context; several imports are unused in the provided snippet. Action granularity: Statements generally perform one action each, making individual steps easy to follow. Reading flow: The sequence naturally progresses from checking eligibility to building, filtering, and returning SQL. The silent FullResultSet exception handling is slightly less explicit, but the overall flow remains readable.
Run 2
Code Structure: A single, focused method organizes SQL generation into clear stages: eligibility checking, FROM construction, WHERE compilation, and final assembly. Nesting: Shallow control flow and an early return keep the main path easy to follow. Clarity of intent: Descriptive identifiers and useful comments explain both the optimization and its limitations, though Django compiler internals and FullResultSet handling require domain knowledge. Code length: Concise implementation with comments proportional to the complexity; several imports are unused in the shown snippet. Action granularity: Each statement performs one clear operation, with no compressed multi-action lines. Reading flow: Execution proceeds naturally from checking constraints to building and returning the query. The try/except/else introduces a small interruption but clearly separates the full-result-set case from WHERE generation.
Run 3
Code Structure: The method is logically organized into condition analysis, fallback selection, SQL construction, and return. Nesting: An early return keeps control flow flat, with only a shallow try/except/else block. Clarity of intent: Descriptive names and useful comments explain both the optimization and its limitations, though Django compiler knowledge is needed to understand some details. Code length: The implementation is concise and avoids redundant logic; the comments are proportionate to the specialized behavior. Action granularity: Each statement performs a distinct operation, and tuple unpacking naturally groups related results. Reading flow: Execution proceeds naturally from eligibility checks through clause assembly to the final SQL and parameters. Minor readability drawbacks include imports unused within the shown snippet and the implicit meaning of passing on FullResultSet.