Sample

int-4813a59a93be-I10

Remove about 40% of line-break groups while retaining structure

Matched original source

Lines51

Scores

MethodScoreScale
Posnett0.1720–1; higher is more readable
Scalabrino0.8170–1; higher is more readable
Dorn0.5380–1; higher is more readable
Mi0.0460–1; higher is more readable
LLOC5Logical lines; fewer is more readable
DeepSeek V4 Pro8.330–20; mean of three runs
GPT-6.1 Sol15.330–20; mean of three runs
BTTF0.7050–1; higher is more readable

Views

Source code

package org.apache.kafka.connect.connector.policy; import org.apache.kafka.common.Configurable; import org.apache.kafka.common.annotation.InterfaceAudience; import org.apache.kafka.common.config.ConfigDef; import org.apache.kafka.common.config.ConfigValue; import org.apache.kafka.connect.components.ConnectPlugin; import java.util.List; /** * An interface for enforcing a policy on overriding of Kafka client configs via the connector configs. * <p> * Common use cases are ability to provide principal per connector, <code>sasl.jaas.config</code> * and/or enforcing that the producer/consumer configurations for optimizations are within acceptable ranges. * <p>Kafka Connect discovers implementations of this interface using the Java {@link java.util.ServiceLoader} mechanism. * To support this, implementations of this interface should also contain a service provider configuration file in * {@code META-INF/services/org.apache.kafka.connect.connector.policy.ConnectorClientConfigOverridePolicy}. * <p> * Implement {@link org.apache.kafka.common.metrics.Monitorable} to enable the policy to register metrics. * The following tags are automatically added to all metrics registered: <code>config</code> set to * <code>connector.client.config.override.policy</code>, and <code>class</code> set to the * ConnectorClientConfigOverridePolicy class name. */ @InterfaceAudience.Public public interface ConnectorClientConfigOverridePolicy extends Configurable, AutoCloseable, ConnectPlugin { /** * Workers will invoke this before configuring per-connector Kafka admin, producer, and consumer client instances * to validate if all the overridden client configurations are allowed per the policy implementation. * This would also be invoked during the validation of connector configs via the REST API. * <p> * If there are any policy violations, the connector will not be started. * * @param connectorClientConfigRequest an instance of {@link ConnectorClientConfigRequest} that provides the configs * to be overridden and its context; never {@code null} * @return list of {@link ConfigValue} instances that describe each client configuration in the request and includes an {@link ConfigValue#errorMessages() error} if the configuration is not allowed by the policy; never null */ List<ConfigValue> validate(ConnectorClientConfigRequest connectorClientConfigRequest); /** * Configuration specification for this policy override. * * @return the configuration definition for this policy override; never null */ @Override default ConfigDef config() { return new ConfigDef(); } /** * Get the version of this component. * * @return the version, formatted as a String. The version may not be {@code null} or empty. */ @Override default String version() { return "undefined"; } }

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.724.925−23.923
Source linesThe number of non-empty source lines.51+20.4
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.612−6.917

Intercept 8.87 + feature contributions = -1.57 (log-odds).
Score = sigmoid(-1.57) = 0.172.

Score0.817

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.123.981−1.586
Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right.119.25+1.12
Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code.52−0.805
Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *.0.021+0.733
Number layout frequencyHow rapidly the number of numeric values per line changes through the code.1+0.398
Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom.50.856+0.301
Indentation frequencyHow rapidly indentation changes from line to line.19−0.08

Intercept 0.07 + feature contributions = 0.151 (log-odds).
Score = sigmoid(0.151) = 0.538.

Score0.046
Score5
Run 1

The code is a Java interface with clear documentation, but it suffers from significant formatting issues that hurt readability. The package and import statements are crammed onto single lines, making them hard to scan. Multiple declarations and annotations are placed on the same line (e.g., multiple imports, @Override annotations inline with method signatures). This violates the one-action-per-line principle and creates a cluttered appearance. While the interface structure itself is logical with descriptive Javadoc comments explaining intent well, the dense formatting obscures it. Nesting is minimal which helps, and method names are reasonably descriptive, but code length is inflated by poor line organization rather than unnecessary logic. The reading flow is disrupted by having to parse multiple logical elements packed into single lines. The documentation within Javadoc is clear, but the structural formatting makes the overall code feel disorganized and difficult to review efficiently. With proper line breaks and reformatting, this would be quite readable, but as presented it falls below average.

Run 2

The code's readability is significantly hampered by formatting issues. Multiple statements are packed onto single lines, particularly in the import section where 'import' statements share lines with code, making the structure look tangled. Javadoc comments are malformed with incorrect line breaks, and annotations like '@Override' are placed on the same line as comments or other code. The action granularity suffers because multiple actions occur per line (e.g., 'default ConfigDef config() { return new ConfigDef(); }'). Nesting is minimal, which is good, but the clarity of intent is reduced by the compressed layout. The reading flow is disrupted by inconsistent spacing and line breaks. While the underlying interface is relatively simple and concise, the poor formatting makes it harder to scan and understand quickly.

Run 3

The code suffers from severe readability issues. The import statements are collapsed onto a single line with multiple imports, violating the one-import-per-line convention. The class-level Javadoc is cramped with imports and annotations, lacking proper spacing and line breaks. There are inconsistencies in bracket placement and indentation, particularly in the default methods where opening braces appear on the same line and closing braces on new lines without proper alignment. The Javadoc for the validate method contains a line break mid-sentence that disrupts reading flow. While the interface itself has clear purpose and logical method separation, the formatting makes it difficult to parse. The action granularity is generally acceptable within method bodies, but the overall structure is tangled due to poor whitespace management. The code would benefit significantly from automated formatting and proper import organization.

Run 1

Code Structure: The interface is logically organized, with validation, configuration, and version methods clearly separated, but compressed imports and inconsistent formatting weaken presentation. Nesting: Minimal nesting makes the code easy to follow. Clarity of intent: Descriptive names and thorough Javadoc explain the policy's purpose and method contracts. Code length: The implementation is concise; documentation is lengthy but relevant. Action granularity: Several imports and declarations share lines, and inline method bodies reduce visual separation. Reading flow: Methods follow a natural sequence, but annotations attached to comment endings, uneven whitespace, and the inconsistently formatted version method interrupt scanning.

Run 2

Code Structure: The interface is logically organized around validation, configuration, and version methods, but compressed imports and inconsistent formatting weaken presentation. Nesting: Minimal nesting makes the code easy to follow. Clarity of intent: Descriptive names and detailed Javadoc clearly explain the policy contract and expected behavior. Code length: The implementation is concise; documentation is extensive but mostly useful. Action granularity: Several imports share lines, and method declarations and return statements are compressed together, reducing scanability. Reading flow: The conceptual progression is natural, but annotations attached to comment endings, excess blank lines, and inconsistent method-body formatting interrupt the visual flow.

Run 3

Code Structure: The interface is logically organized, with related methods and useful documentation, though package/import declarations are compressed together. Nesting: Minimal nesting makes the code easy to follow. Clarity of intent: Descriptive names and detailed Javadoc clearly explain the policy, validation contract, and defaults. Code length: The implementation is concise; documentation is lengthy but mostly relevant. Action granularity: Several declarations share lines, and inline method bodies reduce visual separation, although each method performs only one simple action. Reading flow: The progression from interface purpose to validation, configuration, and version is natural, but inconsistent brace placement, annotations attached to comment endings, extra blank lines, and uneven Javadoc formatting interrupt scanning.