Sample
pyint-fd7fb8405e5a-SRC
Unmodified source class
Scores
| Method | Score | Scale |
|---|---|---|
| Posnett | 0 | 0–1; higher is more readable |
| Dorn | 0.808 | 0–1; higher is more readable |
| Mi | 0.165 | 0–1; higher is more readable |
| LLOC | 18 | Logical lines; fewer is more readable |
| DeepSeek V4 Pro | 17 | 0–20; mean of three runs |
| GPT-6.1 Sol | 18 | 0–20; mean of three runs |
| BTTF | 0.561 | 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. | 652.329 | −21.527 |
| 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.388 | −6.582 |
Intercept 8.87 + feature contributions = -7.639 (log-odds).
Score = sigmoid(-7.639) = 0.
Feature contributions
| Feature | Value | Contribution (log-odds) |
|---|---|---|
| Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right. | 96 | +0.744 |
| Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *. | 0.05 | +0.459 |
| 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. | 96 | −0.401 |
| 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. | 27 | +0.197 |
| 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.763 | −0.008 |
Intercept 0.07 + feature contributions = 1.434 (log-odds).
Score = sigmoid(1.434) = 0.808.
| Score | 0.165 |
|---|
| Score | 18 |
|---|
Run 1
The code is well-structured with clear separation of imports, a single cohesive class, and a focused purpose. Nesting is minimal, with only one conditional inside a method, making the logic easy to follow. Intent is unmistakable: a validator that enforces regex matching on attribute values. The class is concise, with no redundant or verbose sections. Action granularity is appropriate—most lines perform a single logical operation, though the f-string and `raise ValueError` combine multiple pieces of data, which slightly reduces readability. Reading flow is natural: imports, class definition, method logic, and representation follow a logical progression. Minor deductions come from the multi-line `raise` with mixed data and the lack of type hints, which could enhance clarity. Overall, this is highly readable, maintainable code.
Run 2
The code is highly readable due to its clear structure and concise implementation. It uses a frozen, slotted attrs class for immutability, and the validator method is flat with minimal nesting, handling a single validation action. Intent is explicit: validate a string against a regex pattern and raise a descriptive error if it fails. The `__call__` method has a single responsibility and uses clear variable names. The `__repr__` improves debuggability. Minor points: the docstring inside `__call__` is a bit sparse, and the error message formatting is slightly dense, but overall the reading flow is natural and the code is well-organized.
Run 3
The code is well-structured with a clear class-based validator implementation. It uses decorators effectively (@attrs) to reduce boilerplate. Nesting is minimal—only one level inside the __call__ method. Intent is explicit: the class name, attribute names, and error message clearly convey validation behavior. Code length is appropriate, avoiding unnecessary verbosity while maintaining clarity. Action granularity is good; each logical step (checking match, building message, raising exception) is on separate lines. Reading flow is natural: imports, class definition, attributes, core logic, and repr follow a logical order. Minor deductions: the docstring could be more informative, and the conditional check could be slightly clearer with a variable named 'is_match' instead of inverting the check.
Run 1
Code Structure: The small validator class is logically organized, with attributes, validation behavior, and representation clearly separated; several unused imports add clutter. Nesting: A single conditional keeps the code shallow and easy to follow. Clarity of intent: Descriptive class and attribute names, a helpful docstring, and an informative error message make the purpose clear, although the docstring explains the callable-class design rather than validation behavior. Code length: The implementation is concise, but the unused imports and expanded exception arguments add some unnecessary bulk. Action granularity: Each statement performs one clear action. Reading flow: The progression from stored configuration to validation and representation is natural, with consistent formatting.
Run 2
Code Structure: Imports, class attributes, validation behavior, and representation are logically organized, although several imports are unused in this snippet. Nesting: A single conditional keeps the code shallow and easy to follow. Clarity of intent: Descriptive names and an informative error message make regex validation clear; the docstring explains the callable-class design rather than the method's behavior. Code length: The implementation is concise, though the multiline exception construction is somewhat verbose. Action granularity: Each statement performs one clear action, with message creation separated from raising the exception. Reading flow: The class reads naturally from configuration through validation to representation, with decorators adding a modest dependency on framework knowledge.
Run 3
Code Structure: The validator is logically organized into attributes, validation behavior, and representation, though several imports are unused in this snippet. Nesting: A single conditional keeps control flow shallow. Clarity of intent: Descriptive class and attribute names, together with the error message, make regex validation clear; the docstring explains the callable-class design rather than the method's behavior. Code length: The implementation is concise, although the multiline exception construction is somewhat verbose. Action granularity: Each statement performs one clear action. Reading flow: The sequence is natural and easy to follow, with minor readability costs from framework-specific decorators and the long error-message line.