Sample
pyint-9b915be8ca46-I03
Replace names with length-matched meaningful but unrelated identifiers
Scores
| Method | Score | Scale |
|---|---|---|
| Posnett | 0 | 0–1; higher is more readable |
| Dorn | 0.839 | 0–1; higher is more readable |
| Mi | 0.321 | 0–1; higher is more readable |
| LLOC | 19 | Logical lines; fewer is more readable |
| DeepSeek V4 Pro | 15.67 | 0–20; mean of three runs |
| GPT-6.1 Sol | 17 | 0–20; mean of three runs |
| BTTF | 0.511 | 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. | 655.551 | −21.633 |
| Source linesThe number of non-empty source lines. | 25 | +10 |
| 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.594 | −6.89 |
Intercept 8.87 + feature contributions = -9.653 (log-odds).
Score = sigmoid(-9.653) = 0.
Feature contributions
| Feature | Value | Contribution (log-odds) |
|---|---|---|
| Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right. | 78.731 | +0.466 |
| Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *. | 0.055 | +0.41 |
| 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. | 81.923 | +0.195 |
| Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code. | 26 | +0.116 |
| Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom. | 24.771 | −0.064 |
| Indentation frequencyHow rapidly indentation changes from line to line. | 23 | +0.058 |
Intercept 0.07 + feature contributions = 1.65 (log-odds).
Score = sigmoid(1.65) = 0.839.
| Score | 0.321 |
|---|
| Score | 19 |
|---|
Run 1
The code is well-structured, with a clear logical organization: imports are grouped, the class is decorated with 'attrs' for concise attribute definitions, and the validator logic is contained within a single class. Nesting is minimal—only one conditional inside '__call__', which aids readability. The purpose of each method is clear: '__call__' validates the input, and '__repr__' provides a human-readable representation. Code length is concise, avoiding unnecessary verbosity. Action granularity is good, with one meaningful operation per line. Reading flow is natural, moving from imports to class definition, then to methods. Minor deductions are due to the slightly implicit nature of 'event' and 'data.name', which may require domain knowledge, and the lack of a docstring explaining the overall class purpose beyond the '__call__' method.
Run 2
The code is generally clear and well-structured. It defines a small, focused class with a clear purpose (numeric validation) and good separation of concerns. The constructor and method signatures are concise. The `__call__` method contains a single if-statement with minimal nesting, and the error message is constructed inline, which is acceptable. The `__repr__` is clear. However, readability is slightly reduced by the use of generic parameter names like `path`, `data`, and `event`, which do not convey their types or roles. The docstring is minimal and does not explain the validation logic. Additionally, the inline f-string for the error message combines condition checking and string formatting in a way that could be slightly clearer if the format string were on a separate line. Overall, the code is easy to follow for an experienced developer, but lacks some contextual clarity.
Run 3
The code is fairly readable. It has a clear structure with a single class definition and appropriate imports. The nesting is minimal, with only one conditional inside the __call__ method. The intent is mostly clear, though the parameter name 'event' is ambiguous and the docstring only explains the class's design choice, not its purpose. The code is concise, with no unnecessary verbosity. Action granularity is good, with one logical action per line. Reading flow is natural, starting with imports, then class decorator, attributes, methods, and ending with a custom __repr__. Minor issues include the vague 'event' name, the oddly formatted docstring, and the error message's use of an f-string without clear context for the reader.
Run 1
Code Structure: The validator is logically organized into attributes, validation behavior, and representation, though numerous unused imports add clutter. Nesting: A single conditional keeps the code flat and easy to follow. Clarity of intent: Comparison attributes and the error message clearly convey numeric-bound validation, but generic parameter names such as path, data, and event obscure their roles; path is unused. The docstring explains the callable-class design rather than the method's validation behavior. Code length: The implementation is concise, with little unnecessary code beyond unused imports. Action granularity: Each statement performs one clear action. Reading flow: Attributes followed by __call__ and __repr__ provide a natural progression, although clearer parameter names and cleaner import spacing would improve readability.
Run 2
Code Structure: Imports and a small validator class are logically organized, although several imports appear unused in this snippet. Nesting: Minimal nesting, with only one conditional inside __call__. Clarity of intent: Descriptive class and attribute names make the numeric-bound validation clear, but path is unused, data and event are generic names, and key misleadingly names an error message. The docstring explains the callable-class design rather than the method's validation behavior. Code length: The implementation is concise, with little unnecessary code beyond the imports. Action granularity: Each statement performs one clear action. Reading flow: Attributes, validation logic, and representation follow a natural order; additional spacing between imports and the class would improve visual separation.
Run 3
Code Structure: Imports, class attributes, and methods are logically organized, though several imports appear unused in this snippet. Nesting: A single conditional keeps the code flat and easy to follow. Clarity of intent: The comparison and validation failure are clear, but generic parameter names such as data and event, the unused path parameter, and the message variable named key reduce precision. The docstring explains the callable-class design rather than the method's validation behavior. Code length: The implementation is concise with little unnecessary code beyond the apparent unused imports. Action granularity: Each statement performs one clear action. Reading flow: The sequence from validator configuration to comparison, error reporting, and representation is natural; additional spacing between imports and the class would improve visual separation.