Sample

int-e7f14af832d7-I11

Split eligible integer literals into pairs of short-named intermediate variables

Matched original source

Lines33

Scores

MethodScoreScale
Posnett0.0030–1; higher is more readable
Scalabrino0.7530–1; higher is more readable
Dorn0.8320–1; higher is more readable
Mi0.5350–1; higher is more readable
LLOC8Logical lines; fewer is more readable
DeepSeek V4 Pro18.330–20; mean of three runs
GPT-6.1 Sol190–20; mean of three runs
BTTF0.8290–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 authScheme) { super(SocksResponseType.INIT); this.authScheme = ObjectUtil.checkNotNull(authScheme, "authScheme"); } /** * Returns the {@link SocksAuthScheme} of this {@link SocksInitResponse} * * @return The {@link SocksAuthScheme} of this {@link SocksInitResponse} */ public SocksAuthScheme authScheme() { return authScheme; } @Override public void encodeAsByteBuf(ByteBuf byteBuf) { byteBuf.writeByte(protocolVersion().byteValue()); byteBuf.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.629.447−20.772
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.748−7.122

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

Score0.753

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.064+0.323
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.818+0.049

Intercept 0.07 + feature contributions = 1.6 (log-odds).
Score = sigmoid(1.6) = 0.832.

Score0.535
Score8
Run 1

The code is highly readable. It has a clear, single-purpose class with a flat structure and minimal nesting. The constructor and methods are straightforward, each performing one clear action. Javadoc comments adequately explain the class, constructor parameter, and return value. Naming is consistent with Netty conventions, and the code is concise without being overly terse. The encodeAsByteBuf method reads naturally, writing the protocol version then the auth scheme. Minor points: the class-level comment is slightly terse ('An socks init response') and could be more descriptive, but this does not meaningfully impact readability. Overall, it follows clean code principles effectively.

Run 2

The code is highly readable due to its clear logical organization, minimal nesting, and concise structure. Each method has a single clear purpose, and actions are separated into distinct lines, improving comprehension. The class encapsulates its responsibility well, with proper use of validation and encapsulation. The Javadoc comments briefly explain the class's role and its relationships. The encodeAsByteBuf method follows a natural linear flow with clear operations. The only minor deductions are for the slight repetition in the Javadoc for authScheme() and the lack of explicit constructor documentation, but neither significantly impacts readability.

Run 3

The code is highly readable. It follows a clear, logical structure with fields, constructor, getter, and override, making the purpose obvious. Nesting is absent, and action granularity is well-followed—each line performs one operation. The code is concise but not oversimplified, with appropriate Javadoc explaining the class and method. Reading flow is natural and intuitive, aided by meaningful naming and consistent formatting. One minor deduction: the class-level Javadoc is slightly ambiguous ('An socks init response' has a grammatical error), but it does not meaningfully obscure intent.

Run 1

Code Structure: The class is logically organized into a field, constructor, accessor, and encoding method. Nesting: Methods are flat, with no nested control flow. Clarity of intent: Descriptive names, explicit response initialization, and null validation make the purpose clear; encoding details rely slightly on protocol knowledge. Code length: The implementation is concise, though accessor documentation is repetitive. Action granularity: Each statement performs one clear action. Reading flow: The progression from initialization to access and serialization is natural. Minor issues include missing spacing after the package declaration and the grammatical error in the class documentation.

Run 2

Code Structure: Logically organized into a field, constructor, accessor, and encoding method. Nesting: Flat, with no conditional or loop nesting. Clarity of intent: Descriptive class, field, and method names clearly convey a SOCKS initialization response and its serialization. Code length: Concise implementation, though the accessor documentation is slightly repetitive. Action granularity: Each statement performs a single clear action; the two byte writes make serialization order explicit. Reading flow: Natural progression from initialization to access and encoding. Minor presentation issues, including the missing blank line after the package declaration and the grammatical error in the class documentation, prevent a perfect score.

Run 3

Code Structure: The class is logically organized into a field, constructor, accessor, and encoding method. Nesting: Methods are flat, with no conditionals or loops. Clarity of intent: Descriptive names, null validation, and straightforward byte writes make the purpose clear. Code length: The implementation is concise, though the accessor documentation is somewhat repetitive. Action granularity: Each statement performs a single clear action. Reading flow: The progression from initialization to access and serialization is natural. Minor presentation issues, including the missing blank line after the package declaration and the grammatical error in the class comment, slightly reduce polish.