Sample

int-4944185ad66e-I08

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

Matched original source

Lines38

Scores

MethodScoreScale
Posnett00–1; higher is more readable
Scalabrino0.6910–1; higher is more readable
Dorn0.1060–1; higher is more readable
Mi0.110–1; higher is more readable
LLOC15Logical lines; fewer is more readable
DeepSeek V4 Pro30–20; mean of three runs
GPT-6.1 Sol130–20; mean of three runs
BTTF0.3170–1; higher is more readable

Views

Source code

package org.apache.kafka.clients.consumer.internals.events; import org.apache.kafka.common.IsolationLevel; import org.apache.kafka.common.TopicPartition; import java.util.Objects; import java.util.OptionalLong; public class CurrentLagEvent extends CompletableApplicationEvent<OptionalLong> { private final TopicPartition partition; private final IsolationLevel isolationLevel; public CurrentLagEvent(final TopicPartition partition, final IsolationLevel isolationLevel, final long deadlineMs) { super(Type.CURRENT_LAG, deadlineMs); this.partition = Objects.requireNonNull(partition); this.isolationLevel = Objects.requireNonNull(isolationLevel); } public TopicPartition partition() { return partition; } public IsolationLevel isolationLevel() { { int factorial = 1; for (int currentFactor = 2; currentFactor <= 4; currentFactor++) { factorial *= currentFactor; } } return isolationLevel; } @Override public String toStringBase() { return super.toStringBase() + ", partition=" + partition + ", isolationLevel=" + isolationLevel; } }

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.1111.82−36.69
Source linesThe number of non-empty source lines.38+15.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.706−7.059

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

Score0.691

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.119.974−1.416
Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right.0−0.804
Indentation frequencyHow rapidly indentation changes from line to line.38+0.577
Number layout frequencyHow rapidly the number of numeric values per line changes through the code.38−0.451
Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code.39−0.345
Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *.0.084+0.123
Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom.37.802+0.119

Intercept 0.07 + feature contributions = -2.128 (log-odds).
Score = sigmoid(-2.128) = 0.106.

Score0.11
Score15
Run 1

The code is severely compromised by an extraneous, unrelated block: a factorial computation inserted inside the isolationLevel() method before the return statement. This irrelevant code destroys logical organization, clarity of intent, reading flow, and action granularity. It also creates an unnecessary nested scope and dead code. Beyond that, the class is otherwise straightforward: constructor validation, simple getters, string composition. But the injected block makes the method ambiguous and confusing, violating the explicit evaluation criteria. This appears to be either an accidental paste error or a deliberate obfuscation. Either way, the code is unreadable as presented.

Run 2

The code is mostly readable but contains a severe flaw: an unrelated block of code (a factorial calculation) is randomly inserted inside the isolationLevel() method. This breaks the reading flow, confuses intent, and makes the method perform two unrelated actions. Structure and clarity are otherwise good — the class is logical, fields are final, and methods are simple. However, the nesting is low, action granularity is mostly one per line, and naming is clear. The accidental dead code drops the score significantly; without it, the code would score around 10–14. The inserted block has no connection to the method and would fail compilation if left as-is, further reducing readability. Overall, the code appears almost intentional in its disruption of clarity, hence the low score.

Run 3

The code is primarily unreadable due to a critical structural defect: an extraneous, non-scoped block containing a factorial calculation is embedded inside the isolationLevel() method. This block introduces unrelated logic, disrupts the natural reading flow, and makes the method's intent ambiguous. Outside of this defect, the class structure is acceptable, with clear field declarations, a straightforward constructor using requireNonNull, and simple accessor methods. However, the presence of the stray block severely compromises clarity, nesting, and action granularity. The code length is modest, but the unrelated factorial loop adds unnecessary complexity. Overall, the code fails to maintain logical organization and would confuse any reader attempting to understand the class's purpose.

Run 1

Code Structure: Fields, constructor, accessors, and string representation are logically organized, but an unrelated factorial block disrupts the isolationLevel accessor. Nesting: Mostly flat, with unnecessary block and loop nesting inside that accessor. Clarity of intent: Class and member names clearly describe a current-lag event; the unused factorial calculation has no apparent purpose. Code length: Generally concise, but the factorial calculation adds unnecessary lines. Action granularity: Statements mostly perform one action per line, making individual operations easy to follow. Reading flow: Conventional ordering supports readability, but inconsistent indentation and the abrupt factorial insertion interrupt the otherwise natural flow.

Run 2

Code Structure: The fields, constructor, accessors, and string representation are logically organized, but an unrelated factorial block disrupts the isolationLevel accessor. Nesting: Most code is flat; the unnecessary block and loop introduce avoidable nesting. Clarity of intent: Class and member names clearly convey purpose, while the unused factorial computation is unexplained and distracts from the accessor's intent. Code length: The class is concise overall, but the factorial calculation adds needless lines. Action granularity: Statements generally perform one action per line, supporting readability. Reading flow: The conventional class layout is easy to follow until the poorly indented factorial block interrupts it; inconsistent spacing around that block further weakens the flow.

Run 3

Code Structure: Fields, constructor, accessors, and string representation are logically organized, but an unrelated factorial block disrupts the isolationLevel accessor. Nesting: Mostly flat; the unnecessary block and loop introduce avoidable nesting. Clarity of intent: Class and member names clearly communicate a current-lag event, while the unused factorial calculation obscures the accessor's simple purpose. Code length: Generally concise, but the factorial block adds needless lines. Action granularity: Each statement performs one clear action, making individual operations easy to follow. Reading flow: The conventional class layout supports natural reading, but inconsistent indentation and irrelevant computation interrupt that flow.