Sample
pyint-028b77ecd31f-I01
Remove comments and docstrings
Scores
| Method | Score | Scale |
|---|---|---|
| Posnett | 0 | 0–1; higher is more readable |
| Dorn | 0.54 | 0–1; higher is more readable |
| Mi | 0.247 | 0–1; higher is more readable |
| LLOC | 16 | Logical lines; fewer is more readable |
| DeepSeek V4 Pro | 16 | 0–20; mean of three runs |
| GPT-6.1 Sol | 17.67 | 0–20; mean of three runs |
| BTTF | 0.602 | 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. | 570.029 | −18.811 |
| Source linesThe number of non-empty source lines. | 21 | +8.4 |
| 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.623 | −6.934 |
Intercept 8.87 + feature contributions = -8.475 (log-odds).
Score = sigmoid(-8.475) = 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 |
| Number layout frequencyHow rapidly the number of numeric values per line changes through the code. | 1 | +0.398 |
| Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *. | 0.057 | +0.39 |
| Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code. | 22 | +0.257 |
| Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom. | 20.784 | −0.119 |
| 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. | 87 | −0.02 |
| Indentation frequencyHow rapidly indentation changes from line to line. | 21 | −0.011 |
Intercept 0.07 + feature contributions = 0.162 (log-odds).
Score = sigmoid(0.162) = 0.54.
| Score | 0.247 |
|---|
| Score | 16 |
|---|
Run 1
The code is generally well-structured and readable. It follows clear conventions with a single class definition, focused imports, and minimal nesting. The class name indicates intent clearly, and the __call__ method contains one conditional block that handles validation—flat and easy to follow. The error message uses f-strings concisely, and __repr__ is informative. The only minor deductions are the blank line after the function definition line (stylistic) and the slightly redundant import of Pattern along with re, which could be streamlined. Overall, intent is unambiguous, actions are granular, and reading flow is natural.
Run 2
The code is highly readable. It has a clear, logical structure with a single frozen/slotted attrs class. Nesting is minimal (one `if` inside `__call__`). Intent is unambiguous: a validator enforcing maximum length. Code length is concise with no unnecessary lines; even the blank line before the `if` adds clarity. Action granularity is good, with dedicated lines for the condition, message construction, and raise. Reading flow is natural: imports, class definition, method logic, then repr. Minor note: imports `operator`, `re`, `Pattern`, `get_run_validators`, etc. are unused and could be removed, but they don't hinder readability.
Run 3
The code is relatively readable due to its simple structure and clear single-method class. The validation logic is straightforward and the error message is descriptive. However, readability is reduced by several factors: the imports are not used, the blank line at the start of `__call__` is unnecessary and disrupts flow, and `inst` is an unused parameter with no leading underscore to signal intent. The `repr=False` in the decorator is also unclear without additional context. Overall, it is functional but could be cleaner.
Run 1
Code Structure: The validator is logically organized into configuration, validation, and representation methods, although numerous unused imports distract from the small class. Nesting: A single conditional keeps nesting shallow. Clarity of intent: The class name, max_length attribute, and informative error message clearly communicate the length constraint; abbreviated parameters such as inst and attr are less explicit. Code length: The implementation is concise, but unused imports and an extra blank line add unnecessary clutter. Action granularity: Each statement performs one clear action, with message construction separated from raising the exception. Reading flow: The class reads naturally from its limit declaration through validation to representation, though missing spacing between imports and the class decorator slightly weakens presentation.
Run 2
Code Structure: The validator is logically organized into a field, validation method, and representation method; several unused imports add clutter. Nesting: A single conditional keeps the code shallow and easy to follow. Clarity of intent: Descriptive class and field names, a straightforward length check, and an informative error message clearly convey the purpose, although framework decorators and abbreviated parameter names require some familiarity. Code length: The implementation is concise, with minor excess from unused imports and a blank line. Action granularity: Each statement performs one clear action. Reading flow: The progression from configuration to validation to representation is natural, though import clutter slightly distracts from the small implementation.
Run 3
Code Structure: The validator is logically organized into configuration, validation, and representation methods, though several imports are unused in this snippet. Nesting: A single conditional keeps the code shallow and easy to follow. Clarity of intent: Descriptive class and attribute names, a straightforward length check, and an informative error message clearly communicate its purpose; the attrs framework requires some familiarity. Code length: The implementation is concise, with minor clutter from unused imports and an unnecessary blank line. Action granularity: Each statement performs one clear action. Reading flow: The sequence from the length limit to validation and representation is natural, with consistent formatting overall.