Sample

int-724a621f3c01-I11

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

Matched original source

Lines52

Scores

MethodScoreScale
Posnett00–1; higher is more readable
Scalabrino0.5820–1; higher is more readable
Dorn0.6070–1; higher is more readable
Mi0.4570–1; higher is more readable
LLOC14Logical lines; fewer is more readable
DeepSeek V4 Pro15.670–20; mean of three runs
GPT-6.1 Sol160–20; mean of three runs
BTTF0.4250–1; higher is more readable

Views

Source code

package io.netty.example.sctp; import io.netty.bootstrap.ServerBootstrap; import io.netty.channel.ChannelFuture; import io.netty.channel.ChannelInitializer; import io.netty.channel.ChannelOption; import io.netty.channel.EventLoopGroup; import io.netty.channel.MultiThreadIoEventLoopGroup; import io.netty.channel.nio.NioIoHandler; import io.netty.channel.sctp.SctpChannel; import io.netty.channel.sctp.nio.NioSctpServerChannel; import io.netty.handler.logging.LogLevel; import io.netty.handler.logging.LoggingHandler; /** * Echoes back any received data from a SCTP client. */ public final class SctpEchoServer { static final int PORT = Integer.parseInt(System.getProperty("port", "8007")); public static void main(String[] args) throws Exception { // Configure the server. EventLoopGroup group = new MultiThreadIoEventLoopGroup(NioIoHandler.newFactory()); final SctpEchoServerHandler serverHandler = new SctpEchoServerHandler(); try { ServerBootstrap b = new ServerBootstrap(); final int a = 50; final int c = 50; b.group(group) .channel(NioSctpServerChannel.class) .option(ChannelOption.SO_BACKLOG, (a + c)) .handler(new LoggingHandler(LogLevel.INFO)) .childHandler(new ChannelInitializer<SctpChannel>() { @Override public void initChannel(SctpChannel ch) throws Exception { ch.pipeline().addLast( //new LoggingHandler(LogLevel.INFO), serverHandler); } }); // Start the server. ChannelFuture f = b.bind(PORT).sync(); // Wait until the server socket is closed. f.channel().closeFuture().sync(); } finally { // Shut down all event loops to terminate all threads. group.shutdownGracefully(); } } }

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.1985.691−65.528
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.568−6.852

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

Score0.582

Feature contributions

FeatureValueContribution
(log-odds)
Indentation frequencyHow rapidly indentation changes from line to line.45+0.819
Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code.52−0.805
Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right.89.943+0.647
Number layout frequencyHow rapidly the number of numeric values per line changes through the code.45−0.612
Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom.51.956+0.316
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.89.981−0.146
Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *.0.082+0.143

Intercept 0.07 + feature contributions = 0.433 (log-odds).
Score = sigmoid(0.433) = 0.607.

Score0.457
Score14
Run 1

The code is generally well-structured and follows standard Netty server patterns. The main method has clear sections: configuration, server setup, binding, and cleanup. Nesting is minimal, with only one anonymous inner class. The intent is clear - it's an echo server with proper logging configuration. However, there are some readability issues: the variables 'a' and 'c' are poorly named and their purpose is unclear, making the SO_BACKLOG option confusing. The commented-out LoggingHandler line is dead code that should be removed. The static PORT field uses a hardcoded default string buried in the code. The try-finally block is good for resource cleanup, but the method could benefit from extracting the server configuration into a separate method to reduce the main method's length and improve the reading flow.

Run 2

The code is generally well-structured with clear intent, following standard Netty server patterns. The try-finally block ensures proper resource cleanup. Method chaining with consistent indentation improves readability. However, several issues reduce the score: the variables 'a' and 'c' are poorly named and their purpose is unclear (why not just use 100 directly?), there's commented-out code that should be removed, and the import statements lack spacing. The class-level PORT constant uses a one-line initialization that could be formatted better. Overall, the code is readable but could be improved with better variable naming and cleanup of dead code. The flat structure and clear separation of concerns (configuration, channel setup, startup, shutdown) contribute positively.

Run 3

The code is generally readable with clear structure, logical organization, and good use of patterns like builder and try-finally. It has acceptable nesting levels and action granularity. Main readability issues include: unused or unclear variables ('a' and 'c' used instead of a named constant for backlog), a commented-out logging handler that could confuse intent, and missing import for SctpEchoServerHandler (assumed external). The class-level PORT constant is fine but could be named with clearer intent. Naming is mostly clear but some variables like 'b' and 'f' are too short. Overall flow is natural, concise, and follows common Netty server patterns.

Run 1

Code Structure: Logically separates configuration, startup, waiting, and cleanup, with reliable resource cleanup in finally. Nesting: Mostly shallow, though the anonymous channel initializer inside the fluent configuration adds moderate nesting. Clarity of intent: The class name, documentation, and lifecycle comments clearly describe an SCTP echo server; however, names b, f, a, and c are vague, and splitting the backlog into two unexplained constants obscures intent. Code length: Compact overall, but the redundant constants and commented-out logging statement add unnecessary clutter. Action granularity: Most statements perform one coherent action; chained calls combine related configuration steps and remain easy to scan. Reading flow: Follows a natural server lifecycle, aided by whitespace and comments, although the embedded initializer briefly interrupts the configuration flow.

Run 2

Code Structure: Server configuration, startup, waiting, and cleanup are logically organized, with reliable cleanup in a finally block. Nesting: Mostly shallow, although the anonymous ChannelInitializer adds moderate nesting. Clarity of intent: The class name, documentation, and lifecycle comments clearly convey an SCTP echo server; however, names b, f, a, and c are vague, and splitting the backlog into two constants obscures its meaning. Code length: Generally concise, but the redundant constants and commented-out logging handler add unnecessary clutter. Action granularity: Statements typically perform one logical action; the fluent configuration chain is appropriately split across lines. Reading flow: Execution follows a natural configuration-to-shutdown sequence, though awkward pipeline formatting and unexplained backlog arithmetic interrupt readability.

Run 3

Code Structure: Logically organized into configuration, startup, waiting, and cleanup, with reliable cleanup in finally. Nesting: Mostly shallow, though the anonymous ChannelInitializer adds moderate nesting. Clarity of intent: The class documentation and lifecycle comments explain the server's purpose, but names b, f, a, and c are weak; splitting the backlog into two arbitrary constants obscures intent. Code length: Generally concise, with unnecessary constants and a commented-out logging handler adding clutter. Action granularity: Statements typically perform one action, and the fluent configuration chain places each operation on its own line. Reading flow: Execution follows a natural server lifecycle, although the inline initializer interrupts the configuration flow and the multiline addLast call is excessive for a single active argument.