Sample
pyint-5c6d1985fa92-I03
Replace names with length-matched meaningful but unrelated identifiers
Scores
| Method | Score | Scale |
|---|---|---|
| Posnett | 0 | 0–1; higher is more readable |
| Dorn | 0.85 | 0–1; higher is more readable |
| Mi | 0.575 | 0–1; higher is more readable |
| LLOC | 20 | Logical lines; fewer is more readable |
| DeepSeek V4 Pro | 9.67 | 0–20; mean of three runs |
| GPT-6.1 Sol | 15.33 | 0–20; mean of three runs |
| BTTF | 0.474 | 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. | 737.534 | −24.339 |
| Source linesThe number of non-empty source lines. | 31 | +12.4 |
| 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.375 | −6.562 |
Intercept 8.87 + feature contributions = -9.63 (log-odds).
Score = sigmoid(-9.63) = 0.
Feature contributions
| Feature | Value | Contribution (log-odds) |
|---|---|---|
| Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right. | 88 | +0.615 |
| 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 |
| Indentation frequencyHow rapidly indentation changes from line to line. | 30 | +0.301 |
| 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. | 88 | −0.062 |
| Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code. | 31 | −0.061 |
| Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom. | 30.775 | +0.02 |
Intercept 0.07 + feature contributions = 1.735 (log-odds).
Score = sigmoid(1.735) = 0.85.
| Score | 0.575 |
|---|
| Score | 20 |
|---|
Run 1
The code structure is logical but contains several issues affecting readability. Poor variable naming ('recentItem' for a boolean membership test, 'age' for an error message, 'step' in a validator context) significantly obscures intent. Unnecessary variables add indirection without clarity. The try/except adds nesting depth and handles a specific edge case that could be more explicit. Though the code is concise overall and maintains one action per line generally, the disorganized naming and unclear purpose of variables break reading flow. The validator pattern itself is recognizable but the implementation details are cryptic.
Run 2
The code is short and relatively flat, but clarity suffers significantly. Variable names like 'recentItem' and 'age' are misleading and do not convey their purpose — 'recentItem' actually means 'is score in options', and 'age' should be an error message. The `__call__` method does one logical check but spreads it across several lines with a vague variable. Import statements include unused modules (`operator`, `re`, `Pattern`, `contextmanager`, `get_run_validators`, `set_run_validators`, `_AndValidator`, `and_`, `default_if_none`) which adds noise. The error construction is somewhat clear, but the misleading names and confusing flow reduce readability. Structure is acceptable, but intent is obscured by poor naming and unnecessary imports.
Run 3
The code has a clear structure with a single class and one main method, but readability is undermined by confusing variable names. The variable 'recentItem' implies a recent value but actually stores a boolean membership check result. 'age' is used as an error message string, which is nonsensical in context. The try/except block is flat with reasonable nesting, but the exception catch for TypeError lacks context about why it's needed. The method has reasonable action granularity, though the error message construction mixes f-strings and repr formatting unnecessarily. Imports are organized but several appear unused (operator, re, Pattern, contextmanager, get_run_validators, set_run_validators, and_, attrs) which clutters the code. The repr method is clear and concise. Overall, the logic is understandable but misleading naming and unused imports create ambiguity about intent and reduce clarity.
Run 1
Code Structure: The class is logically organized into attributes, validation, and representation, but numerous unused imports add clutter. Nesting: Control flow is shallow, with a straightforward try/except followed by an if statement. Clarity of intent: Membership validation is evident, but misleading names such as recentItem, age, and score obscure the roles of the membership result, error message, and validated value; path is unused. Code length: The implementation is concise, although the imports and expanded exception arguments add some unnecessary length. Action granularity: Each statement performs a single clear action. Reading flow: Validation proceeds naturally from membership checking to error reporting, but inconsistent naming and unexplained distinction between options and _original_options interrupt comprehension.
Run 2
Code Structure: The validator is logically organized into attributes, validation, and representation methods, though numerous unused imports add clutter. Nesting: Shallow try/except and a single conditional make control flow easy to follow. Clarity of intent: Membership validation and error handling are clear, but names such as recentItem, age, score, and step obscure their roles; path is unused. Code length: The implementation is concise, although the imports and multiline exception construction add some unnecessary visual length. Action granularity: Each statement performs a single action, with no compressed or compound operations. Reading flow: Execution proceeds naturally from membership testing to failure handling, and the TypeError comment is helpful. Inconsistent naming conventions and misleading variable names interrupt otherwise straightforward reading.
Run 3
Code Structure: The small validator class logically groups state, validation, and representation, although many unused imports add clutter. Nesting: Shallow try/except and a single conditional keep control flow easy to follow. Clarity of intent: Membership validation is clear from the class name, expression, and error message, but misleading names such as recentItem, age, and score obscure meaning; path is unused. Code length: The implementation is concise, though the import list is excessive for this snippet. Action granularity: Each statement performs one clear action, and the multiline exception construction is readable. Reading flow: Execution proceeds naturally from membership testing to error reporting, with spacing separating stages; inconsistent naming conventions slightly disrupt readability.