Sample

int-d57b412e4dac-I10

Remove about 40% of line-break groups while retaining structure

Matched original source

Lines35

Scores

MethodScoreScale
Posnett00–1; higher is more readable
Dorn0.0270–1; higher is more readable
Mi0.2290–1; higher is more readable
LLOC21Logical lines; fewer is more readable
DeepSeek V4 Pro6.330–20; mean of three runs
GPT-6.1 Sol12.670–20; mean of three runs
BTTF0.4780–1; higher is more readable

Views

Source code

package io.netty.example.stomp.websocket; import io.netty.util.AttributeKey; import io.netty.util.internal.StringUtil; import java.util.ArrayList; import java.util.List; public enum StompVersion { STOMP_V11("1.1", "v11.stomp"), STOMP_V12("1.2", "v12.stomp"); public static final AttributeKey<StompVersion> CHANNEL_ATTRIBUTE_KEY = AttributeKey.valueOf("stomp_version"); public static final String SUB_PROTOCOLS; static { List<String> subProtocols = new ArrayList<String>(values().length); for (StompVersion stompVersion : values()) { subProtocols.add(stompVersion.subProtocol); } SUB_PROTOCOLS = StringUtil.join(",", subProtocols).toString(); } private final String version; private final String subProtocol; StompVersion(String version, String subProtocol) { this.version = version; this.subProtocol = subProtocol; } public String version() { return version; } public String subProtocol() { return subProtocol; } public static StompVersion findBySubProtocol(String subProtocol) { if (subProtocol != null) { for (StompVersion stompVersion : values()) { if (stompVersion.subProtocol().equals(subProtocol)) { return stompVersion; } } } throw new IllegalArgumentException("Not found StompVersion for '" + subProtocol + "'"); } }

Loading feature diagnosis…

Source regions

Feature contributions

Feature contributions

FeatureValueContribution
(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.1529.232−50.465
Source linesThe number of non-empty source lines.35+14
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.84−7.26

Intercept 8.87 + feature contributions = -34.855 (log-odds).
Score = sigmoid(-34.855) = 0.

Feature contributions

FeatureValueContribution
(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.155−2.9
Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right.0−0.804
Indentation frequencyHow rapidly indentation changes from line to line.35+0.473
Number layout frequencyHow rapidly the number of numeric values per line changes through the code.35−0.382
Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code.33−0.132
Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom.34.769+0.076
Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *.0.095+0.022

Intercept 0.07 + feature contributions = -3.577 (log-odds).
Score = sigmoid(-3.577) = 0.027.

Score0.229
Score21
Run 1

The code has severe readability issues. Multiple statements are compressed onto single lines, making visual scanning difficult. The static initialization block is particularly problematic, with a for-loop body and variable declaration crammed together. Method bodies are inconsistently formatted - some spread across lines while others are one-liners. The static block's logic is also unnecessarily verbose: it manually builds a list and then joins it instead of using a simpler stream approach. The enum structure itself is logical, but the field declarations and the AttributeKey constant lack spacing and separation. Import statements are compressed. The findBySubProtocol method violates action granularity, as the closing method braces and adjacent methods share lines. Overall, this code appears functional but formatted in a way that significantly impairs quick comprehension and maintainability.

Run 2

The code has significant readability issues. The structure is compressed with multiple declarations and statements on single lines, making it hard to scan. Nesting is shallow, which is good, but the density undermines clarity. Intent is mostly clear (enum representing STOMP versions with sub-protocol mapping), but the formatting obscures it. Code length is reasonable, but action granularity is poor—multiple actions share lines, reducing scannability. Reading flow is disrupted by inconsistent spacing and line breaks, forcing the reader to mentally decode the code. While the logic itself is straightforward, the presentation makes it feel tangled and error-prone to navigate.

Run 3

The code has significant readability issues. Structure and formatting are poor: multiple statements are packed onto single lines, enum constants are separated oddly, and indentation is inconsistent. Nesting is minimal, which is good, but action granularity suffers from multiple actions on one line. Clarity of intent is somewhat preserved by method names, but mangled formatting obscures the logical flow. Code length is acceptable for the task, but the static block and constant definitions feel cluttered. Reading flow is disorganized due to erratic line breaks and inconsistent spacing. Overall, the intent is understandable but the presentation severely degrades readability.

Run 1

Code Structure: The enum logically groups constants, initialization, fields, and lookup behavior, but compressed formatting obscures member boundaries. Nesting: Most code is shallow; the lookup method has three nested control-flow levels, which remain manageable. Clarity of intent: Descriptive names and straightforward operations clearly convey version metadata and subprotocol lookup. Code length: The implementation is concise without substantial redundancy. Action granularity: Several lines combine declarations, method definitions, or control flow with actions, making individual operations harder to distinguish. Reading flow: Inconsistent line breaks, inline closing braces, and adjacent methods interrupt otherwise natural top-to-bottom organization. Conventional formatting would substantially improve readability without changing the logic.

Run 2

Code Structure: The enum logically groups constants, initialization, fields, and methods, but compressed formatting obscures boundaries. Nesting: Most code is shallow; the lookup method has three nested control-flow levels, which remain manageable. Clarity of intent: Descriptive names and straightforward logic clearly communicate protocol versions and lookup behavior. Code length: The implementation is concise without substantial unnecessary code. Action granularity: Several lines combine declarations, statements, or entire methods, making individual actions harder to scan. Reading flow: Inconsistent line breaks, inline closing braces, and adjacent method declarations disrupt otherwise natural organization. Overall, the logic is readable, but formatting significantly reduces readability.

Run 3

Code Structure: The enum logically groups protocol constants, initialization, fields, accessors, and lookup behavior, but inconsistent formatting obscures those boundaries. Nesting: Most methods are flat; the lookup has moderate nesting through a null check, loop, and conditional. Clarity of intent: Descriptive names and straightforward operations clearly convey version mapping and subprotocol lookup. Code length: The implementation is concise without substantial redundancy. Action granularity: Several lines combine unrelated declarations, statements, or method boundaries, making individual actions harder to distinguish. Reading flow: Conventional member ordering helps, but crowded lines, irregular brace placement, and uneven spacing interrupt scanning. Overall, the logic is easy to understand, while formatting noticeably reduces readability.