Sample
pyint-8b368132230c-I10
Deterministically remove some optional blank lines and bracketed line breaks
Scores
| Method | Score | Scale |
|---|---|---|
| Posnett | 0 | 0–1; higher is more readable |
| Dorn | 0.853 | 0–1; higher is more readable |
| Mi | 0.322 | 0–1; higher is more readable |
| LLOC | 16 | Logical lines; fewer is more readable |
| DeepSeek V4 Pro | 9.33 | 0–20; mean of three runs |
| GPT-6.1 Sol | 15 | 0–20; mean of three runs |
| BTTF | 0.605 | 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. | 711.107 | −23.467 |
| 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.27 | −6.406 |
Intercept 8.87 + feature contributions = -11.002 (log-odds).
Score = sigmoid(-11.002) = 0.
Feature contributions
| Feature | Value | Contribution (log-odds) |
|---|---|---|
| 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. | 71 | +0.658 |
| Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *. | 0.052 | +0.433 |
| Number layout frequencyHow rapidly the number of numeric values per line changes through the code. | 1 | +0.398 |
| Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code. | 26 | +0.116 |
| Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right. | 55.154 | +0.085 |
| Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom. | 24.903 | −0.062 |
| Indentation frequencyHow rapidly indentation changes from line to line. | 23 | +0.058 |
Intercept 0.07 + feature contributions = 1.757 (log-odds).
Score = sigmoid(1.757) = 0.853.
| Score | 0.322 |
|---|
| Score | 16 |
|---|
Run 1
The code has several readability issues. The import section is followed immediately by a class definition without spacing, making the structure feel cramped. The `__call__` method contains a multi-line string and a deeply nested function call with awkward indentation and inconsistent spacing, especially around the `raise NotCallableError` arguments. The method lacks a clear single-purpose flow because error construction and raising are combined in a visually cluttered block. While variable names and the docstring are somewhat clear, the formatting breaks natural reading flow and makes the intent harder to grasp. Overall, the logic is straightforward, but poor layout and dense argument formatting significantly reduce readability.
Run 2
The code is short but has readability issues. It mixes imports, a decorator, and class definition without blank lines. The __call__ method contains a deeply nested raise with awkward multi-line formatting: the NotCallableError call spans four lines with inconsistent indentation and trailing whitespace. The message construction is split unnecessarily, reducing clarity of intent. Action granularity is poor in the raise block, where multiple arguments and formatting are crammed together. Reading flow suffers because the docstring interrupts the logic, and the raise statement's structure forces the reader to backtrack. The __repr__ method is concise and clear. Overall, the code would benefit from better vertical spacing, simplified message construction, and moving the raise call to a cleaner, flatter structure.
Run 3
The code is moderately readable but has several issues. The import section is reasonably organized, and the class definition is clear. However, there is a logical error in the error handling: NotCallableError is raised with the entire dictionary as the msg argument instead of just the formatted string, making the intent ambiguous. The formatting is inconsistent, with excessive spaces and misaligned parentheses in the raise statement. The docstring is helpful but minimal, and the class is concise. The overall structure lacks clear separation between validator logic and error construction. The action granularity is poor in the raise statement, where multiple operations are crammed onto one line. The reading flow is interrupted by these formatting inconsistencies and the logical error. Improvements would include fixing the message passing, aligning arguments properly, and possibly breaking the error construction into smaller steps.
Run 1
Code Structure: The validator class logically groups validation and representation, but imports lack separation from the class and several appear unused. Nesting: Shallow and easy to follow; the single conditional adds little complexity. Clarity of intent: Class and method names clearly communicate callable validation, although the __call__ docstring explains the class design rather than the method's behavior. Code length: The implementation is concise, but unused imports add clutter. Action granularity: Most lines express one action; the awkwardly compressed exception arguments reduce readability. Reading flow: Validation proceeds naturally from checking the value to raising a descriptive exception, but inconsistent spacing, missing blank lines between methods, and malformed-looking argument formatting interrupt the flow.
Run 2
Code Structure: The validator is logically organized into validation and representation methods, but unused imports and missing blank lines add clutter. Nesting: Shallow control flow is easy to follow; only the error-construction expression has additional nesting. Clarity of intent: Class naming, the callable check, and the descriptive error message clearly communicate the purpose, although the docstring explains the design rather than the method's behavior. Code length: The implementation is compact, but the imports are excessive for this snippet. Action granularity: Statements generally perform one action each, though the compressed argument formatting in NotCallableError reduces readability. Reading flow: Execution proceeds naturally from checking the value to raising an error, but inconsistent spacing, crowded closing parentheses, and insufficient separation between methods interrupt the flow.
Run 3
Code Structure: The callable validator class logically separates validation and representation, but unused imports and missing blank lines clutter organization. Nesting: Shallow nesting keeps control flow easy to follow; the multiline exception construction adds minor visual complexity. Clarity of intent: Class and method names, the callable check, and the descriptive error message make the purpose clear. The docstring explains the class design rather than the method's behavior. Code length: The implementation is concise, although several imports are unnecessary for this snippet. Action granularity: Statements generally perform one action each, but placing multiple exception arguments and closing punctuation on one poorly spaced line reduces readability. Reading flow: Validation proceeds naturally from checking the value to reporting failure, followed by representation; inconsistent formatting and tightly packed definitions interrupt that flow.