Sample
pyint-553528dcf51e-I12
Inline all eligible single-use intermediate local variables
Scores
| Method | Score | Scale |
|---|---|---|
| Posnett | 0.001 | 0–1; higher is more readable |
| Dorn | 0.8 | 0–1; higher is more readable |
| Mi | 0.401 | 0–1; higher is more readable |
| LLOC | 17 | Logical lines; fewer is more readable |
| DeepSeek V4 Pro | 16 | 0–20; mean of three runs |
| GPT-6.1 Sol | 17 | 0–20; mean of three runs |
| BTTF | 0.571 | 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. | 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.385 | −6.578 |
Intercept 8.87 + feature contributions = -7.34 (log-odds).
Score = sigmoid(-7.34) = 0.001.
Feature contributions
| Feature | Value | Contribution (log-odds) |
|---|---|---|
| Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right. | 97 | +0.761 |
| 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. | 97 | −0.443 |
| Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *. | 0.052 | +0.438 |
| 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.684 | −0.009 |
Intercept 0.07 + feature contributions = 1.385 (log-odds).
Score = sigmoid(1.385) = 0.8.
| Score | 0.401 |
|---|
| Score | 17 |
|---|
Run 1
The code is highly readable with clear structure and intent. It uses a frozen, slotted attrs class for an immutable validator, which is logical and concise. The `__call__` method is flat, with a single conditional and a clear error message. Naming is explicit (`_MatchesReValidator`, `match_func`, `pattern`). Action granularity is appropriate—each significant step is on its own line. The only minor deductions are for an unnecessary blank line inside the `if` block and the slightly verbose f-string, which could be clearer with line breaks. Overall, the reading flow is natural and the logic is easy to follow.
Run 2
The code is generally readable with clear structure and purpose. It uses a frozen attrs class as a validator, and the docstring explains the design choice. Naming is descriptive (_MatchesReValidator, match_func). The __call__ method is flat and concise, with one primary action plus error construction. The __repr__ is clear. Minor deductions: an unnecessary blank line inside __call__, and the error message f-string is slightly dense. The import block is somewhat cluttered with unused imports (operator, re, Pattern, contextmanager, get_run_validators, etc.), which reduces clarity. Overall, intent is understandable and flow is natural, but tidier imports and minor formatting would improve readability.
Run 3
The code is generally readable with a clear class structure, minimal nesting, and good use of type hints and docstrings. It follows logical organization with a single responsibility for the class. The blank line after the conditional is slightly awkward, and the error message formatting is dense but acceptable. The use of attrs decorators keeps the code concise. However, the purpose of match_func and pattern attributes could be clearer with more descriptive names or type annotations. The repr method is straightforward. Overall, the code demonstrates good readability with minor improvements possible in formatting and naming clarity.
Run 1
Code Structure: The validator is logically organized into attributes, validation behavior, and representation, although numerous unused imports add clutter. Nesting: A single conditional keeps nesting shallow. Clarity of intent: Descriptive class and attribute names make regex validation clear, but the __call__ docstring explains the callable-class design rather than validation behavior. Code length: The implementation is concise, though redundant parentheses around the error message and an empty line before the raise are unnecessary. Action granularity: Each statement performs one clear action, and the exception arguments are neatly separated. Reading flow: Methods follow a natural order, but import clutter, limited spacing before the class, and the stray blank line slightly interrupt readability.
Run 2
Code Structure: The validator class is logically organized, with attributes, validation behavior, and representation clearly separated, though several imports are unused in this snippet. Nesting: A single conditional keeps nesting shallow. Clarity of intent: Class and attribute names make regex validation clear, but the __call__ docstring explains the callable-class design rather than the method's behavior. Code length: The implementation is concise; redundant parentheses around the error message and an extra blank line add minor clutter. Action granularity: Each statement performs one clear action, and the exception arguments are laid out separately. Reading flow: The progression from configuration to validation to representation is natural, although the blank line before raise slightly interrupts it.
Run 3
Code Structure: The validator is logically organized into attributes, validation behavior, and representation, though several unused imports add clutter. Nesting: A single conditional keeps the code shallow and easy to follow. Clarity of intent: Class and attribute names clearly communicate regex validation, and the error message is informative; however, the __call__ docstring explains the class design rather than the method's behavior. Code length: The implementation is concise, but unnecessary parentheses around the error-message f-string and an extra blank line reduce polish. Action granularity: Each statement performs one clear action, and the multiline exception arguments are readable. Reading flow: The progression from state to validation to representation is natural, with minor distractions from import clutter and inconsistent spacing.