Sample
pyint-40c783282033-I03
Replace names with length-matched meaningful but unrelated identifiers
Scores
| Method | Score | Scale |
|---|---|---|
| Posnett | 0 | 0–1; higher is more readable |
| Dorn | 0.808 | 0–1; higher is more readable |
| Mi | 0.162 | 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.516 | 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.41 | −6.616 |
Intercept 8.87 + feature contributions = -7.672 (log-odds).
Score = sigmoid(-7.672) = 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.162 |
|---|
| Score | 18 |
|---|
Run 1
The code is well-structured with clear separation of imports, class definition, and methods. Nesting is minimal, with only a single conditional that immediately raises an exception, keeping logic flat. The intent is explicit: a validator class that checks regex matching and provides a custom repr. Code length is concise and focused, with no unnecessary verbosity. Action granularity is appropriate, with one logical operation per line, though the f-string spans multiple lines for readability. Reading flow is natural, moving from class attributes to validation logic to representation. Minor deductions: the docstring is slightly redundant and the error message construction mixes the f-string with multi-line raise arguments, which could be slightly cleaner. Overall, this is highly readable code.
Run 2
The code is generally readable with a clear structure: imports are organized, the class is focused on a single responsibility, and method lengths are short. Nesting is minimal—only one conditional inside `__call__`. Intent is evident from names like `_MatchesReValidator`, `pattern`, and `match_func`. However, the error message construction is somewhat dense: the f-string contains embedded expressions that reduce clarity, and the `if not` branching could be inverted for a more straightforward flow. Action granularity is mostly good, though the f-string line packs multiple operations (string formatting and ternary-like logic). The class-level docstring is helpful but brief. Overall, the code is concise and maintainable, but the error handling block could be refactored for improved readability.
Run 3
The code is highly readable due to its logical structure, clear intent, and minimal nesting. The use of a frozen, slotted attrs class with a single responsibility is clean. The `__call__` method is flat, and the error construction is separated across lines to avoid clutter. Naming is descriptive (`_MatchesReValidator`, `match_func`, `pattern`), and the docstring clarifies why a class is used. The `__repr__` is concise and informative. Minor deductions: the unused imports (`operator`, `re`, `Pattern`, `contextmanager`, etc.) suggest incomplete cleanup, and the f-string error message is slightly dense with nested quotes, but both issues are minor and do not seriously impact readability.
Run 1
Code Structure: Imports, class attributes, validation, and representation are logically organized, though several imports appear unused in this snippet. Nesting: Very shallow, with only one conditional. Clarity of intent: The class name, regex check, and descriptive error make its purpose clear; however, parameter names such as data and group, and the variable key for an error message, are less informative. Code length: Compact overall, although the multiline exception arguments add some visual bulk and the error-message line is long. Action granularity: Each statement performs one clear action. Reading flow: Natural progression from configuration to validation and representation, slightly weakened by the __call__ docstring explaining representation customization rather than validation behavior.
Run 2
Code Structure: The validator is logically organized into attributes, validation, and representation methods, though numerous unused imports add clutter. Nesting: A single conditional keeps the code shallow and easy to follow. Clarity of intent: Class and method names clearly communicate regex validation, but generic parameter names such as data, item, and group, plus the message variable key, reduce precision. The __call__ docstring explains the callable-class design rather than the method's behavior. Code length: The implementation is concise, although the multiline exception arguments are slightly verbose. Action granularity: Each statement performs one clear action, with no compressed or compound statements. Reading flow: Attribute declaration followed by validation and representation creates a natural progression; the long error-message line and unused imports mildly interrupt readability.
Run 3
Code Structure: The small validator class is logically organized, with attributes, validation behavior, and representation clearly separated; several unused imports add clutter. Nesting: Only one conditional keeps control flow shallow. Clarity of intent: The class name, regex check, and descriptive error message communicate its purpose, though generic parameter names such as data, item, and group and the misleading name key reduce precision. Code length: The implementation is concise, but unused imports and the expanded ValueError argument list introduce minor overhead. Action granularity: Each statement performs one clear action. Reading flow: The progression from class configuration to validation and representation is natural; the docstring explains the callable-class design rather than the method's validation behavior.