Sample
pyint-b486c099186e-I07
Insert deterministic runtime-dead branches into callable bodies
Scores
| Method | Score | Scale |
|---|---|---|
| Posnett | 0 | 0–1; higher is more readable |
| Dorn | 0.721 | 0–1; higher is more readable |
| Mi | 0.26 | 0–1; higher is more readable |
| LLOC | 21 | Logical lines; fewer is more readable |
| DeepSeek V4 Pro | 12.33 | 0–20; mean of three runs |
| GPT-6.1 Sol | 14 | 0–20; mean of three runs |
| BTTF | 0.428 | 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. | 769.941 | −25.408 |
| Source linesThe number of non-empty source lines. | 27 | +10.8 |
| 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.639 | −6.959 |
Intercept 8.87 + feature contributions = -12.697 (log-odds).
Score = sigmoid(-12.697) = 0.
Feature contributions
| Feature | Value | Contribution (log-odds) |
|---|---|---|
| Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right. | 86.929 | +0.598 |
| Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *. | 0.064 | +0.317 |
| Number layout frequencyHow rapidly the number of numeric values per line changes through the code. | 25 | −0.153 |
| Indentation frequencyHow rapidly indentation changes from line to line. | 25 | +0.128 |
| Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code. | 28 | +0.045 |
| Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom. | 26.795 | −0.035 |
| 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. | 86.964 | −0.018 |
Intercept 0.07 + feature contributions = 0.951 (log-odds).
Score = sigmoid(0.951) = 0.721.
| Score | 0.26 |
|---|
| Score | 21 |
|---|
Run 1
The code is structurally clear but includes problematic elements that reduce readability. The class definition is logical and uses the attrs library appropriately with a frozen, slotted frozen dataclass-like structure. The docstring and method separation are good. However, there are several issues: the opaque bitwise assertions like `if ((0x3b55 ^ 0x3b55) != 0): raise AssertionError()` are meaningless to a reader and appear to be obfuscation or dead code. The nesting level is low, which is positive, but the validator logic is minimal. Action granularity is mostly one action per line, except for the combined f-string and raise statement. The reading flow is natural aside from the confusing assertions. The code is concise, but the mysterious assertions and lack of explanatory comments for them significantly hurt clarity of intent. Removing those assert blocks would improve readability substantially.
Run 2
The code is generally readable with clear naming, proper type hints, and a simple, flat structure. The class `_MaxLengthValidator` has a single, understandable responsibility. However, there are issues that hurt clarity and flow: the `if ((0x3b55 ^ 0x3b55) != 0): raise AssertionError()` lines are confusing dead code that obscure intent and add needless nesting. The docstring explains why a callable class is used, which is good, but the `repr` method lacks a docstring. The line `if len(value) > self.max_length:` combines condition and action but is acceptable. Overall, it is concise and logical but would benefit from removing the assertion checks and adding a brief comment or docstring for `__repr__`.
Run 3
The code is generally readable but has notable issues. The class structure is clear, with logical use of attrs and a docstring explaining the callable class choice. Nesting is minimal. However, there are suspicious unreachable 'if ((0x... ^ 0x...) != 0)' checks that add confusion and unnecessary length. The __call__ method mixes validation, error message construction, and raising in a few lines, which slightly hurts action granularity. Reading flow is okay but interrupted by the dead code. Overall, it is readable but could be improved by removing the redundant conditionals.
Run 1
Code Structure: The validator is logically organized into a callable class with separate validation and representation methods, but numerous unused imports add clutter. Nesting: Control flow is shallow and easy to follow. Clarity of intent: Class and attribute names clearly convey maximum-length validation, while the docstring explains the callable-class design. However, hexadecimal XOR checks that are always false introduce confusing, purposeless code. Code length: The functional implementation is concise, but dead assertion branches and unused imports unnecessarily lengthen it. Action granularity: Each line generally performs one action, and constructing the error message separately from raising the exception aids readability. Reading flow: The validation and error reporting follow naturally, but redundant checks interrupt both methods and distract from their purpose.
Run 2
Code Structure: The validator class is logically organized into configuration, validation, and representation methods, but numerous unused imports add clutter. Nesting: The code is shallow, with simple conditional checks. Clarity of intent: Class and attribute names clearly communicate maximum-length validation, and the error message is informative; however, opaque hexadecimal XOR checks that are always false obscure intent. Code length: The implementation is short, but redundant assertion branches and unused imports make it unnecessarily longer. Action granularity: Each statement performs one action, with message construction separated from raising the exception. Reading flow: The main validation path is natural and easy to follow, but meaningless checks interrupt both methods.
Run 3
Code Structure: The validator class logically groups configuration, validation, and representation, but numerous unused imports add clutter. Nesting: The code is shallow, with simple conditional blocks. Clarity of intent: Class and attribute names, the length check, and the error message clearly communicate the purpose; however, constant-false XOR checks are distracting and suggest unexplained defensive behavior. Code length: The implementation is short, but dead checks and unused imports unnecessarily inflate it. Action granularity: Each line generally performs one clear action. Reading flow: The class follows a natural sequence, although irrelevant assertions interrupt both methods, and the callable-method docstring explains representation customization rather than validation behavior.