Sample
pyint-86bf33e13b9c-I12
Inline all eligible single-use intermediate local variables
Scores
| Method | Score | Scale |
|---|---|---|
| Posnett | 0 | 0–1; higher is more readable |
| Dorn | 0.705 | 0–1; higher is more readable |
| Mi | 0.495 | 0–1; higher is more readable |
| LLOC | 19 | Logical lines; fewer is more readable |
| DeepSeek V4 Pro | 15 | 0–20; mean of three runs |
| GPT-6.1 Sol | 18 | 0–20; mean of three runs |
| BTTF | 0.74 | 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. | 722.67 | −23.848 |
| Source linesThe number of non-empty source lines. | 29 | +11.6 |
| 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.687 | −7.03 |
Intercept 8.87 + feature contributions = -10.409 (log-odds).
Score = sigmoid(-10.409) = 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 |
| Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *. | 0.043 | +0.522 |
| 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. | 75.9 | +0.45 |
| 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. | 29 | +0.266 |
| Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code. | 30 | −0.026 |
| Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom. | 28.896 | −0.006 |
Intercept 0.07 + feature contributions = 0.87 (log-odds).
Score = sigmoid(0.87) = 0.705.
| Score | 0.495 |
|---|
| Score | 19 |
|---|
Run 1
The code imports many modules that are not used within the provided snippet, which adds clutter and obscures the actual functionality. The class definition is short and follows a standard validator pattern, which is good, but the purpose is only clear if the reader knows the BaseValidator API. The message uses ngettext_lazy correctly for pluralization, but the string format is verbose. The nesting is minimal and each method contains a single action, which supports readability. Overall, the structure is logical but the unused imports and lack of surrounding context reduce clarity. The code is concise in length, but the presence of irrelevant imports makes it less readable than it could be. Action granularity is appropriate, and reading flow is natural once the validator pattern is understood.
Run 2
The code is well-structured and follows Django's established patterns for validators. It builds on a clear base class (BaseValidator), with intent expressed cleanly through overriding just three methods. Nesting is minimal, with no deeply nested blocks. The message handling with ngettext_lazy for pluralization is a standard, elegant approach, and the class decorator @deconstructible is idiomatic. Each method carries a single responsibility and is concise, so action granularity is appropriate. The reading flow is natural, moving from imports through class definition to method overrides. Some minor deductions stem from the fact that understanding certain details—like the relationship to BaseValidator or the mechanics of _lazy_re_compile and MAX_URL_LENGTH imports—assumes prior knowledge of Django internals. Additionally, the unused imports (math, ipaddress, re, Path, urlsplit, etc.) slightly reduce clarity for readers not familiar with the wider module context. Overall, it's highly readable for Django developers, but slightly less so for general audiences.
Run 3
The code is well-structured with clear imports and a logical class definition. It uses a decorator and inheritance effectively, and the class has a clear purpose: validating minimum length. Nesting is minimal, and intent is obvious from the class name and clean method. Lines are concise and readable, though the ngettext_lazy arguments span multiple lines, which slightly reduces flow. Action granularity is mostly one action per line, except for the message definition. The reading flow is natural and maintainable, but the multi-line string and function call make it slightly harder to scan quickly. Overall, highly readable.
Run 1
Code Structure: The validator is logically organized, with class metadata followed by two small methods, although BaseValidator is not defined or imported in the snippet. Nesting: Minimal nesting makes the code easy to scan. Clarity of intent: The class name, validation message, and method implementations clearly communicate minimum-length validation; generic parameter names slightly reduce clarity. Code length: The implementation is concise, but numerous unused imports add clutter. Action granularity: Each statement performs a single clear action, and the multiline message is neatly formatted. Reading flow: The progression from imports to class configuration to behavior is natural, though import grouping and an additional blank line before the class would improve presentation.
Run 2
Code Structure: The validator class is logically organized, with configuration attributes followed by short methods; however, BaseValidator is not imported or defined in the snippet. Nesting: Minimal nesting makes the code easy to scan. Clarity of intent: The class name, error message, and comparison clearly communicate minimum-length validation, although parameter names a, b, and x are generic. Code length: The implementation is concise, but numerous unused imports add clutter. Action granularity: Each statement performs a single clear action, and the multiline message improves legibility. Reading flow: Configuration-to-behavior ordering is natural; the irrelevant imports and missing base-class context slightly interrupt understanding.
Run 3
Code Structure: A well-organized validator class separates configuration from comparison and length extraction, although BaseValidator is not defined or imported in the snippet and several imports are unused. Nesting: Minimal nesting makes the code easy to scan. Clarity of intent: The class name, validation messages, and method bodies clearly communicate minimum-length validation, though parameter names a, b, and x are generic. Code length: The implementation is concise, but unused imports add clutter. Action granularity: Each statement performs one clear action; the multiline message declaration remains a single cohesive operation. Reading flow: Imports, class configuration, and short methods follow a natural sequence, with only minor distractions from extraneous imports and the missing base-class context.