Sample

int-6beaad3d1d26-I08

Select one of ten high-readability unrelated code templates per class

Matched original source

Lines62

Scores

MethodScoreScale
Posnett00–1; higher is more readable
Scalabrino0.5420–1; higher is more readable
Dorn0.2740–1; higher is more readable
Mi0.5090–1; higher is more readable
LLOC28Logical lines; fewer is more readable
DeepSeek V4 Pro100–20; mean of three runs
GPT-6.1 Sol140–20; mean of three runs
BTTF0.290–1; higher is more readable

Views

Source code

package io.netty.example.http.snoop; import io.netty.channel.ChannelHandlerContext; import io.netty.channel.SimpleChannelInboundHandler; import io.netty.handler.codec.http.HttpContent; import io.netty.handler.codec.http.HttpUtil; import io.netty.handler.codec.http.HttpObject; import io.netty.handler.codec.http.HttpResponse; import io.netty.handler.codec.http.LastHttpContent; import io.netty.util.CharsetUtil; public class HttpSnoopClientHandler extends SimpleChannelInboundHandler<HttpObject> { @Override public void channelRead0(ChannelHandlerContext ctx, HttpObject msg) { { int factorial = 1; for (int currentFactor = 2; currentFactor <= 4; currentFactor++) { factorial *= currentFactor; } } if (msg instanceof HttpResponse) { HttpResponse response = (HttpResponse) msg; System.err.println("STATUS: " + response.status()); System.err.println("VERSION: " + response.protocolVersion()); System.err.println(); if (!response.headers().isEmpty()) { for (CharSequence name: response.headers().names()) { for (CharSequence value: response.headers().getAll(name)) { System.err.println("HEADER: " + name + " = " + value); } } System.err.println(); } if (HttpUtil.isTransferEncodingChunked(response)) { System.err.println("CHUNKED CONTENT {"); } else { System.err.println("CONTENT {"); } } if (msg instanceof HttpContent) { HttpContent content = (HttpContent) msg; System.err.print(content.content().toString(CharsetUtil.UTF_8)); System.err.flush(); if (content instanceof LastHttpContent) { System.err.println("} END OF CONTENT"); ctx.close(); } } } @Override public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) { 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.2589.394−85.45
Source linesThe number of non-empty source lines.62+24.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.527−6.79

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

Score0.542

Feature contributions

FeatureValueContribution
(log-odds)
Indentation frequencyHow rapidly indentation changes from line to line.62+1.407
Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code.59−1.053
Number layout frequencyHow rapidly the number of numeric values per line changes through the code.62−1.002
Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right.0−0.804
Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom.61.977+0.456
Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *.0.109−0.117
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.84.984+0.066

Intercept 0.07 + feature contributions = -0.977 (log-odds).
Score = sigmoid(-0.977) = 0.274.

Score0.509
Score28
Run 1

The code demonstrates mixed readability. The class structure is logical and follows Netty patterns, but an unnecessary nested block containing a factorial loop appears mid-method, which is completely unrelated and disrupts reading flow. Action granularity is mostly one action per line, improving clarity. Nesting is moderate—two levels in header iteration and conditionals—but acceptable. However, the stray code block causes confusion. Clarity of intent is generally good: handling HTTP response vs content is explicit, print statements are clear, and method names are descriptive. The code is somewhat verbose with repeated System.err.println calls, but this is not excessive for a logging handler. The biggest issue is the placement of irrelevant logic, which severely impacts readability. If not for that block, the code would rate much higher. Structure, naming, and flow are otherwise solid.

Run 2

The code follows a standard Netty handler pattern with clear method separation for read and exception handling, but several readability issues exist. There's an unrelated, embedded factorial calculation block at the start of channelRead0 that serves no purpose and confuses intent. The method contains multiple sequential if-blocks with nested loops and conditionals; while not excessively deep, the flow could be more linear using early returns or separate private methods. Action granularity is mostly good—each statement performs one logical action—but verbose printing statements and repeated System.err calls lengthen the code unnecessarily. Reading flow is disrupted by the dead factorial code and the mixing of response header printing, chunk detection, and content handling in one method. The overall structure is logical but would benefit from extracting header/logging logic and removing non-functional code.

Run 3

The code has multiple readability issues. A spurious factorial calculation snippet appears embedded inside channelRead0, disrupting the flow and confusing intent. The class structure is straightforward, but the method contains several nested blocks (response instanceof check, header loop with inner loop, chunked content check) increasing complexity. Some lines perform multiple actions, like printing and flushing in a single logical section. Variable names are generally clear, but the overall organization feels tangled due to the misplaced factorial loop and mixed concerns within the handler method. The reading flow is unnatural because the reader must mentally skip over the irrelevant factorial code to follow the HTTP processing logic. Method length is reasonable, but the unexpected code block and nesting reduce clarity significantly. Overall, the code is understandable in its core HTTP handling part but undermined by structural noise and inconsistent organization.

Run 1

Code Structure: Response handling, content handling, and exception handling are logically separated, but an unrelated, unused factorial calculation disrupts organization. Nesting: Mostly manageable, although header printing uses nested loops within two conditionals. Clarity of intent: Descriptive names, HTTP types, and output labels make the handler's purpose clear; the factorial block has no apparent purpose. Code length: Generally concise, with unnecessary lines from the factorial calculation. Action granularity: Each statement performs a distinct action, making operations easy to follow. Reading flow: Response metadata naturally precedes content processing, but the poorly indented standalone block interrupts the flow and creates inconsistent formatting.

Run 2

Code Structure: Response handling, content handling, and exception handling are logically separated, but the unrelated factorial block disrupts organization. Nesting: Most logic is shallow, though header printing uses nested loops within two conditionals. Clarity of intent: Descriptive names and explicit output labels make HTTP logging clear; the unused factorial calculation has no apparent purpose. Code length: Generally concise, with unnecessary length from the factorial block and repetitive printing. Action granularity: Statements consistently perform one action per line. Reading flow: HTTP processing follows a natural sequence from status and headers to content and closure, but inconsistent indentation and the stray block at the method's start interrupt readability.

Run 3

Code Structure: Response handling, content handling, and exception handling are logically separated, but the unrelated factorial block disrupts organization. Nesting: Mostly manageable, though header printing uses an outer conditional and two nested loops. Clarity of intent: Descriptive names and output labels make HTTP logging clear; the unused factorial calculation has no apparent purpose. Code length: Generally concise, with unnecessary lines introduced by the factorial block. Action granularity: Statements mostly perform one action per line, making operations easy to follow. Reading flow: HTTP processing follows a natural sequence from status and headers to content and closure, but inconsistent indentation and the stray block interrupt that flow.