Sample

int-2121c8097198-I09

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

Matched original source

Lines95

Scores

MethodScoreScale
Posnett00–1; higher is more readable
Scalabrino0.6050–1; higher is more readable
Dorn0.3480–1; higher is more readable
Mi0.3240–1; higher is more readable
LLOC27Logical lines; fewer is more readable
DeepSeek V4 Pro15.670–20; mean of three runs
GPT-6.1 Sol140–20; mean of three runs
BTTF0.3250–1; higher is more readable

Views

Source code

package org.apache.kafka.controller; import org.apache.kafka.common.errors.ThrottlingQuotaExceededException; import org.apache.kafka.common.message.RequestHeaderData; import org.apache.kafka.common.security.auth.KafkaPrincipal; import org.apache.kafka.common.utils.Time; import org.apache.kafka.server.authorizer.AuthorizableRequestContext; import java.util.OptionalLong; import java.util.function.Consumer; import static java.util.concurrent.TimeUnit.MILLISECONDS; import static java.util.concurrent.TimeUnit.NANOSECONDS; public class ControllerRequestContext { public static OptionalLong requestTimeoutMsToDeadlineNs( Time time, int millisecondsOffset ) { return OptionalLong.of(time.nanoseconds() + NANOSECONDS.convert(millisecondsOffset, MILLISECONDS)); } private final KafkaPrincipal principal; private final OptionalLong deadlineNs; private final RequestHeaderData requestHeader; private final Consumer<Integer> partitionChangeQuotaApplier; public ControllerRequestContext( RequestHeaderData requestHeader, KafkaPrincipal principal, OptionalLong deadlineNs ) { this(requestHeader, principal, deadlineNs, __ -> { }); } public ControllerRequestContext( RequestHeaderData requestHeader, KafkaPrincipal principal, OptionalLong deadlineNs, Consumer<Integer> partitionChangeQuotaApplier ) { this.requestHeader = requestHeader; this.principal = principal; this.deadlineNs = deadlineNs; this.partitionChangeQuotaApplier = partitionChangeQuotaApplier; } public ControllerRequestContext( AuthorizableRequestContext requestContext, OptionalLong deadlineNs ) { this(requestContext, deadlineNs, __ -> { }); } public ControllerRequestContext( AuthorizableRequestContext requestContext, OptionalLong deadlineNs, Consumer<Integer> partitionChangeQuotaApplier ) { this( new RequestHeaderData() .setRequestApiKey((short) requestContext.requestType()) .setRequestApiVersion((short) requestContext.requestVersion()) .setCorrelationId(requestContext.correlationId()) .setClientId(requestContext.clientId()), requestContext.principal(), deadlineNs, partitionChangeQuotaApplier ); } public RequestHeaderData requestHeader() { return requestHeader; } public KafkaPrincipal principal() { return principal; } public OptionalLong deadlineNs() { {int lI0O_4ebc1c37=0x993;boolean lI0O_fa6192e1=true;do{lI0O_4ebc1c37^=0x993;lI0O_fa6192e1=false;}while(lI0O_fa6192e1);} return deadlineNs; } /** * Apply the partition change quota. * * @param requestedPartitionCount The value to apply. * @throws ThrottlingQuotaExceededException If recording this value moves a metric beyond its configured * maximum or minimum bound */ public void applyPartitionChangeQuota(int requestedPartitionCount) { partitionChangeQuotaApplier.accept(requestedPartitionCount); } }

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.2737.589−90.34
Source linesThe number of non-empty source lines.95+38
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.745−7.118

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

Score0.605

Feature contributions

FeatureValueContribution
(log-odds)
Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code.96−2.363
Indentation frequencyHow rapidly indentation changes from line to line.89+2.341
Number layout frequencyHow rapidly the number of numeric values per line changes through the code.89−1.621
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.118.99−1.375
Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right.118.938+1.115
Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom.94.85+0.916
Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *.0.067+0.29

Intercept 0.07 + feature contributions = -0.627 (log-odds).
Score = sigmoid(-0.627) = 0.348.

Score0.324
Score27
Run 1

The code demonstrates excellent readability with clear organization, purposeful imports, and well-named classes/methods. Constructor overloading is used effectively to provide default behavior while maintaining clarity. The static factory-like method for requestTimeoutMsToDeadlineNs is concise and well-documented. Nesting is minimal, with most logic flat and readable. Action granularity is generally good—one logical operation per line in constructors and methods. However, there are minor issues: an odd do-while loop with obfuscated variable names appears to be test/debug code that should be removed, and the line-wrapping in the requestTimeoutMsToDeadlineNs method could be more compact. Overall, the code is highly readable and maintainable.

Run 2

The code is generally well-structured with clear separation of concerns, flat nesting, and good naming conventions. It uses constructor overloading effectively with sensible delegations. However, readability is significantly impacted by the obfuscated dead code block (the do-while loop with meaningless variable names) inside deadlineNs(), which appears to be injected nonsense or a security test artifact. Additionally, the lambda parameter named '__' is slightly unconventional and could be clearer. The requestTimeoutMsToDeadlineNs method is concise and clear. Overall, the code follows good Java practices, but the malformed block prevents a higher readability score.

Run 3

The code is generally well-structured, with clear naming, a clean class layout, and good use of constructors for convenience. However, there are notable readability problems. A meaningless do-while loop with an obfuscated variable name (`lI0O_4ebc1c37`) is confusing and appears to be leftover or intentionally inserted dead code. The static method `requestTimeoutMsToDeadlineNs` puts the time conversion logic on one line, reducing clarity just slightly. Constructor chaining through an `AuthorizableRequestContext` uses a fluent `RequestHeaderData` builder but packs multiple actions into a single method chain, harming action granularity and readability. The inclusion of multiple constructors with overlapping parameters and a lambda no-op default (`__ -> { }`) is acceptable but not immediately obvious to a first-time reader. Overall the structure is logical, but obfuscated code and dense chaining lower the readability score.

Run 1

Code Structure: Fields, constructor overloads, accessors, and quota handling are logically organized, but deadlineNs() contains an unrelated obfuscated block. Nesting: Most code is flat; the unnecessary block and do-while loop add avoidable nesting. Clarity of intent: Descriptive names and quota documentation clarify the class's purpose, while cryptic local variables and meaningless operations obscure the accessor. Code length: Generally concise, with constructor delegation reducing duplication, but the injected block adds needless length. Action granularity: Most statements occupy separate lines; the obfuscated block compresses declarations, assignments, and loop control onto one line. Reading flow: Constructors and accessors follow a natural progression, interrupted sharply by the dense, irrelevant code in deadlineNs().

Run 2

Code Structure: Fields, delegating constructors, accessors, and quota handling are logically organized, but an unrelated block disrupts deadlineNs(). Nesting: Most code is flat; the accessor introduces unnecessary block and do-while nesting. Clarity of intent: Descriptive names and quota documentation clarify the class, while opaque variable names, hexadecimal constants, and purposeless operations obscure the accessor. Code length: Generally concise, with reasonable constructor overloads, but the inserted block adds needless code. Action granularity: Most statements occupy separate lines; the inserted block compresses declarations, assignments, and loop control onto one line. Reading flow: Constructor delegation and straightforward accessors read naturally, but inconsistent formatting and the obfuscated block interrupt an otherwise clean flow.

Run 3

Code Structure: Fields, delegating constructors, accessors, and quota handling are logically organized, but an unrelated block disrupts deadlineNs(). Nesting: Most code is flat; the accessor introduces an unnecessary nested block and do-while loop. Clarity of intent: Descriptive names and documentation make the class understandable, except for the opaque variables, hexadecimal constant, and pointless mutations in the accessor. Code length: Generally concise, though the injected block adds needless code. Action granularity: Most statements occupy separate lines, but the entire distracting block compresses several declarations and operations onto one line. Reading flow: Constructor delegation and the fluent header construction read naturally; the abrupt, poorly formatted accessor block significantly interrupts that flow.