Sample
pyint-e2d436f63449-SRC
Unmodified source class
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 | 14.33 | 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 well-structured with a clear, documented purpose. It uses a single class with one method, moderate nesting (only one level), and natural reading flow. The inline comments explain the MySQL/MariaDB-specific optimization, making intent clear. Action granularity is mostly good, with one primary operation per line, though some lines combine logic (e.g., the where/having/qualify split assignment). Variable names are descriptive. The only minor readability issues are the slightly dense comment block and the try/except/else block, which adds a small amount of cognitive load. Overall, it is concise, modular, and easy to follow.
Run 2
The code is logically structured and follows a clear purpose, but readability is hindered by dense logic and a lengthy comment. The method has moderate nesting (if/else within try/except) and splits a key operation across multiple lines, which impacts clarity. The initial comment is helpful but verbose. The condition for falling back to super().as_sql() is not immediately obvious due to combined checks. Variable names are clear, and actions are mostly one per line, but the overall flow requires careful parsing to understand why the custom SQL is built. The code is concise but could benefit from breaking the logic into smaller helper methods or clearer conditionals to improve reading flow.
Run 3
The code is reasonably structured and mostly readable, but it has some clarity and flow issues. The initial comment is helpful for understanding why custom SQL is generated. However, the logic branches early with a condition that has a comment, which slightly disrupts reading flow. The variable names are clear, and each action is generally on its own line, but the try/except block with `pass` and the subsequent `else` adds mild cognitive overhead. The `result` list construction is straightforward, but the mixed use of string formatting and list extension makes the final SQL assembly slightly harder to follow. Nesting is shallow, which is good. Overall, the code is understandable but could be more polished for readability, especially in the exception handling and SQL assembly sections.
Run 1
Code Structure: Imports and a single focused compiler override provide clear organization. Nesting: An early return keeps control flow mostly flat; the try/except/else adds only modest complexity. Clarity of intent: Descriptive identifiers and useful comments explain the SQL optimization and fallback conditions, though Django compiler knowledge is needed to understand the details. Code length: The implementation is concise, with comments proportionate to the non-obvious behavior. Action granularity: Each statement performs one clear operation; tuple unpacking naturally groups related results. Reading flow: The method progresses logically from checking applicability to assembling SQL, compiling filters, and returning SQL with parameters. Minor readability limitations include dense framework-specific expressions, an implicit no-filter path through the empty exception handler, and unused imported compiler classes in this excerpt.
Run 2
Code Structure: The compiler subclass contains a focused method organized into eligibility checks, SQL construction, condition compilation, and return. Nesting: An early return keeps the main path flat; the try/except/else adds only modest complexity. Clarity of intent: Descriptive names and useful comments explain both the optimization and its limitations, though Django compiler internals require domain knowledge. Code length: The implementation is concise, with comments providing relevant context rather than unnecessary detail. Action granularity: Statements generally perform one action per line, and multiline expressions improve readability. Reading flow: Execution progresses naturally from checking applicability to assembling the query and parameters. Minor drawbacks include several imports unused in the shown snippet, limited spacing before the class definition, and an exception handler whose silent pass requires understanding FullResultSet.
Run 3
Code Structure: The compiler subclass and single overridden method are logically organized, with a clear fallback followed by SQL construction. Nesting: Shallow conditionals and a try/except/else keep complexity low; the early return avoids additional nesting. Clarity of intent: Descriptive names and comments explain both the optimization and its SQL limitations, although Django compiler knowledge is needed to fully understand the implementation. Code length: Concise for the functionality, with useful rather than redundant comments; several imports are unused in this snippet. Action granularity: Statements generally perform one operation per line, and multiline calls improve readability. Reading flow: The method naturally progresses from checking compatibility to assembling clauses and returning SQL with parameters. The silent FullResultSet handling and framework-specific terminology slightly reduce accessibility.