Sample

int-ccdcbc3b3e90-I02

Shorten method, parameter, and local names without collisions

Matched original source

Lines33

Scores

MethodScoreScale
Posnett0.0030–1; higher is more readable
Scalabrino0.7650–1; higher is more readable
Dorn0.8290–1; higher is more readable
Mi0.5250–1; higher is more readable
LLOC8Logical lines; fewer is more readable
DeepSeek V4 Pro17.670–20; mean of three runs
GPT-6.1 Sol180–20; mean of three runs
BTTF0.7750–1; higher is more readable

Views

Source code

package io.netty.handler.codec.socks; import io.netty.buffer.ByteBuf; import io.netty.util.internal.ObjectUtil; /** * An socks init response. * * @see SocksInitRequest * @see SocksInitResponseDecoder */ public final class SocksInitResponse extends SocksResponse { private final SocksAuthScheme authScheme; public SocksInitResponse(SocksAuthScheme auth) { super(SocksResponseType.INIT); this.authScheme = ObjectUtil.checkNotNull(auth, "authScheme"); } /** * Returns the {@link SocksAuthScheme} of this {@link SocksInitResponse} * * @return The {@link SocksAuthScheme} of this {@link SocksInitResponse} */ public SocksAuthScheme auth() { return authScheme; } @Override public void encode(ByteBuf byte2) { byte2.writeByte(protocolVersion().byteValue()); byte2.writeByte(authScheme.byteValue()); } }

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.633.294−20.899
Source linesThe number of non-empty source lines.33+13.2
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.747−7.12

Intercept 8.87 + feature contributions = -5.949 (log-odds).
Score = sigmoid(-5.949) = 0.003.

Score0.765

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.75.971+0.447
Number layout frequencyHow rapidly the number of numeric values per line changes through the code.1+0.398
Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right.73.882+0.388
Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *.0.066+0.299
Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code.34−0.167
Indentation frequencyHow rapidly indentation changes from line to line.24+0.093
Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom.32.792+0.049

Intercept 0.07 + feature contributions = 1.576 (log-odds).
Score = sigmoid(1.576) = 0.829.

Score0.525
Score8
Run 1

This code is well-structured and highly readable. It follows clean object-oriented design with clear separation of concerns: the constructor validates input using ObjectUtil.checkNotNull, the auth() accessor provides a clean API, and the encode method performs serialization in a concise manner. The code is flat with no unnecessary nesting, and each action is clearly delineated on separate lines. Javadoc comments explain the class purpose and method behavior, enhancing clarity of intent. The use of final fields and the @Override annotation demonstrate good coding practices. The only minor deduction is that the parameter name 'byte2' in the encode method is slightly awkward and could be more descriptive, and the class documentation has a minor grammatical issue ('An socks' should be 'A socks'). Overall, this is exemplary code that follows Netty's high quality standards.

Run 2

The code is highly readable due to its clear structure, minimal nesting, and concise implementation. The class has a single responsibility, with a well-defined constructor and accessor method. Parameter validation is cleanly handled through ObjectUtil.checkNotNull. The encode method is flat and performs one logical action per line. Javadoc comments provide context, and naming is descriptive (authScheme, protocolVersion). Minor issues include the slightly unclear parameter name 'byte2' in encode, which could be more descriptive (e.g., 'buf'), and the redundant Javadoc for a simple getter, which slightly increases length without adding value.

Run 3

The code is highly readable due to its clear logical structure and concise length. It has minimal nesting, flat control flow, and clear method separation. The override method 'encode' performs one write operation per line using ByteBuf, aiding clarity. Naming is consistent and descriptive, with Javadocs present for methods and fields. The import of ObjectUtil, use of checkNotNull, and the final authScheme field improve robustness and clarity. Slight confusion exists in the parameter names 'auth' and 'byte2', which are less descriptive than ideal, but not significantly harming readability. Overall, this is well-structured, easy to follow, and maintainable code.

Run 1

Code Structure: Logically organized into a field, constructor, accessor, and encoding method. Nesting: Flat, with no nested control flow. Clarity of intent: The class and methods clearly represent and encode a SOCKS initialization response; however, the parameter name 'byte2' is vague, and 'auth' is less consistent than 'authScheme'. Code length: Concise, though the accessor documentation repeats information evident from the signature. Action granularity: Each statement performs a clear operation, with one statement per line. Reading flow: Natural progression from initialization to access and serialization; a blank line between the package declaration and imports would improve formatting.

Run 2

Code Structure: The class is logically organized into a field, constructor, accessor, and encoding method. Nesting: There is no unnecessary nesting, making execution easy to follow. Clarity of intent: The class purpose and authentication scheme are clear, though the parameter name 'byte2' is vague and 'auth' versus 'authScheme' is slightly inconsistent. Code length: The implementation is concise; the accessor documentation is somewhat repetitive. Action granularity: Each statement performs one clear action, with encoding expressed as two separate writes. Reading flow: The conventional member order and straightforward methods provide a natural reading flow. Minor naming and documentation issues prevent a perfect score.

Run 3

Code Structure: Logically organized into a field, constructor, accessor, and encoding method. Nesting: Flat, with no nested control flow. Clarity of intent: Class and method names clearly convey a SOCKS initialization response; however, the parameter name 'byte2' is unclear, and 'auth' versus 'authScheme' is slightly inconsistent. Code length: Concise implementation, though the accessor documentation repeats itself. Action granularity: Each statement performs one clear action. Reading flow: Natural progression from initialization to access and serialization; a blank line between the package declaration and imports would improve visual separation.