Sample

int-95a0f188f4bc-I01

Remove line comments, block comments, and Javadoc

Matched original source

Lines30

Scores

MethodScoreScale
Posnett00–1; higher is more readable
Scalabrino0.8840–1; higher is more readable
Dorn0.5730–1; higher is more readable
Mi0.4960–1; higher is more readable
LLOC11Logical lines; fewer is more readable
DeepSeek V4 Pro17.330–20; mean of three runs
GPT-6.1 Sol190–20; mean of three runs
BTTF0.6580–1; higher is more readable

Views

Source code

package org.apache.kafka.streams.internals; import org.apache.kafka.common.config.ConfigDef; import org.apache.kafka.common.config.ConfigException; import org.apache.kafka.common.utils.Utils; import org.apache.kafka.streams.state.HostInfo; public class ApplicationServerConfigValidator implements ConfigDef.Validator { @Override public void ensureValid(final String name, final Object value) { if (!(value instanceof String)) { throw new ConfigException(name + " must be a string"); } final String endPoint = (String) value; if (Utils.isBlank(endPoint)) { return; } try { HostInfo.buildFromEndpoint(endPoint); } catch (final ConfigException e) { throw new ConfigException(name, value, e.getMessage()); } } @Override public String toString() { return "A host:port pair, protocol://host:port, or an empty string"; } }

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.990.93−32.701
Source linesThe number of non-empty source lines.30+12
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.617−6.926

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

Score0.884

Feature contributions

FeatureValueContribution
(log-odds)
Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right.0−0.804
Number layout frequencyHow rapidly the number of numeric values per line changes through the code.1+0.398
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.78+0.361
Indentation frequencyHow rapidly indentation changes from line to line.29+0.266
Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code.31−0.061
Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *.0.091+0.058
Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom.29.924+0.008

Intercept 0.07 + feature contributions = 0.296 (log-odds).
Score = sigmoid(0.296) = 0.573.

Score0.496
Score11
Run 1

The code is well-structured with a clear single responsibility: validating endpoint configurations. It uses early returns to avoid unnecessary nesting and keeps logic flat. Each action is on its own line, improving readability. The method names and flow are intuitive, and exception handling is concise without being cryptic. The only minor deductions are for casting and the slightly implicit contract of 'HostInfo.buildFromEndpoint,' but overall it is clean, maintainable, and easy to follow.

Run 2

The code is highly readable. It has a clear, logical structure with a single-purpose class implementing a config validator. Nesting is minimal with only one level of depth. The method name 'ensureValid' clearly expresses intent, and the toString method neatly documents the expected format. The method is concise, avoiding unnecessary length. Each action (type check, null/blank check, endpoint parsing, exception handling) is on its own line, improving clarity. Reading flow is natural: validate type, allow blank, attempt parsing, wrap errors. Minor deductions could be made for the multiple return/throw paths, but overall this is exemplary readable code.

Run 3

The code is well-structured and readable. It has a clear purpose: validating application server configuration. The class and method names are descriptive. Nesting is minimal, with early exit for non-string values and blank strings, reducing complexity. Each line performs a single logical action, and the reading flow is natural. Error handling is explicit and properly wraps the original ConfigException with context. The only minor deductions are for the lack of explanatory comments about valid formats (though the toString method partially compensates) and the unusual capitalization/spacing in the package name. Overall, the code is concise, clear, and maintainable.

Run 1

Code Structure: A focused validator class cleanly separates validation from its descriptive string. Nesting: Shallow conditionals and an early return keep the main path flat; exception handling is straightforward. Clarity of intent: Descriptive names and standard validation patterns make the purpose clear, though acceptance of blank strings is implicit rather than explained. Code length: Concise, with no unnecessary logic or duplication. Action granularity: Each statement performs one distinct action, making the checks and exception conversion easy to follow. Reading flow: Validation proceeds naturally from type checking to blank-value handling to endpoint parsing. Minor formatting improvements, such as separating the package declaration from imports, would improve readability.

Run 2

Code Structure: A focused validator class cleanly separates validation from its descriptive string. Nesting: Shallow conditionals and an early return keep the main path flat; the try/catch is straightforward. Clarity of intent: Descriptive names and explicit checks clearly convey string-type validation, blank-value acceptance, and endpoint validation. Code length: Concise, with no unnecessary logic or duplication. Action granularity: Each statement performs one clear action, and the cast is separated from subsequent checks. Reading flow: Validation proceeds naturally from type checking to blank handling to endpoint parsing, with contextual exception reporting. Minor formatting improvements, such as a blank line after the package declaration and before the try block, would improve visual separation.

Run 3

Code Structure: Validation is logically organized into type checking, blank-value handling, and endpoint parsing. Nesting: Guard clauses keep control flow flat, with only a simple try/catch. Clarity of intent: The class and method names clearly convey validation, and toString documents accepted formats; delegating endpoint parsing slightly hides the validation details. Code length: Compact without unnecessary statements. Action granularity: Each statement performs a single clear action. Reading flow: Execution progresses naturally from basic checks to parsing and contextual error reporting. Minor formatting improvements, such as separating the package declaration from imports and adding a blank line before try, would improve readability.