Sample

int-3a15c80799f8-I12

Inline all eligible single-use intermediate local variables

Matched original source

Lines50

Scores

MethodScoreScale
Posnett00–1; higher is more readable
Scalabrino0.730–1; higher is more readable
Dorn0.6110–1; higher is more readable
Mi0.4690–1; higher is more readable
LLOC11Logical lines; fewer is more readable
DeepSeek V4 Pro15.330–20; mean of three runs
GPT-6.1 Sol16.670–20; mean of three runs
BTTF0.3580–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(); b.group(group) .channel(NioSctpServerChannel.class) .option(ChannelOption.SO_BACKLOG, 100) .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. // Wait until the server socket is closed. (b.bind(PORT).sync()).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.1843.73−60.843
Source linesThe number of non-empty source lines.50+20
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.588−6.882

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

Score0.73

Feature contributions

FeatureValueContribution
(log-odds)
Indentation frequencyHow rapidly indentation changes from line to line.43+0.75
Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code.50−0.734
Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right.89.961+0.647
Number layout frequencyHow rapidly the number of numeric values per line changes through the code.43−0.566
Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom.49.967+0.289
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.961−0.145
Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *.0.083+0.14

Intercept 0.07 + feature contributions = 0.451 (log-odds).
Score = sigmoid(0.451) = 0.611.

Score0.469
Score11
Run 1

The code is generally structured well with clear sections and reasonable naming. The main issue is the missing `b.bind(PORT)` assignment before `sync()`, which creates ambiguous flow. There's also a commented-out logging handler and an empty comment that clutter intent. The anonymous `ChannelInitializer` adds nesting and breaks the otherwise fluent chain. While the builder pattern improves readability, the final binding line combines multiple actions (`bind`, `sync`, `channel`, `closeFuture`, `sync`) into one expression, reducing action granularity. The code is concise but slightly disorganized in flow. Adding the missing assignment, removing dead comments, and extracting the channel future would significantly improve clarity.

Run 2

The code is generally clean and follows standard Netty server patterns. Structure is logical with clear separation: setup, configuration, startup, and shutdown. Nesting is minimal except for the necessary anonymous ChannelInitializer class. Intent is clear from the class name, comments, and method names. The fluent API chain for bootstrap configuration improves readability. However, there are minor issues: the commented-out LoggingHandler line is dead code that should be removed, the variable name 'b' is too abbreviated, and there's an unnecessary blank line before the bind call. The empty comment section also slightly disrupts reading flow. The port constant parsing on a single line is acceptable. Overall, the code demonstrates good practices with room for minor polish.

Run 3

The code is generally well-structured, with clear intent, consistent formatting, and proper resource cleanup in a finally block. It uses a flat structure with minimal nesting, and the fluent builder pattern for ServerBootstrap reads naturally. Actions are mostly one per logical step. However, it loses points due to: (1) an incomplete comment block ('Start the server.' followed by a blank comment with no explanation), (2) a slightly awkward one-liner combining bind, sync, channel closeFuture, and sync — which reduces clarity and granularity on that line, and (3) the presence of a commented-out line of code, which introduces minor ambiguity. Overall, readability is strong but not perfect due to these small inconsistencies.

Run 1

Code Structure: Imports, configuration, initialization, and cleanup are logically organized, with lifecycle management in try/finally. Nesting: Mostly shallow, though the anonymous ChannelInitializer adds indentation within the fluent configuration. Clarity of intent: The class documentation and descriptive API calls clearly convey an SCTP echo server; the abbreviated variable b and commented-out logging code slightly reduce clarity. Code length: Concise overall, with minor clutter from redundant comments and extra blank lines. Action granularity: Configuration steps occupy separate lines, but binding, synchronization, channel access, and waiting for closure are combined into one statement. Reading flow: Generally follows setup, execution, and shutdown naturally, although the empty 'Start the server' section and binding under the waiting comment make the execution flow less clear.

Run 2

Code Structure: Logically separates setup, channel initialization, execution, and cleanup, with reliable cleanup in a finally block. Nesting: Mostly shallow; the anonymous initializer adds moderate nesting but remains manageable. Clarity of intent: The class documentation, descriptive API calls, and comments explain the echo server's purpose, though the variable name 'b' is vague and the handler implementation is external. Code length: Concise overall, with minor clutter from a commented-out logging handler, extra blank lines, and an unused ChannelFuture import. Action granularity: Configuration steps generally occupy separate lines, but the final chained statement combines binding, synchronization, and waiting for closure. Reading flow: Setup-to-shutdown progression is natural, although the empty section after 'Start the server' and the combined startup/wait statement weaken alignment between comments and actions.

Run 3

Code Structure: Logically organized into configuration, execution, and cleanup, with reliable resource shutdown in finally. Nesting: Generally shallow, though the anonymous ChannelInitializer adds indentation within the fluent configuration chain. Clarity of intent: The class documentation and descriptive API calls clearly identify an SCTP echo server; the abbreviated variable b and commented-out logging slightly reduce clarity. Code length: Concise overall, but excess blank lines and an unused ChannelFuture import add clutter. Action granularity: Configuration steps appear on separate lines, while binding, synchronization, channel access, and waiting are combined into one dense expression. Reading flow: Mostly natural and sequential, but the separated 'Start the server' comment and combined start-and-wait statement interrupt the otherwise clear progression.