Sample
pyint-e625a24fa005-I01
Remove comments and docstrings
Scores
| Method | Score | Scale |
|---|---|---|
| Posnett | 0 | 0–1; higher is more readable |
| Dorn | 0.477 | 0–1; higher is more readable |
| Mi | 0.161 | 0–1; higher is more readable |
| LLOC | 17 | Logical lines; fewer is more readable |
| DeepSeek V4 Pro | 16.67 | 0–20; mean of three runs |
| GPT-6.1 Sol | 18 | 0–20; mean of three runs |
| BTTF | 0.55 | 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. | 643.4 | −21.232 |
| Source linesThe number of non-empty source lines. | 27 | +10.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.381 | −6.571 |
Intercept 8.87 + feature contributions = -8.133 (log-odds).
Score = sigmoid(-8.133) = 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.056 | +0.402 |
| 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. | 95.964 | −0.399 |
| 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. | 27 | +0.08 |
| Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom. | 26.835 | −0.035 |
Intercept 0.07 + feature contributions = -0.091 (log-odds).
Score = sigmoid(-0.091) = 0.477.
| Score | 0.161 |
|---|
| Score | 17 |
|---|
Run 1
The code is clean and well-structured. It uses a frozen attrs class with clear attributes and a focused __call__ method. Nesting is minimal — the if block contains a single raise, and the error message construction is readable. Intent is explicit: validate a value against a regex. The class and method names are descriptive. Code length is appropriate; no unnecessary lines. Action granularity is good, with each logical step (message creation, exception raising) on its own line. Reading flow is natural: import, class definition, attributes, then method. Minor points: the empty first line inside __call__ is slightly unnecessary, and __repr__ returning an f-string with 'validator' is a bit verbose but still clear. Overall, highly readable.
Run 2
The code is generally readable with a clear purpose: a validator class for regex matching. Structure is logical, using attrs for a frozen/slotted class, and nesting is minimal. Intent is clear from naming and the error message. Code length is concise and avoids unnecessary verbosity. Action granularity is mostly one action per line, though the f-string and raise block are slightly dense. Reading flow is natural: constructor, call logic, and repr. Minor deductions: the blank line inside __call__ is awkward, the multi-line raise spreads a single action over several lines, and a type hint for match_func would improve clarity. Overall, the code is clean but could be tightened slightly.
Run 3
The code is generally readable with a clear, single-purpose class and logical structure. It has a flat nesting level (only one conditional) and concise methods. Naming is mostly clear, though `_MatchesReValidator` could be shortened. The `__call__` method is straightforward, with one action per line in the error-raising block. However, the reading flow is slightly disrupted by the blank line before the conditional and the multi-line `raise ValueError` call, which spreads a single action across several lines. The `match_func` attribute is somewhat ambiguous—it's not immediately obvious what function it expects. Overall, the code is well-organized and easy to follow, but minor clarity and formatting tweaks could improve it.
Run 1
Code Structure: The validator class logically groups its attributes, validation behavior, and representation, though several imports are unused in this snippet. Nesting: A single conditional keeps nesting shallow. Clarity of intent: Descriptive class and attribute names, along with a specific error message, make the validation purpose clear; the attrs-based attribute declarations require some library familiarity. Code length: The implementation is concise, with only minor excess whitespace and unused imports. Action granularity: Each statement performs one clear action, and the exception arguments are neatly separated. Reading flow: Imports, class attributes, validation, and representation follow a natural order; the long error-message line slightly interrupts scanning.
Run 2
Code Structure: The validator is logically organized into attributes, validation, and representation methods, though 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, together with a specific error message, clearly communicate regex validation; the externally supplied match_func requires some contextual understanding. Code length: The implementation is concise, although the multiline exception arguments and extra blank line slightly increase visual length. Action granularity: Each statement performs one clear action. Reading flow: Imports, class configuration, fields, validation, and representation follow a natural sequence, with only minor formatting distractions.
Run 3
Code Structure: The small validator class logically groups its attributes, 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 attribute names, along with a specific error message, clearly communicate regex validation; abbreviated parameters and implicit attrs-generated behavior require some familiarity. Code length: The implementation is concise, though the unused imports and extra blank line are unnecessary. Action granularity: Each statement performs a single action, and error-message construction is separated from raising the exception. Reading flow: Imports, class fields, validation logic, and representation follow a natural sequence, with minor formatting distractions.