Sample
pyint-e0eeb17757bf-I02
Shorten method, parameter, and local names without collisions
Scores
| Method | Score | Scale |
|---|---|---|
| Posnett | 0 | 0–1; higher is more readable |
| Dorn | 0.815 | 0–1; higher is more readable |
| Mi | 0.269 | 0–1; higher is more readable |
| LLOC | 18 | Logical lines; fewer is more readable |
| DeepSeek V4 Pro | 16.67 | 0–20; mean of three runs |
| GPT-6.1 Sol | 17 | 0–20; mean of three runs |
| BTTF | 0.544 | 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.398 | −6.597 |
Intercept 8.87 + feature contributions = -7.654 (log-odds).
Score = sigmoid(-7.654) = 0.
Feature contributions
| Feature | Value | Contribution (log-odds) |
|---|---|---|
| Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right. | 94 | +0.712 |
| Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *. | 0.05 | +0.454 |
| Number layout frequencyHow rapidly the number of numeric values per line changes through the code. | 1 | +0.398 |
| 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. | 94 | −0.316 |
| 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.758 | −0.008 |
Intercept 0.07 + feature contributions = 1.481 (log-odds).
Score = sigmoid(1.481) = 0.815.
| Score | 0.269 |
|---|
| Score | 18 |
|---|
Run 1
The code is highly readable with a clear, logical structure. The class is small and focused, with a single responsibility (regex validation). Nesting is minimal—only one conditional inside the __call__ method. The intent is explicit through descriptive naming (e.g., _MatchesReValidator, match_func, pattern). Code length is concise and appropriate for the functionality. Each statement occupies its own line, and the error message construction is clear. The reading flow is natural: imports at the top, class definition, then its methods. Minor deduction: the variable name 'msg2' and 'ins' parameter are slightly ambiguous, and the docstring placement inside __call__ is unconventional, but these are minor readability issues.
Run 2
The code is well-structured and readable. It uses a frozen, slotted attrs class with a clear single responsibility: validating regex matches. The __call__ method is flat, with only one level of nesting in the conditional check. Variable names are mostly clear ('pattern', 'match_func', 'att', 'val'), though 'ins' and 'msg2' are slightly ambiguous. The error message construction is concise but could be more explicit. The class is short and focused, with one action per line in the main method. The repr override is simple and informative. Overall, the code demonstrates good action granularity, logical organization, and clarity of intent, with minor room for improvement in variable naming and error message clarity.
Run 3
The code is generally clean and readable. It uses a frozen attrs class with clear attributes and a single-purpose __call__ method, which keeps structure logical and intent obvious. Nesting is minimal, and action granularity is mostly one action per line. However, naming is slightly inconsistent: the error message variable is 'msg2' despite no 'msg1' existing, which is ambiguous. The regex pattern is accessed via self.pattern.pattern, which could confuse readers unfamiliar with compiled pattern internals. The __repr__ is concise but slightly dense. Overall, it is well-structured but has minor clarity issues that prevent a higher score.
Run 1
Code Structure: The validator class is logically organized, with attributes, validation behavior, and representation clearly separated; however, numerous unused imports distract from the small example. Nesting: A single conditional keeps the code flat and easy to follow. Clarity of intent: Class and attribute names clearly convey regex validation, but abbreviated parameters and the name 'msg2' reduce clarity; the call-method docstring explains the class design rather than the method's behavior. Code length: The implementation is concise, though unused imports and the expanded exception arguments add some visual overhead. Action granularity: Each statement performs one clear action. Reading flow: The progression from configuration to validation to representation is natural, with only minor naming and formatting distractions.
Run 2
Code Structure: The validator is logically organized into attributes, validation behavior, and representation, though numerous unused imports clutter this snippet. Nesting: Minimal nesting makes control flow easy to follow. Clarity of intent: Class and attribute names clearly convey regex validation, but abbreviated parameters (ins, att, val), the name msg2, and a docstring focused on representation rather than validation reduce clarity. Code length: The implementation is concise overall; the multiline exception construction is somewhat verbose but readable. Action granularity: Each statement performs a single clear action. Reading flow: Attributes followed by __call__ and __repr__ provide a natural progression, although additional spacing between imports and the class would improve visual separation.
Run 3
Code Structure: The small validator class logically separates attributes, validation, and representation, though numerous unused imports distract from its organization. Nesting: A single conditional keeps control flow shallow and easy to follow. Clarity of intent: The class name, regex error message, and method behavior clearly convey validation, but abbreviated parameters (ins, att, val), the name msg2, and a docstring focused on representation weaken clarity. Code length: The implementation is concise, although unused imports and the expanded exception argument list add minor clutter. Action granularity: Each statement performs one clear action, with message construction separated from raising the exception. Reading flow: Attributes precede behavior naturally, and formatting is consistent; additional spacing between imports and the class would improve visual separation.