Sample

int-8255961cd7e3-I10

Remove about 40% of line-break groups while retaining structure

Matched original source

Lines20

Scores

MethodScoreScale
Posnett00–1; higher is more readable
Scalabrino0.6630–1; higher is more readable
Dorn0.7880–1; higher is more readable
Mi0.3830–1; higher is more readable
LLOC7Logical lines; fewer is more readable
DeepSeek V4 Pro140–20; mean of three runs
GPT-6.1 Sol150–20; mean of three runs
BTTF0.6420–1; higher is more readable

Views

Source code

package io.netty.example.sctp; import io.netty.channel.ChannelHandler.Sharable; import io.netty.channel.ChannelHandlerContext; import io.netty.channel.ChannelInboundHandlerAdapter; /** * Handler implementation for the SCTP echo server. */ @Sharable public class SctpEchoServerHandler extends ChannelInboundHandlerAdapter { @Override public void channelRead(ChannelHandlerContext ctx, Object msg) { ctx.write(msg); } @Override public void channelReadComplete(ChannelHandlerContext ctx) { ctx.flush(); } @Override public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) { // Close the connection when an exception is raised. cause.printStackTrace(); ctx.close(); } }

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.553.182−18.255
Source linesThe number of non-empty source lines.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.703−7.054

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

Score0.663

Feature contributions

FeatureValueContribution
(log-odds)
Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right.86.905+0.598
Number layout frequencyHow rapidly the number of numeric values per line changes through the code.1+0.398
Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code.20+0.328
Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *.0.074+0.221
Indentation frequencyHow rapidly indentation changes from line to line.17−0.149
Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom.19.693−0.135
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.87−0.02

Intercept 0.07 + feature contributions = 1.311 (log-odds).
Score = sigmoid(1.311) = 0.788.

Score0.383
Score7
Run 1

The code is fairly readable but has formatting issues. The package, imports, and class structure are logically organized, and nesting is minimal. However, the placement of annotations and method declarations on single lines reduces clarity. While concise, mixing multiple actions (e.g., printStackTrace and close, or write and write) on one line violates action granularity and interrupts reading flow. The comments help intent, but compressed formatting makes the code harder to scan than necessary.

Run 2

The code is a simple Netty handler with a clear purpose and mostly flat structure. It uses one action per line and follows standard Java conventions. However, readability suffers from a few issues: the @Sharable annotation is awkwardly placed on the same line as the class Javadoc, several methods are compressed onto single lines, and the closing brace format is inconsistent. These formatting choices make the code feel cramped and slightly disorganized, reducing its overall clarity and reading flow.

Run 3

The code is relatively short and each method performs a single action (write, flush, close), which helps readability. However, there are several issues: the @Sharable annotation and class declaration are on the same line, and multiple statements are compressed onto single lines (e.g., `ctx.write(msg);` on the same line as the method signature). This harms reading flow and action granularity. Nesting is flat, and intent is clear for a simple echo server. Structure is logically organized but the formatting is inconsistent. Code length is appropriately concise. Overall, the logic is understandable but presentation could be improved with proper line breaks and consistent formatting.

Run 1

Code Structure: The handler is logically organized into three standard lifecycle methods, but compressed annotation, declaration, and closing-brace placement weaken visual structure. Nesting: Minimal nesting makes the code easy to follow. Clarity of intent: The class name, documentation, method names, and exception comment clearly communicate echo-server behavior. Code length: Concise and free of unnecessary logic. Action granularity: Exception handling places two actions on one line; the other methods combine declarations and bodies on a single line, reducing scanability. Reading flow: Method order is natural, but cramped formatting and missing separation after the package declaration interrupt an otherwise straightforward reading experience.

Run 2

Code Structure: Logically organized into three standard handler callbacks, but the class annotation, declaration, and closing braces are cramped. Nesting: Shallow, with no nested control flow. Clarity of intent: The class name, documentation, and callback operations clearly convey echo-server behavior and exception handling. Code length: Concise without unnecessary logic, though excessive formatting compression reduces readability. Action granularity: Most callbacks perform one action, but printing the exception and closing the connection share a line. Reading flow: The callback order is natural, but inline method bodies and crowded declaration and brace placement interrupt scanning.

Run 3

Code Structure: The handler is logically organized into three standard event callbacks, but compressed declarations and closing braces weaken visual separation. Nesting: Minimal nesting makes the code easy to follow. Clarity of intent: The class name, documentation, and callback names clearly convey an SCTP echo server that writes received messages, flushes completed reads, and closes on exceptions. Code length: Concise, with no unnecessary logic, though excessive compression reduces readability. Action granularity: Most callbacks contain a single action, but printing the exception and closing the connection share one line. Reading flow: The callback sequence is natural, but placing the annotation and class declaration beside the documentation, using inline method bodies, and combining closing braces interrupts scanning.