Sample
int-18b0d11ac26d-I06
Invert eligible conditions and exchange their branches
Scores
| Method | Score | Scale |
|---|---|---|
| Posnett | 0 | 0–1; higher is more readable |
| Dorn | 0.113 | 0–1; higher is more readable |
| Mi | 0.143 | 0–1; higher is more readable |
| LLOC | 21 | Logical lines; fewer is more readable |
| DeepSeek V4 Pro | 13.33 | 0–20; mean of three runs |
| GPT-6.1 Sol | 15.67 | 0–20; mean of three runs |
| BTTF | 0.608 | 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. | 1588.828 | −52.431 |
| Source linesThe number of non-empty source lines. | 52 | +20.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.726 | −7.089 |
Intercept 8.87 + feature contributions = -29.85 (log-odds).
Score = sigmoid(-29.85) = 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. | 112.962 | −1.119 |
| Indentation frequencyHow rapidly indentation changes from line to line. | 52 | +1.061 |
| Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code. | 53 | −0.84 |
| Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right. | 0 | −0.804 |
| Number layout frequencyHow rapidly the number of numeric values per line changes through the code. | 52 | −0.772 |
| Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom. | 51.833 | +0.315 |
| Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *. | 0.094 | +0.03 |
Intercept 0.07 + feature contributions = -2.061 (log-odds).
Score = sigmoid(-2.061) = 0.113.
| Score | 0.143 |
|---|
| Score | 21 |
|---|
Run 1
The code is generally readable but has a few confusing constructs. The enum structure is logical with clear constants and fields. However, the findBySubProtocol method is needlessly convoluted: the condition `if (!((subProtocol != null))) {} else {` is an inverted, empty-if-block pattern that obscures intent and should be simplified to `if (subProtocol != null) { for loop }`. Nesting is shallow, and most methods are concise. The static initializer is clear enough, though it could use a stream for brevity. Overall structure is sound, but the unusual conditional logic in findBySubProtocol significantly reduces clarity of intent and reading flow, preventing a higher score.
Run 2
The enum is mostly readable with clear constants, simple fields, and a logical static initializer. However, `findBySubProtocol` contains an unnatural inverted null check (`if (!((subProtocol != null))) {} else { ... }`) which disrupts reading flow and obscures intent. The loop structure is flat and each action is on its own line, but the method could be clearer with a standard null guard. The `SUB_PROTOCOLS` creation is straightforward, though mixing `List` and `StringUtil.join` adds minor length. Overall, the code is understandable but has one awkward control flow that lowers clarity.
Run 3
The code has moderate readability. The enum structure is logical, methods are short, and one action per line is mostly followed. However, several issues reduce clarity: the if-else condition in findBySubProtocol is inverted and confusing (`if (!((subProtocol != null))) {} else { ... }`); the static block uses a mutable list unnecessarily; and imports/blank lines are slightly inconsistent. Nesting is shallow but the empty if block harms the reading flow. The enum constants are clear, but the code could be more concise and natural.
Run 1
Code Structure: The enum logically groups versions, constants, initialization, fields, and lookup behavior. Nesting: Mostly shallow, but findBySubProtocol unnecessarily nests its loop inside an else branch. Clarity of intent: Descriptive names and straightforward accessors clarify purpose; the negated null check, redundant parentheses, and empty if block obscure an otherwise simple lookup. Code length: Compact overall, though the lookup could be shorter and clearer with a direct null check. Action granularity: Most lines perform one action, but the inline empty if/else construction breaks this consistency. Reading flow: Declaration order is natural and initialization is easy to follow; the awkward null-handling condition interrupts the flow.
Run 2
Code Structure: The enum logically groups version constants, shared initialization, fields, accessors, and lookup behavior. Nesting: Most code is flat, but the lookup unnecessarily nests a loop and comparison inside an else branch. Clarity of intent: Names and immutable fields clearly express protocol-version mapping; however, the negated null check, redundant parentheses, and empty if block obscure straightforward logic. Code length: Generally concise, with minor verbosity in list construction and the null-handling conditional. Action granularity: Statements mostly perform one action per line, although the empty if and else share a line awkwardly. Reading flow: Organization is natural and consistent until findBySubProtocol, where an ordinary positive null check or guard clause would improve readability.
Run 3
Code Structure: The enum is logically organized into constants, initialization, fields, constructor, accessors, and lookup. Nesting: Most code is flat, but the lookup unnecessarily nests a loop and match check inside an else branch. Clarity of intent: Names and types clearly express STOMP version mappings; however, the negated null check, redundant parentheses, and empty if block obscure straightforward null handling. Code length: Compact overall, with minor unnecessary syntax in the lookup. Action granularity: Statements generally perform one action per line, although the empty conditional and else share a line awkwardly. Reading flow: Organization and spacing support natural reading, but the unusual conditional interrupts the lookup's flow. A direct null check or early rejection would improve readability.