Sample
pyint-8862cf36a291-I13
Lower every eligible synchronous for loop to a while loop
Scores
| Method | Score | Scale |
|---|---|---|
| Posnett | 0 | 0–1; higher is more readable |
| Dorn | 0.815 | 0–1; higher is more readable |
| Mi | 0.382 | 0–1; higher is more readable |
| LLOC | 18 | Logical lines; fewer is more readable |
| DeepSeek V4 Pro | 16 | 0–20; mean of three runs |
| GPT-6.1 Sol | 18 | 0–20; mean of three runs |
| BTTF | 0.569 | 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. | 782.526 | −25.823 |
| Source linesThe number of non-empty source lines. | 33 | +13.2 |
| 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.439 | −6.659 |
Intercept 8.87 + feature contributions = -10.412 (log-odds).
Score = sigmoid(-10.412) = 0.
Feature contributions
| Feature | Value | Contribution (log-odds) |
|---|---|---|
| Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *. | 0.038 | +0.577 |
| 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. | 74.912 | +0.492 |
| Number layout frequencyHow rapidly the number of numeric values per line changes through the code. | 1 | +0.398 |
| Indentation frequencyHow rapidly indentation changes from line to line. | 31 | +0.335 |
| Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right. | 33.088 | −0.271 |
| Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code. | 34 | −0.167 |
| Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom. | 32.934 | +0.051 |
Intercept 0.07 + feature contributions = 1.485 (log-odds).
Score = sigmoid(1.485) = 0.815.
| Score | 0.382 |
|---|
| Score | 18 |
|---|
Run 1
The code is well-structured and readable. It uses clear imports, logical class definition, and a focused exception class with a single responsibility. The constructor builds an error message via a list of strings, which is a clean approach. Nesting is minimal (one conditional), and each line generally performs one logical action. The f-strings and multi-line string concatenation are readable, though the mixing of f-strings and plain string concatenation slightly interrupts flow. The class docstring explains intent clearly. Minor deductions: 'AssertionError' in the base classes is unusual and could confuse readers; 'form_matches' could be more descriptively named. Overall, the code is concise, well-organized, and easy to follow.
Run 2
The code has clear intent, explicit error messaging, and a logical structure with minimal nesting. The class is concise, uses type hints, and maintains one action per line. Readability is good but not excellent due to the absence of a docstring for __str__, minor inconsistencies in string formatting (mixing f-strings and concatenation), and the lack of a clear separation between building the message and assigning it. The reading flow is decent but could be improved slightly by aligning string construction or extracting helper methods. Overall, it is readable and maintainable but has small stylistic inconsistencies.
Run 3
The code is well-structured and readable. It defines a custom exception with a clear purpose: improving debug error messages for missing files in requests. The class is concise, uses type hints, and follows a logical flow—initializing error context in __init__ and presenting it via __str__. Nesting is minimal, with one conditional block. Variable names are descriptive (e.g., form_matches, buf). Action granularity is good: list building and string joining are separated clearly. The multi-line f-string concatenation improves readability despite minor visual complexity. Minor drawbacks: the error message construction could be slightly more compact, and the class name 'DebugFilesKeyError' is a bit verbose. Overall, the code is highly readable and maintainable.
Run 1
Code Structure: The exception class is logically organized, with message construction in __init__ and rendering in __str__. Nesting: Only one shallow conditional keeps complexity low. Clarity of intent: The descriptive class name, docstring, and variable names clearly explain the diagnostic purpose, although Request is not imported in the snippet and several imports are unused. Code length: The implementation is concise; most of its length is useful explanatory message text. Action granularity: Each statement performs one clear operation, and multiline string construction avoids crowded lines. Reading flow: Execution proceeds naturally from inspecting form data to constructing the message and optionally adding submitted filenames. Minor distractions include unused imports and mixing adjacent string literals with formatted strings.
Run 2
Code Structure: The exception class is logically organized, with message construction in __init__ and rendering in __str__; several unused imports add clutter. Nesting: A single conditional keeps the code shallow and easy to follow. Clarity of intent: The descriptive class name, docstring, and explicit error text clearly explain its purpose, although Request is not imported in the snippet. Code length: The implementation is compact; the lengthy message is justified by its diagnostic role. Action granularity: Statements generally perform one action each, and multiline string literals remain readable. Reading flow: Execution proceeds naturally from collecting form values to building the message and storing it, with minor readability costs from abbreviated names such as buf and x.
Run 3
Code Structure: The exception class is logically organized, with message construction in __init__ and rendering in __str__; unused imports add clutter. Nesting: Only one conditional keeps the code shallow and easy to follow. Clarity of intent: The descriptive class name, docstring, and explicit error message clearly explain its purpose, although Request is not imported in the snippet and buf is a generic name. Code length: The implementation is concise; most of its length comes from useful diagnostic text. Action granularity: Statements generally perform one action each, with no compressed multi-statement lines. Reading flow: The sequence naturally progresses from retrieving form values to building the message, adding optional details, and storing the result. Adjacent string literals require minor attention but keep long text manageable.