Sample

int-1fed6560051e-I12

Inline all eligible single-use intermediate local variables

Matched original source

Lines75

Scores

MethodScoreScale
Posnett00–1; higher is more readable
Scalabrino0.7810–1; higher is more readable
Dorn0.7310–1; higher is more readable
Mi0.5160–1; higher is more readable
LLOC18Logical lines; fewer is more readable
DeepSeek V4 Pro17.330–20; mean of three runs
GPT-6.1 Sol170–20; mean of three runs
BTTF0.6060–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 data) { super(ApiKeys.VOTE); this.data = data; } @Override public VoteRequest build(short version) { return new VoteRequest(data, version); } @Override public String toString() { return data.toString(); } } private final VoteRequestData data; private VoteRequest(VoteRequestData data, short version) { super(ApiKeys.VOTE, version); this.data = data; } @Override public VoteRequestData data() { return data; } @Override public AbstractResponse getErrorResponse(int throttleTimeMs, Throwable e) { return new VoteResponse(new VoteResponseData() .setErrorCode(Errors.forException(e).code())); } public static VoteRequest parse(Readable readable, short version) { return new VoteRequest(new VoteRequestData(readable, version), version); } public static VoteRequestData singletonRequest(TopicPartition topicPartition, String clusterId, int replicaEpoch, int replicaId, int lastEpoch, long lastEpochEndOffset, boolean preVote) { return new VoteRequestData() .setClusterId(clusterId) .setTopics(List.of( new VoteRequestData.TopicData() .setTopicName(topicPartition.topic()) .setPartitions(List.of( new VoteRequestData.PartitionData() .setPartitionIndex(topicPartition.partition()) .setReplicaEpoch(replicaEpoch) .setReplicaId(replicaId) .setLastOffsetEpoch(lastEpoch) .setLastOffset(lastEpochEndOffset) .setPreVote(preVote)) ))); } }

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.2525.522−83.342
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.021−6.032

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

Score0.781

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.902+0.637
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.261
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.999 (log-odds).
Score = sigmoid(0.999) = 0.731.

Score0.516
Score18
Run 1

The code is well-structured and highly readable. It follows clear organizational patterns with a builder pattern implementation, simple constructor delegation, and straightforward method overrides. Nesting is minimal except in the singletonRequest method where the chained List.of calls create some depth, but this is a common pattern that remains clear. Intent is explicit through descriptive method and variable names. Code length is concise without sacrificing clarity. Action granularity is excellent in most places, with each method performing a single logical operation. The singletonRequest method chains multiple setters but maintains readability through consistent indentation. Reading flow is natural, following a logical progression from class declaration through builder, constructor, and utility methods. Minor deductions for the multi-line chained call in singletonRequest which could be extracted, but overall this code represents production-quality readability.

Run 2

The code is well-structured and demonstrates good readability. It follows a clear class hierarchy (Builder pattern, AbstractRequest), with logical grouping of methods. Nesting is minimal except in `singletonRequest`, where the nested builder calls are justified by the data structure. Intent is clear: the Builder constructs requests, `data()` exposes data, and `getErrorResponse` handles errors concisely. Method and variable names are descriptive. The code is concise without sacrificing clarity, with each line generally focused on one action. The reading flow is natural, moving from constructor to builder to static utility methods. Minor deductions: the deeply chained `singletonRequest` could be slightly more readable with temporary variables, and `getErrorResponse` ignores `throttleTimeMs` without comment.

Run 3

The code is well-structured and readable. It follows a clear builder pattern, keeping class organization logical. Nesting is minimal except in the singletonRequest method, where a chain of builders creates some indentation, but the fluent API keeps intent clear. Each method has a single responsibility, and action granularity is mostly one per line. Variable and method names are descriptive, enhancing clarity. The reading flow is natural, moving from the builder to request construction, parsing, and response handling. Minor deductions come from the moderately nested builder chain in singletonRequest and the missing newline between the package and imports, but overall the code is concise, maintainable, and easy to follow.

Run 1

Code Structure: The request class is logically organized into a builder, data access, error handling, parsing, and a convenience factory. Nesting: Most methods are flat, but singletonRequest has deeply nested object construction and list wrapping. Clarity of intent: Descriptive method names and explicit setters communicate purpose well, though several similarly named epoch parameters require attention. Code length: Concise, with little unnecessary code. Action granularity: Most statements and setter calls occupy separate lines; nested constructor expressions combine several actions but remain manageable. Reading flow: Conventional Java patterns support a natural progression, although inconsistent indentation and clustered closing parentheses in singletonRequest interrupt the flow.

Run 2

Code Structure: The request class, nested builder, parsing method, and convenience factory are logically organized with clear responsibilities. Nesting: Most methods are flat, but singletonRequest contains several nested constructors and List.of calls, making its closing parentheses harder to follow. Clarity of intent: Descriptive method names, types, and setters communicate purpose well, although the seven-parameter factory requires careful reading. Code length: The implementation is concise without unnecessary logic or repetition beyond standard builder boilerplate. Action granularity: Most statements perform one clear action; fluent setters appear on separate lines, though singletonRequest combines substantial object construction into one expression. Reading flow: Short methods and conventional Java patterns provide a natural flow, slightly weakened by inconsistent indentation in the factory and tightly packed imports.

Run 3

Code Structure: Well-organized request class with a distinct builder and focused methods. Nesting: Most methods are flat, but singletonRequest nests topic and partition construction inside fluent setters, increasing visual complexity. Clarity of intent: Descriptive method names, parameter names, and setters make the purpose clear; the seven-parameter factory requires some attention. Code length: Concise, with little unnecessary code or repetition beyond standard builder boilerplate. Action granularity: Most statements perform one action, and chained setters are separated by line; nested constructor calls combine several operations within expressions. Reading flow: Methods follow a natural progression from construction to access, error handling, parsing, and convenience creation. Inconsistent indentation and clustered closing parentheses in singletonRequest slightly disrupt an otherwise readable flow.