Sample

int-aeb217be9012-I02

Shorten method, parameter, and local names without collisions

Matched original source

Lines50

Scores

MethodScoreScale
Posnett00–1; higher is more readable
Scalabrino0.6630–1; higher is more readable
Dorn0.6230–1; higher is more readable
Mi0.4620–1; higher is more readable
LLOC12Logical lines; fewer is more readable
DeepSeek V4 Pro13.670–20; mean of three runs
GPT-6.1 Sol15.330–20; mean of three runs
BTTF0.5610–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 mai(String[] arg) throws Exception { // Configure the server. EventLoopGroup gro = new MultiThreadIoEventLoopGroup(NioIoHandler.newFactory()); final SctpEchoServerHandler server = new SctpEchoServerHandler(); try { ServerBootstrap b = new ServerBootstrap(); b.group(gro) .channel(NioSctpServerChannel.class) .option(ChannelOption.SO_BACKLOG, 100) .handler(new LoggingHandler(LogLevel.INFO)) .childHandler(new ChannelInitializer<SctpChannel>() { @Override public void init(SctpChannel ch) throws Exception { ch.pipeline().addLast( //new LoggingHandler(LogLevel.INFO), server); } }); // 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. gro.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.1873.769−61.834
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.584−6.876

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

Score0.663

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.87.961+0.615
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.989+0.289
Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *.0.082+0.141
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.88−0.062

Intercept 0.07 + feature contributions = 0.502 (log-odds).
Score = sigmoid(0.502) = 0.623.

Score0.462
Score12
Run 1

The code follows a logical structure with clear sections for configuration, startup, and shutdown. Nesting is minimal—only one anonymous inner class—and the fluent API chain for ServerBootstrap is well-formatted with one method per line. Intent is mostly clear, supported by comments and descriptive handler names. However, readability suffers from poor variable naming: 'gro' instead of 'group', 'mai' instead of 'main', and 'arg' instead of 'args'. These typos create ambiguity and reduce clarity. Action granularity is good, with each configuration step on its own line and clear separation of concerns. The reading flow is natural, moving from setup to execution to cleanup. Code length is concise and appropriate. The commented-out LoggingHandler adds minor noise but doesn't significantly impact readability. Overall, the structure and organization are solid, but the naming issues and method typo prevent a higher score.

Run 2

The code is generally readable with clear structure and intent, but has several issues. The variable names are too short and cryptic ('gro', 'b', 'f', 'arg', 'ch'), reducing clarity. The method name 'mai' is misspelled (should be 'main'). While the code follows a logical flow with one action per line and flat nesting, the variable naming undermines readability. The commented-out code and unused 'server' variable declaration (declared as final but could be inline) add minor clutter. The overall structure is clean with proper try-finally blocks and clear comments marking sections. The code would benefit from better variable names, a corrected method name, and removal of the unnecessary final variable declaration.

Run 3

The code is reasonably structured with clear sections for configuration, startup, and shutdown, but several issues reduce readability. Method name 'mai' instead of 'main' and shortened variable names ('gro', 'b', 'f') obscure intent. The nested anonymous ChannelInitializer adds complexity, though it's shallow. Import statements are all on one line, reducing scannability. The commented-out LoggingHandler line creates ambiguity about whether it should remain. Action granularity is mostly good in the bootstrap chain, with one operation per line, improving flow. However, the missing access modifier on PORT and inconsistent naming ('server' variable holding a handler) add confusion. The code is moderately concise but could benefit from clearer naming and removal of dead comments. Overall, functional but not exemplary for readability.

Run 1

Code Structure: Logically separates configuration, startup, waiting, and cleanup, with reliable try/finally organization. Nesting: Mostly shallow, though the anonymous channel initializer adds a moderately nested section. Clarity of intent: The class documentation and lifecycle comments explain the echo server clearly, but abbreviated names such as gro, b, and f weaken readability. The method name mai appears to be a typo for main, and server misleadingly names a handler. Code length: Compact overall, with little unnecessary code, although the commented-out logging statement adds clutter. Action granularity: Most statements perform one coherent action; fluent configuration spans multiple lines appropriately. Reading flow: Follows a natural server lifecycle, supported by consistent indentation, but the missing separation after the package declaration and awkward multiline addLast call slightly interrupt the flow.

Run 2

Code Structure: Configuration, startup, waiting, and cleanup are logically organized, with resource shutdown in a finally block. Nesting: Moderate nesting from try/finally and an anonymous initializer is manageable. Clarity of intent: The class documentation and lifecycle comments clearly describe an SCTP echo server, but abbreviated names such as gro, b, and f reduce clarity; mai also looks like a misspelled main entry point. Code length: Compact overall, though the commented-out logging handler adds clutter. Action granularity: Most statements perform one action, and the fluent bootstrap chain separates configuration steps onto individual lines. Reading flow: Execution follows a natural server lifecycle, but inconsistent naming and the unnecessarily split addLast call slightly interrupt readability.

Run 3

Code Structure: Server configuration, startup, waiting, and cleanup are logically organized, with resource cleanup in a finally block. Nesting: Mostly shallow, though the anonymous ChannelInitializer inside the fluent configuration adds moderate nesting. Clarity of intent: The class documentation and lifecycle comments clearly explain the echo server, but abbreviated names such as gro, b, and f reduce clarity; mai also obscures the expected main entry point. Code length: Compact overall, with an unnecessary commented-out logging statement and an awkwardly expanded addLast call. Action granularity: Statements generally perform one action, while the fluent chain cleanly separates configuration steps across lines. Reading flow: Execution follows a natural setup-to-shutdown sequence, but terse identifiers and the commented-out code slightly interrupt readability.