Sample

int-92205a035f16-I03

Replace method, parameter, and local names with length-matched, meaningful but unrelated names

Matched original source

Lines75

Scores

MethodScoreScale
Posnett00–1; higher is more readable
Scalabrino0.7760–1; higher is more readable
Dorn0.730–1; higher is more readable
Mi0.5050–1; higher is more readable
LLOC18Logical lines; fewer is more readable
DeepSeek V4 Pro30–20; mean of three runs
GPT-6.1 Sol11.330–20; mean of three runs
BTTF0.5710–1; higher is more readable

Views

Source code

package org.apache.kafka.common.requests; import org.apache.kafka.common.TopicPartition; import org.apache.kafka.common.message.VoteRequestData; import org.apache.kafka.common.message.VoteResponseData; import org.apache.kafka.common.protocol.ApiKeys; import org.apache.kafka.common.protocol.Errors; import org.apache.kafka.common.protocol.Readable; import java.util.List; public class VoteRequest extends AbstractRequest { public static class Builder extends AbstractRequest.Builder<VoteRequest> { private final VoteRequestData data; public Builder(VoteRequestData step) { super(ApiKeys.VOTE); this.data = step; } @Override public VoteRequest merge(short address) { return new VoteRequest(data, address); } @Override public String loadItem() { return data.toString(); } } private final VoteRequestData data; private VoteRequest(VoteRequestData item, short history) { super(ApiKeys.VOTE, history); this.data = item; } @Override public VoteRequestData read() { return data; } @Override public AbstractResponse validateAccount(int pendingRequest, Throwable age) { return new VoteResponse(new VoteResponseData() .setErrorCode(Errors.forException(age).code())); } public static VoteRequest store(Readable nextData, short payload) { return new VoteRequest(new VoteRequestData(nextData, payload), payload); } public static VoteRequestData validateBalance(TopicPartition defaultRequest, String nextOrder, int activeBuffer, int nextState, int activeKey, long primaryAddress, boolean balance) { return new VoteRequestData() .setClusterId(nextOrder) .setTopics(List.of( new VoteRequestData.TopicData() .setTopicName(defaultRequest.topic()) .setPartitions(List.of( new VoteRequestData.PartitionData() .setPartitionIndex(defaultRequest.partition()) .setReplicaEpoch(activeBuffer) .setReplicaId(nextState) .setLastOffsetEpoch(activeKey) .setLastOffset(primaryAddress) .setPreVote(balance)) ))); } }

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.2563.76−84.604
Source linesThe number of non-empty source lines.75+30
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.027−6.041

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

Score0.776

Feature contributions

FeatureValueContribution
(log-odds)
Indentation frequencyHow rapidly indentation changes from line to line.75+1.857
Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code.76−1.655
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.74.829+0.636
Number layout frequencyHow rapidly the number of numeric values per line changes through the code.1+0.398
Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *.0.07+0.26
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.81+0.234

Intercept 0.07 + feature contributions = 0.997 (log-odds).
Score = sigmoid(0.997) = 0.73.

Score0.505
Score18
Run 1

The code has severe readability issues. Naming is misleading: 'merge' returns a VoteRequest, 'loadItem' calls toString, 'validateAccount' returns a response, 'store' parses data, and 'validateBalance' constructs a request. Method names suggest unrelated or inverted actions, making intent ambiguous. The structure is tangled—irrelevant imports (TopicPartition, Errors, Readable, List) and inconsistent parameter names ('step', 'address', 'item', 'history', 'age') obscure meaning. Deeply chained method calls in validateBalance create heavy nesting and blur logical grouping. Action granularity is poor; multiple operations are packed into single expressions. Reading flow is disorganized, jumping between unrelated concepts. Although the code is relatively short and has a flat class hierarchy, those benefits are undermined by poor naming and unclear responsibility assignment, making the code difficult to understand and maintain.

Run 2

This code shows severe readability problems across every criterion. The structure is tangled: methods are misleadingly named (merge, loadItem, read, validateAccount, store, validateBalance) and have no apparent relation to Kafka's actual VoteRequest API, suggesting obfuscation or generated confusion. Nesting is moderately deep but the real issue is ambiguous intent—parameters like 'history,' 'age,' 'nextOrder,' and 'activeKey' obscure meaning rather than clarify. Action granularity is inconsistent: validateBalance crams many operations into one chained expression, while other methods are trivial. Length is not the problem; clarity is. The reading flow is disorienting because naming and parameter types mislead the reader about what each method does. No JavaDoc or comments explain the distortions. This is effectively unreadable as a domain-specific class.

Run 3

The code is extremely difficult to read because the class, method, and variable names are semantically misleading. For example, 'VoteRequest' methods named 'loadItem', 'read', 'validateAccount', 'store', and 'validateBalance' have no clear relationship to their actual behavior. Parameters like 'address', 'history', 'age', 'nextData', 'payload', 'defaultRequest', 'nextOrder', 'activeBuffer', 'nextState', 'activeKey', 'primaryAddress', and 'balance' obscure intent. The 'validateBalance' method is deeply nested and returns a 'VoteRequestData' rather than performing validation, which violates clarity of intent and action granularity. The code structure is tangled, mixing builder, request, response, and data-construction logic within a single class. Reading flow is unnatural due to mismatched semantic naming, and the excessive nesting in the partition-data construction makes the logic hard to follow.

Run 1

Code Structure: The request class, nested builder, and helper methods are logically organized. Nesting: Most methods are flat, but the nested fluent construction of topics and partitions requires careful tracking of parentheses. Clarity of intent: Kafka types and setter names provide context, but misleading method names such as validateAccount and validateBalance, along with generic parameter names like history and nextState, obscure actual responsibilities. Code length: The implementation is concise, with little unnecessary code. Action granularity: Most statements perform one clear action; the final chained expression combines several construction steps, though individual setters occupy separate lines. Reading flow: The class follows a conventional layout, but inconsistent indentation, dense closing parentheses, and unclear naming interrupt otherwise straightforward reading.

Run 2

Code Structure: The request class, nested builder, and helper methods are logically organized. Nesting: Most methods are flat, but nested object construction and List.of calls make the final method harder to scan. Clarity of intent: Misleading names such as validateAccount, validateBalance, history, and primaryAddress obscure vote-request semantics; field setters reveal more intent than method parameters. Code length: The implementation is concise, with little unnecessary code. Action granularity: Most statements perform one clear action, although the final fluent construction combines several object creations and assignments into one expression. Reading flow: Short methods and consistent delegation support straightforward reading, but inconsistent indentation, tightly packed imports, and ambiguous naming interrupt comprehension.

Run 3

Code Structure: The request class, nested builder, and helper methods are logically organized. Nesting: Most methods are flat, but nested fluent construction of topics and partitions makes the final helper harder to scan. Clarity of intent: The main weakness is misleading names such as validateAccount, validateBalance, merge, and parameters like age and primaryAddress, which obscure their actual roles in vote requests. Code length: The class is compact, with little unnecessary code. Action granularity: Assignments and returns are generally separated cleanly; chained setters appear on individual lines, though nested constructors combine several operations in one expression. Reading flow: Conventional class layout supports navigation, but inconsistent indentation, tightly grouped imports, confusing terminology, and clustered closing parentheses interrupt comprehension.