Sample
pyint-435a84c3e085-I10
Deterministically remove some optional blank lines and bracketed line breaks
Scores
| Method | Score | Scale |
|---|---|---|
| Posnett | 0.982 | 0–1; higher is more readable |
| Dorn | 0.849 | 0–1; higher is more readable |
| Mi | 0.82 | 0–1; higher is more readable |
| LLOC | 7 | Logical lines; fewer is more readable |
| DeepSeek V4 Pro | 16.67 | 0–20; mean of three runs |
| GPT-6.1 Sol | 19 | 0–20; mean of three runs |
| BTTF | 0.764 | 0–1; higher is more readable |
Views
Loading feature diagnosis…
Source regions
Feature contributions
Feature contributions
| Feature | Value | Contribution (log-odds) |
|---|---|---|
| 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.447 | −6.67 |
| Source linesThe number of non-empty source lines. | 16 | +6.4 |
| Halstead volumeHow much symbolic information the code contains. It combines the total number of operators and values with the number of distinct ones. | 140.182 | −4.626 |
Intercept 8.87 + feature contributions = 3.974 (log-odds).
Score = sigmoid(3.974) = 0.982.
Feature contributions
| Feature | Value | Contribution (log-odds) |
|---|---|---|
| Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *. | 0.033 | +0.621 |
| Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right. | 77.941 | +0.453 |
| Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code. | 17 | +0.434 |
| Indentation frequencyHow rapidly indentation changes from line to line. | 9 | −0.426 |
| 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. | 77.941 | +0.364 |
| Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom. | 15.873 | −0.188 |
Intercept 0.07 + feature contributions = 1.727 (log-odds).
Score = sigmoid(1.727) = 0.849.
| Score | 0.82 |
|---|
| Score | 7 |
|---|
Run 1
The code is clear and concise. It defines a simple custom exception class with a single purpose. The structure is logical: import, class definition, docstring, then a straightforward __init__ method. Nesting is minimal, and each action (assign msg, call super, assign self.msg) is on its own line, improving readability. The docstring provides helpful context, including version information and rationale for subclassing AttributeError. The only minor issues are the slightly awkward grammar in the docstring ('have been attempted') and the redundant assignment of self.msg, which is already set by the parent class. Overall, the code is easy to understand and maintain.
Run 2
The code is well-structured with a single class definition and a clear, specific purpose. The docstring provides excellent context by explaining the error's intent, behavior, and version history. Nesting is minimal with only one method, resulting in flat and readable code. The error message is stored as an attribute and passed to the parent class, showing clear intent. However, the line 'self.msg = msg' is redundant since AttributeError already stores the message; this adds unnecessary length. Overall, the code is highly readable, concise, and follows good practices, losing points only for the minor redundancy and slightly verbose docstring.
Run 3
The code is well-structured with a clear class definition and a single-purpose exception class. The docstring is informative, explaining the class purpose, behavior, and version information. Nesting is minimal and flat. Intent is clear: define a custom frozen attribute error. Code length is concise and appropriate. Action granularity is good — each method performs one logical action. Reading flow is natural, with the docstring before the __init__ method. Minor improvements could include a type annotation for the msg attribute or removing the redundant self.msg assignment if not needed, but overall readability is high.
Run 1
Code Structure: A single, logically organized exception class with documentation followed by initialization. Nesting: Minimal, with no nested control flow. Clarity of intent: The class name, AttributeError inheritance, and docstring clearly communicate its purpose, though the docstring's opening sentence is grammatically awkward. Code length: Short and focused, with no unnecessary complexity. Action granularity: Each statement performs one action on its own line. Reading flow: Natural top-to-bottom progression from import to class documentation to constructor; minor spacing and docstring formatting issues slightly reduce polish.
Run 2
Code Structure: A single, logically organized exception class with a focused initializer. Nesting: Minimal, limited to the class and its method. Clarity of intent: The class name, AttributeError inheritance, docstring, and explicit error message clearly communicate its purpose; the docstring's opening sentence is grammatically awkward. Code length: Short and proportionate, though storing the message in self.msg adds slight redundancy. Action granularity: Each statement performs one clear action. Reading flow: Natural progression from import to class documentation to initialization; an additional blank line before the top-level class would improve conventional formatting.
Run 3
Code Structure: A logically organized exception class with documentation followed by its initializer. Nesting: Minimal, limited to the class and method. Clarity of intent: The class name, docstring, and inheritance clearly communicate its role in reporting attempted modification of immutable objects, though the docstring has a minor grammatical error. Code length: Concise, with no substantial unnecessary code; storing the message separately adds slight redundancy. Action granularity: Each executable line performs one clear action. Reading flow: Natural progression from import to class documentation to initialization, supported by whitespace and straightforward naming.