Sample

int-1342811ef8f4-I08

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

Matched original source

Lines45

Scores

MethodScoreScale
Posnett00–1; higher is more readable
Scalabrino0.6970–1; higher is more readable
Dorn0.5060–1; higher is more readable
Mi0.0760–1; higher is more readable
LLOC9Logical lines; fewer is more readable
DeepSeek V4 Pro5.330–20; mean of three runs
GPT-6.1 Sol130–20; mean of three runs
BTTF0.4620–1; higher is more readable

Views

Source code

package io.netty.resolver.dns; import io.netty.channel.AddressedEnvelope; import io.netty.channel.Channel; import io.netty.channel.ChannelFuture; import io.netty.handler.codec.dns.DefaultDnsQuery; import io.netty.handler.codec.dns.DnsQuery; import io.netty.handler.codec.dns.DnsQuestion; import io.netty.handler.codec.dns.DnsRecord; import io.netty.handler.codec.dns.DnsResponse; import io.netty.util.concurrent.Future; import io.netty.util.concurrent.Promise; import java.net.InetSocketAddress; final class TcpDnsQueryContext extends DnsQueryContext { TcpDnsQueryContext(Channel channel, InetSocketAddress nameServerAddr, DnsQueryContextManager queryContextManager, DnsQueryLifecycleObserver lifecycleObserver, int maxPayLoadSize, boolean recursionDesired, long queryTimeoutMillis, DnsQuestion question, DnsRecord[] additionals, Promise<AddressedEnvelope<DnsResponse, InetSocketAddress>> promise) { super(channel, nameServerAddr, queryContextManager, lifecycleObserver, maxPayLoadSize, recursionDesired, // No retry via TCP. queryTimeoutMillis, question, additionals, promise, null, false); { int runningTotal = 0; for (int currentNumber = 1; currentNumber <= 5; currentNumber++) { runningTotal += currentNumber; } } } @Override protected DnsQuery newQuery(int id, InetSocketAddress nameServerAddr) { return new DefaultDnsQuery(id); } @Override protected String protocol() { return "TCP"; } }

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.1655.701−54.638
Source linesThe number of non-empty source lines.45+18
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.607−6.911

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

Score0.697

Feature contributions

FeatureValueContribution
(log-odds)
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.111.913−1.075
Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right.112+1.003
Indentation frequencyHow rapidly indentation changes from line to line.44+0.785
Number layout frequencyHow rapidly the number of numeric values per line changes through the code.44−0.589
Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code.45−0.557
Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom.44.912+0.218
Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *.0.079+0.171

Intercept 0.07 + feature contributions = 0.026 (log-odds).
Score = sigmoid(0.026) = 0.506.

Score0.076
Score9
Run 1

The code contains a critical structural error: a random loop block appears inside the constructor after the super() call, rendering the class logically broken. This block is misplaced and serves no purpose within the class, severely disrupting readability. Beyond this, the constructor has many parameters (10+), making it difficult to follow. A comment is awkwardly placed in the middle of the super() argument list. The nesting is shallow but the irrelevant loop adds confusion. Naming conventions like 'maxPayLoadSize' are inconsistent (capital 'L' in 'Load'). Indentation and brace placement are inconsistent. Overall the code fails to convey clear intent due to the erroneous block and overly long parameter list.

Run 2

The code is nearly unreadable due to a glaring structural error: an unrelated loop summing numbers from 1 to 5 has been incorrectly inserted inside the constructor body, breaking the class's logical organization and intent. This destroys clarity of intent, as the loop has nothing to do with the DNS query context. The import order is also inconsistent, though that is minor. Nesting is low, so that aspect is not problematic. However, the constructor already has many parameters, and the misplaced block makes the overall flow disorganized and inexplicable. Action granularity is reasonable, but reading flow is severely disrupted by the nonsense block. Code length is acceptable for a small class, but the erroneous addition undermines confidence in the code's maintainability. Overall, the file fails basic structural integrity and cannot be considered readable in its current state.

Run 3

The code has clear class structure and reasonable method organization, but several issues hurt readability. The constructor parameters are numerous and poorly aligned, with a misplaced comment breaking the flow. A stray loop fragment appears out of context inside the constructor, adding confusion. Nesting is minimal and action granularity is acceptable. Imports and class definition are clean. Variable names are clear in the loop, but the loop's purpose is unclear within its context. The overall code is functional but would benefit from parameter consolidation, removal of dead code, and better formatting alignment.

Run 1

Code Structure: The class has a conventional constructor and small overrides, but an unrelated summation block disrupts its logical organization. Nesting: Mostly shallow; the unnecessary constructor block and loop add avoidable nesting. Clarity of intent: Class and method names clearly describe TCP DNS behavior, while the unused runningTotal calculation has no apparent purpose. Code length: Generally concise, although the summation block and unused imports add noise, and the long constructor parameter list requires effort to follow. Action granularity: Statements generally perform one action per line; the loop header is conventional. Reading flow: The overrides read naturally, but inconsistent indentation around the inserted block and tightly packed imports reduce visual coherence.

Run 2

Code Structure: The class is logically organized into a constructor and two focused overrides, but the unrelated summation block disrupts cohesion. Nesting: Mostly shallow; the extra block and loop introduce modest, unnecessary nesting. Clarity of intent: Class and method names clearly communicate TCP DNS behavior, while the unused runningTotal calculation has no apparent purpose. The long positional superclass call also obscures argument meanings. Code length: Generally concise, but the summation adds unnecessary code. Action granularity: Statements mostly perform one action per line; some constructor parameters share lines, slightly reducing scanability. Reading flow: The overrides are straightforward, but inconsistent indentation around the inserted block and the lengthy constructor delegation interrupt otherwise natural flow.

Run 3

Code Structure: The class is logically organized into a constructor and two focused overrides, but an unrelated summation block disrupts cohesion. Nesting: Mostly shallow; the extra block and loop introduce minor unnecessary nesting. Clarity of intent: Class and method names clearly communicate TCP DNS behavior, while the unused runningTotal calculation has no apparent purpose. Code length: Generally concise, although the summation adds unnecessary lines and the constructor has a lengthy parameter list. Action granularity: Statements generally perform one action per line; the loop header conventionally combines initialization, condition, and increment. Reading flow: The overrides read naturally, but inconsistent indentation in the summation block and dense constructor arguments interrupt the flow.