Sample

int-5fa1fc3196ff-I06

Invert eligible conditions and exchange their branches

Matched original source

Lines50

Scores

MethodScoreScale
Posnett00–1; higher is more readable
Scalabrino0.6320–1; higher is more readable
Dorn0.6130–1; higher is more readable
Mi0.4650–1; higher is more readable
LLOC12Logical lines; fewer is more readable
DeepSeek V4 Pro170–20; mean of three runs
GPT-6.1 Sol17.330–20; mean of three runs
BTTF0.5840–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. 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.1868.13−61.648
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.593−6.89

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

Score0.632

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.956+0.288
Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *.0.081+0.153
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.90−0.147

Intercept 0.07 + feature contributions = 0.462 (log-odds).
Score = sigmoid(0.462) = 0.613.

Score0.465
Score12
Run 1

The code is well-structured with clear sections for configuration, startup, and shutdown. The class has a single responsibility and the main method follows a logical try-finally pattern. Nesting is minimal with only one anonymous inner class. Intent is clearly documented with Javadoc and inline comments. The fluent API chain is readable and follows Netty conventions. However, there are minor issues: the commented-out LoggingHandler line adds noise should be removed, and the chained method calls could be slightly more explicit for newcomers to Netty. Overall, the code is concise yet complete, with one action per line in most cases, making it easy to follow.

Run 2

The code is well-structured and follows standard Netty server patterns, making it easy to understand for developers familiar with the framework. It maintains a flat nesting structure with only one level of indentation in the ChannelInitializer. Each line performs a clear, single action, and the fluent API chain enhances readability. Comments are concise and explain the purpose of each major block without being excessive. However, minor deductions apply: the unused commented-out logging handler line adds slight clutter, and the single-letter variable names 'b' and 'f' are conventional in Netty examples but could be more descriptive. Overall, the reading flow is natural and the code is concise for its purpose.

Run 3

The code is clean, well-structured, and readable. It follows typical Netty server setup patterns with clear comments and logical organization. The main method is concise, properly handles resource cleanup in a finally block, and groups related configuration lines. Nesting is minimal, with only one anonymous inner class. Variable names are understandable, and intent is clear throughout. Could improve by extracting the child handler initialization for clarity, but overall it is highly readable.

Run 1

Code Structure: Logically organized into configuration, startup, waiting, and cleanup, with resource shutdown clearly placed in finally. Nesting: Moderate nesting from try/finally and the anonymous channel initializer, but still easy to follow. Clarity of intent: The class name, documentation, and phase comments clearly convey the echo server's purpose; short names b, f, and ch slightly reduce clarity. Code length: Concise overall, though the commented-out logging handler and multiline addLast call add minor clutter. Action granularity: Statements generally perform one action, and the fluent configuration chain places each configuration step on its own line. Reading flow: Execution proceeds naturally from setup to shutdown, with consistent indentation and helpful spacing.

Run 2

Code Structure: Clearly organized into configuration, startup, waiting, and cleanup, with reliable resource handling through try/finally. Nesting: Mostly shallow, though the anonymous ChannelInitializer adds moderate nesting inside the fluent configuration chain. Clarity of intent: The class name, documentation, and comments clearly describe the echo server; abbreviated variables b, f, and ch slightly reduce clarity. Code length: Concise for the task, although the commented-out logging statement adds unnecessary clutter. Action granularity: Statements generally perform one logical action, and configuration calls are separated onto individual lines. Reading flow: Execution proceeds naturally from initialization to shutdown, with consistent indentation and helpful whitespace. The inline initializer and awkwardly split addLast call mildly interrupt the otherwise smooth flow.

Run 3

Code Structure: Logically separates configuration, startup, waiting, and cleanup, with reliable resource cleanup in finally. Nesting: Mostly shallow, though the anonymous ChannelInitializer inside the fluent configuration adds some visual complexity. Clarity of intent: The class documentation, descriptive API calls, and comments clearly establish an SCTP echo server; abbreviated variables b, f, and ch slightly reduce clarity. Code length: Compact and appropriate for the task, although the commented-out logging statement and multiline addLast call add minor clutter. Action granularity: Statements generally perform one action, while the fluent chain places individual configuration steps on separate lines. Reading flow: Execution follows a natural configure-start-wait-cleanup sequence, supported by consistent indentation and spacing.