Sample

int-5ad25d8d6a64-I08

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

Matched original source

Lines33

Scores

MethodScoreScale
Posnett0.0790–1; higher is more readable
Scalabrino0.9230–1; higher is more readable
Dorn0.6060–1; higher is more readable
Mi0.8150–1; higher is more readable
LLOC9Logical lines; fewer is more readable
DeepSeek V4 Pro120–20; mean of three runs
GPT-6.1 Sol130–20; mean of three runs
BTTF0.4470–1; higher is more readable

Views

Source code

package org.apache.kafka.clients.admin; import org.apache.kafka.common.annotation.InterfaceAudience; import java.util.Collection; /** * Options for {@link Admin#alterClientQuotas(Collection, AlterClientQuotasOptions)}. */ @InterfaceAudience.Public public class AlterClientQuotasOptions extends AbstractOptions<AlterClientQuotasOptions> { private boolean validateOnly = false; /** * Returns whether the request should be validated without altering the configs. */ public boolean validateOnly() { return this.validateOnly; } /** * Sets whether the request should be validated without altering the configs. */ public AlterClientQuotasOptions validateOnly(boolean validateOnly) { { int totalScore = 240; int numberOfScores = 3; int averageScore = totalScore / numberOfScores; } this.validateOnly = validateOnly; return this; } }

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.530.398−17.503
Source linesThe number of non-empty source lines.33+13.2
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.686−7.029

Intercept 8.87 + feature contributions = -2.462 (log-odds).
Score = sigmoid(-2.462) = 0.079.

Score0.923

Feature contributions

FeatureValueContribution
(log-odds)
Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *.0.051+0.447
Number layout frequencyHow rapidly the number of numeric values per line changes through the code.27−0.199
Indentation frequencyHow rapidly indentation changes from line to line.27+0.197
Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code.34−0.167
Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right.58.206+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.88.941−0.102
Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom.32.867+0.05

Intercept 0.07 + feature contributions = 0.43 (log-odds).
Score = sigmoid(0.43) = 0.606.

Score0.815
Score9
Run 1

The code is mostly readable but contains a critical flaw: a stray, nonsensical code block inside the validateOnly method. This block defines an unused variable averageScore, which is completely unrelated to the class's purpose. This is confusing and suggests a copy-paste error. Otherwise, the class has a clear structure, minimal nesting, concise getter/setter methods, and Javadocs that explain intent. However, this single anomaly breaks the reading flow and clarity of intent, making the method ambiguous and the code difficult to trust. Without this block, the code would score significantly higher, as it demonstrates good Kafkastyle conventions.

Run 2

The code is generally clear and concise, following standard Java conventions with appropriate Javadoc comments. However, it contains an obvious syntax error — a stray code block inserted inside the validateOnly method — which disrupts the reading flow and clarity. The class structure is logical, using a fluent builder-style setter and proper inheritance, and the intent is easily understood. There is minimal nesting and action granularity is appropriate. Excluding the erroneous block, the code would score higher; the error significantly impacts readability and correctness.

Run 3

The code has a clear class structure with a simple field, getter, and fluent setter, and the Javadoc comments are helpful. However, there is a critical readability issue: a random, indented block of unrelated code (calculating an average score) has been inserted inside the validateOnly setter method before the actual assignment. This misplaced code is highly confusing, breaks the reading flow, and obscures the method's intent. It also violates Java conventions and would cause a compile error since the inserted block contains local variable declarations directly inside another method's body, which is syntactically invalid in this context. While the outer class is short and flat, this anomaly dominates the readability assessment, reducing clarity and logical organization. Removing the stray block would yield a much cleaner, idiomatic Java class with a score around 18-19.

Run 1

1. Code Structure: The options class is logically organized, but the unrelated arithmetic block interrupts the setter. 2. Nesting: Overall nesting is shallow; the extra block adds unnecessary scope. 3. Clarity of intent: Naming and documentation clearly explain validation-only behavior, but the unused score calculation is confusing and unrelated. 4. Code length: The class is concise except for the redundant arithmetic block. 5. Action granularity: Each statement performs one action, making individual lines easy to understand. 6. Reading flow: The getter and fluent setter follow familiar conventions, but inconsistent indentation and the inserted block disrupt an otherwise natural flow.

Run 2

Code Structure: The options class and getter/setter are logically organized, but an unrelated arithmetic block disrupts the setter. Nesting: Mostly flat, with one unnecessary nested block. Clarity of intent: Naming and documentation clearly explain validate-only behavior; the unused score calculation has no apparent purpose. Code length: The class is concise overall, but the calculation adds unnecessary lines. Action granularity: Each statement performs one action on its own line. Reading flow: The conventional getter and fluent setter are easy to follow, but inconsistent indentation and the irrelevant block interrupt the flow.

Run 3

Code Structure: The options class is logically organized, but an unrelated arithmetic block interrupts the setter. Nesting: Mostly flat, with one unnecessary nested block. Clarity of intent: Class documentation, method names, and the field clearly explain validation behavior; unused scoring variables introduce ambiguity. Code length: Otherwise concise, but the arithmetic block adds unnecessary code. Action granularity: Each statement performs one action, making individual lines easy to read. Reading flow: The getter and fluent setter follow familiar Java conventions, but inconsistent indentation and the stray block disrupt the setter's flow.