Sample
pyint-0000ca0234ab-I03
Replace names with length-matched meaningful but unrelated identifiers
Scores
| Method | Score | Scale |
|---|---|---|
| Posnett | 0 | 0–1; higher is more readable |
| Dorn | 0.831 | 0–1; higher is more readable |
| Mi | 0.26 | 0–1; higher is more readable |
| LLOC | 17 | Logical lines; fewer is more readable |
| DeepSeek V4 Pro | 15.67 | 0–20; mean of three runs |
| GPT-6.1 Sol | 16.67 | 0–20; mean of three runs |
| BTTF | 0.578 | 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. | 23 | +9.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.609 | −6.913 |
Intercept 8.87 + feature contributions = -7.937 (log-odds).
Score = sigmoid(-7.937) = 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.917 | +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. | 24 | +0.187 |
| Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom. | 22.784 | −0.091 |
| 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.958 | −0.018 |
| Indentation frequencyHow rapidly indentation changes from line to line. | 21 | −0.011 |
Intercept 0.07 + feature contributions = 1.592 (log-odds).
Score = sigmoid(1.592) = 0.831.
| Score | 0.26 |
|---|
| Score | 17 |
|---|
Run 1
The code is well-structured and clear. It uses a single-purpose class with a focused __call__ method, keeping nesting flat and action granularity appropriate. Imports are clean, the docstring explains the callable-class choice, and the error message is explicit. Minor deduction: the import list includes unused names (operator, re, Pattern, contextmanager, get_run_validators, set_run_validators, _AndValidator, and_, default_if_none, NotCallableError), which slightly reduces clarity. Overall, highly readable.
Run 2
The code is generally readable with a clear structure: imports are organized, the class is well-defined with a clear purpose, and the validator logic is straightforward. The nesting is minimal, and the action granularity is appropriate. However, there are areas for improvement: unused imports (operator, re, Pattern, contextmanager, get_run_validators, set_run_validators, and_, attrib, attrs, default_if_none, NotCallableError) and unclear naming ('mode' and 'limit' are ambiguous), which slightly reduce clarity. The docstring is helpful but could be more descriptive. Overall, it's concise and maintainable but could benefit from cleanup.
Run 3
The code demonstrates good readability. The class structure is logical, with a clear `__call__` method performing validation and a custom `__repr__` for debugging. Nesting is minimal, with only one conditional block. Intent is clear: enforce a minimum length constraint. Code length is concise, and each line typically performs a single action. The reading flow is natural, starting with imports, followed by the class definition, the core validation logic, and finishing with representation. However, minor points prevent a top score: the `mode` parameter in `__call__` is used only for error message context, which might be slightly ambiguous without additional documentation, and the error message construction combines multiple operations into one f-string, slightly reducing line-level granularity.
Run 1
Code Structure: Imports and a small validator class are logically organized, though several imports appear unused in this snippet. Nesting: A single conditional keeps nesting shallow. Clarity of intent: The class name, min_length attribute, and error message clearly express minimum-length validation, but parameter names data, mode, and limit are ambiguous; data is unused, and the docstring explains the callable-class design rather than validation behavior. Code length: The implementation is concise, with little unnecessary code beyond the unused imports. Action granularity: Each line performs one clear action, separating message construction from raising the exception. Reading flow: The attribute, validation method, and representation method follow a natural order, although clearer parameter names and more spacing between imports and the class would improve readability.
Run 2
Code Structure: The validator is logically organized into a field declaration, validation method, and representation method, although numerous unused imports add clutter. Nesting: A single conditional keeps the code flat and easy to follow. Clarity of intent: The class name and comparison clearly communicate minimum-length validation, but parameter names such as 'mode' and 'limit' are misleading, 'data' is unused, and the docstring explains the callable-class design rather than the method's behavior. Code length: The implementation is concise, though the imports are excessive for this snippet. Action granularity: Each line performs one clear action, with error-message construction separated from raising the exception. Reading flow: Declaration, validation, and representation follow a natural sequence; unfamiliar framework decorators and naming choices introduce minor friction.
Run 3
Code Structure: Imports and a small validator class are logically organized, though many imports are unused in this snippet. Nesting: A single conditional keeps the code shallow and easy to follow. Clarity of intent: The class name and minimum-length check communicate the purpose, but parameter names such as data, mode, and limit are ambiguous; the docstring explains the callable-class design rather than the validation behavior. Code length: The implementation is concise, with little unnecessary logic. Action granularity: Each statement performs one clear action, although naming the error message key is misleading. Reading flow: Declaration, validation, and representation follow a natural order. The attrs-based field declaration requires some library familiarity, and spacing around the class could be improved.