Sample

int-3f5a4f001e4d-I01

Remove line comments, block comments, and Javadoc

Matched original source

Lines19

Scores

MethodScoreScale
Posnett00–1; higher is more readable
Scalabrino0.4720–1; higher is more readable
Dorn0.0190–1; higher is more readable
Mi0.0770–1; higher is more readable
LLOC6Logical lines; fewer is more readable
DeepSeek V4 Pro160–20; mean of three runs
GPT-6.1 Sol180–20; mean of three runs
BTTF0.4460–1; higher is more readable

Views

Source code

package org.apache.kafka.security.authorizer; import org.apache.kafka.common.internals.Plugin; import org.apache.kafka.common.metrics.Metrics; import org.apache.kafka.common.resource.Resource; import org.apache.kafka.common.utils.Utils; import org.apache.kafka.server.authorizer.Authorizer; import java.util.Map; public class AuthorizerUtils { public static Plugin<Authorizer> createAuthorizer(String className, Map<String, Object> configs, Metrics metrics, String key, String role) throws ClassNotFoundException { Authorizer authorizer = Utils.newInstance(className, Authorizer.class); authorizer.configure(configs); return Plugin.wrapInstance(authorizer, metrics, key, "role", role); } public static boolean isClusterResource(String name) { return name.equals(Resource.CLUSTER_NAME); } }

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.1018.615−33.614
Source linesThe number of non-empty source lines.19+7.6
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.799−7.198

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

Score0.472

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.174−3.705
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
Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code.19+0.364
Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom.18.92−0.145
Indentation frequencyHow rapidly indentation changes from line to line.19−0.08
Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *.0.099−0.017

Intercept 0.07 + feature contributions = -3.92 (log-odds).
Score = sigmoid(-3.92) = 0.019.

Score0.077
Score6
Run 1

The code is concise and structurally sound, with clear separation of concerns between authorizer creation and cluster resource checking. The createAuthorizer method has a natural reading flow, instantiating, configuring, and wrapping the authorizer as distinct logical steps. Nesting is flat, and each method performs a single action or a clear sequence of related actions. Variable and method names are descriptive, though the parameter 'key' and hardcoded "role" string are slightly ambiguous. Overall, the implementation is straightforward, easily scannable, and demonstrates good readability practices for utility code.

Run 2

The code is compact and generally understandable, but it suffers from a long single-line method call with multiple arguments, reducing readability. The class structure is simple and flat, with clear method separation. However, the intent of 'createAuthorizer' is partially obscured by the overloaded parameters and the hardcoded 'role' string. The method name 'isClusterResource' is clear, but the implementation does not handle null input, which may be ambiguous. The code lacks comments or documentation, which would aid clarity, especially for the plugin wrapping and configuration steps. The import list is slightly redundant due to unused imports (e.g., 'Resource' is used, but 'Utils' and 'Metrics' are necessary; no unused imports detected). Overall, the code is readable for experienced developers but not exemplary.

Run 3

The code is concise and well-structured with a clear purpose: creating and configuring an Authorizer plugin, plus a helper method for cluster resource detection. It maintains a flat structure with no nested logic, uses one action per line, and follows a natural reading flow. Imports are organized, and method names are descriptive. Minor deductions for the slightly misleading parameter name `key` and the hardcoded string "role" in the Plugin.wrapInstance call, which could obscure intent, and for the unused `role` parameter in the method signature.

Run 1

Code Structure: A small utility class with two clearly separated methods and focused responsibilities. Nesting: No nested control flow, making both methods easy to follow. Clarity of intent: Descriptive method names and straightforward operations convey purpose; the generic parameter name 'key' and literal 'role' provide slightly less context. Code length: Concise, with no unnecessary statements, although the createAuthorizer signature is long and would benefit from line wrapping. Action granularity: Each statement performs one clear action: instantiate, configure, wrap, or compare. Reading flow: The authorizer setup follows a natural sequence, and the resource check is immediately understandable. Missing blank lines between the package declaration and import groups slightly reduce visual organization.

Run 2

Code Structure: Two small, focused utility methods provide logical organization. Nesting: No branching or nested blocks makes the code easy to scan. Clarity of intent: Descriptive method names and straightforward calls clearly convey authorizer creation and cluster-resource checking, though key and role could use contextual documentation. Code length: Concise, with no unnecessary logic; the long createAuthorizer signature would benefit from wrapping. Action granularity: Each statement performs one clear action. Reading flow: Instantiation, configuration, and wrapping follow a natural sequence. Minor formatting issues, including no separation between the package declaration and imports and no grouping of Java imports, slightly reduce readability.

Run 3

Code Structure: Two small utility methods provide clear, logical organization. Nesting: Both methods are flat, with no nested control flow. Clarity of intent: Descriptive method names and straightforward operations make their purposes clear, though parameters such as key and role could use documentation. Code length: The implementation is concise without unnecessary logic, but the long createAuthorizer signature reduces scanability. Action granularity: Each statement performs one distinct step: instantiate, configure, or wrap. Reading flow: Authorizer creation follows a natural sequence, and resource checking is immediately understandable. Separating the package declaration from imports and grouping Java imports consistently would improve presentation.