Sample
pyint-390561c8dbc7-I10
Deterministically remove some optional blank lines and bracketed line breaks
Scores
| Method | Score | Scale |
|---|---|---|
| Posnett | 0 | 0–1; higher is more readable |
| Dorn | 0.829 | 0–1; higher is more readable |
| Mi | 0.261 | 0–1; higher is more readable |
| LLOC | 17 | Logical lines; fewer is more readable |
| DeepSeek V4 Pro | 16.33 | 0–20; mean of three runs |
| GPT-6.1 Sol | 17 | 0–20; mean of three runs |
| BTTF | 0.624 | 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. | 578.587 | −19.093 |
| Source linesThe number of non-empty source lines. | 22 | +8.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.596 | −6.894 |
Intercept 8.87 + feature contributions = -8.317 (log-odds).
Score = sigmoid(-8.317) = 0.
Feature contributions
| Feature | Value | Contribution (log-odds) |
|---|---|---|
| Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right. | 86.913 | +0.598 |
| Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *. | 0.05 | +0.46 |
| 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. | 23 | +0.222 |
| Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom. | 21.83 | −0.105 |
| Indentation frequencyHow rapidly indentation changes from line to line. | 20 | −0.045 |
| 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. | 86.957 | −0.018 |
Intercept 0.07 + feature contributions = 1.58 (log-odds).
Score = sigmoid(1.58) = 0.829.
| Score | 0.261 |
|---|
| Score | 17 |
|---|
Run 1
The code is relatively readable with a clear structure: imports followed by a single class definition. Nesting is minimal (only a single if statement), and intent is reasonably clear from the class name and docstring. But a couple of issues lower clarity: the `__call__` method has a terse, partially redundant docstring that doesn't clearly explain the behavior; condition and error construction pack multiple operations into the if block. Action granularity could be improved by separating the length check and error raising into distinct lines. The code length is appropriately concise, but reading flow suffers slightly from the long f-string and the lack of spacing between methods. Overall it's understandable but could use minor formatting and clarity improvements.
Run 2
The code is well-structured and readable. It uses clear imports, a frozen attrs class, and a callable validator with a single, focused responsibility. Nesting is minimal—only one conditional inside the __call__ method. The intent is clear: validate a minimum length and raise a descriptive error. Action granularity is appropriate: one logical action per line (length check, message construction, raise). Reading flow is natural, moving from imports to class definition to method logic. The __repr__ method adds clarity for debugging. Minor deductions: the docstring inside __call__ could be slightly more concise, and the code could arguably be a bit shorter by using a function, but the class approach is justified for repr control. Overall, highly readable.
Run 3
The code is generally readable with clear intent and concise implementation. It has a flat structure with no nesting beyond a simple conditional, and each action is on its own line. The class uses modern attrs features with appropriate decorators and slots. However, there are minor issues: the __call__ method contains both validation and error-raising, slightly mixing action granularity. The class name and method names are descriptive, and the docstring explains the design choice. The repr is simple and informative. The imports mix standard library and relative imports without clear grouping, slightly affecting structure. Overall, the code is straightforward and easy to follow, losing points primarily for minor organizational and granularity issues.
Run 1
Code Structure: The validator is logically organized into configuration, validation, and representation methods, although several imports are unused in this snippet. Nesting: A single conditional keeps the code shallow and easy to follow. Clarity of intent: Class and attribute names clearly express minimum-length validation, and the error message is informative; however, the __call__ docstring explains the callable-class design rather than the method's validation behavior. Code length: The implementation is concise, with minor clutter from unused imports. Action granularity: Each line performs one clear action. Reading flow: Execution reads naturally from the length check to error construction and raising, followed by representation; missing blank lines between methods and limited spacing around the class slightly reduce visual readability.
Run 2
Code Structure: Imports, class configuration, validation logic, and representation are logically organized, although many imports are unused in this snippet. Nesting: A single conditional keeps the code flat and easy to follow. Clarity of intent: The class name, min_length field, and descriptive error message clearly communicate minimum-length validation; the __call__ docstring explains the callable-class design rather than the method's behavior. Code length: The implementation is concise, with little unnecessary logic. Action granularity: Each statement performs one action, and separating message construction from raising the exception improves readability. Reading flow: The progression from configuration to validation to representation is natural, but missing blank lines between methods and around the class slightly reduce visual separation.
Run 3
Code Structure: The class logically groups configuration, validation, and representation, though numerous unused imports add clutter. Nesting: A single conditional keeps the code flat and easy to follow. Clarity of intent: Descriptive names and a clear error message make the minimum-length check obvious; the callable-method docstring explains a design choice rather than its validation behavior. Code length: The implementation is concise, although unused imports and the repeated len(value) calculation are unnecessary. Action granularity: Each statement performs one clear action. Reading flow: Execution proceeds naturally from checking length to constructing an error and raising it. Missing blank lines between methods and import groups slightly weaken visual organization.