Sample

int-2a2ac0cb43c0-I12

Inline all eligible single-use intermediate local variables

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 Pro180–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 highly readable and follows clean coding principles. It has a clear, logical structure with two concise methods that each serve a single purpose. Nesting is non-existent, and clarity of intent is strong: the method names clearly describe what each does. The code is concise without being overly compact, with one primary action per line. Reading flow is natural and straightforward. Minor improvements could include adding a private constructor to prevent instantiation of a utility class, which would slightly improve design, but this does not significantly affect readability.

Run 2

The code is highly readable with a clear, logical structure. It has a single, focused utility class containing two concise static methods. Nesting is completely flat, with no conditional blocks or loops. Intent is unambiguous: one method creates and configures an Authorizer plugin, while the other checks if a resource name is the cluster resource. Code length is minimal and appropriate for the functionality. Each method performs one clear action sequence — instantiate, configure, wrap, return — with clean separation of concerns. The import list is tidy and limited to what is needed. Reading flow is natural: the class name, method names, and parameters clearly convey purpose. Minor deductions: a missing blank line after the package/import block, and hardcoded string "role" could be a constant, but these are trivial style preferences that do not impact overall comprehension.

Run 3

The code is a small utility class with two methods that are logically organized and easy to follow. The createAuthorizer method clearly instantiates and configures an Authorizer, then wraps it in a Plugin. It is flat with no nesting and each action is broken into distinct lines, aiding readability. The isClusterResource method is concise and expresses its intent explicitly. Minor weaknesses: the parameter 'role' is passed as a string literal in Plugin.wrapInstance, which might be intentional but slightly obscures intent; also, the import of Resource could be more specific. Overall, the code is readable, concise, and well-structured with clear intent, natural reading flow, and appropriate granularity.

Run 1

Code Structure: A small utility class cleanly separates authorizer creation from resource identification. Nesting: Both methods are flat, with no nested control flow. Clarity of intent: Descriptive method names and straightforward operations make the purpose clear, although generic parameter names such as key and role provide limited context. Code length: The implementation is concise without unnecessary logic; the long createAuthorizer signature could be wrapped for readability. Action granularity: Each statement performs one clear action. Reading flow: Authorizer instantiation, configuration, and wrapping follow a natural sequence. Minor formatting improvements, including spacing between the package declaration and imports and grouping imports, would improve scanning.

Run 2

Code Structure: Two small, logically separated utility methods keep organization clear. Nesting: Both methods are flat, with no nested control flow. Clarity of intent: Descriptive method names and straightforward operations make the purpose apparent, though generic parameters such as key and the literal "role" provide limited context. Code length: The implementation is concise without unnecessary abstraction or repetition. Action granularity: Each statement performs one main action, clearly separating instantiation, configuration, and wrapping. Reading flow: Operations follow a natural sequence, but the long createAuthorizer signature and lack of spacing between the package declaration, imports, and class slightly reduce scanability.

Run 3

Code Structure: Two focused utility methods provide clear logical organization. Nesting: Both methods are flat, with no nested control flow. Clarity of intent: Descriptive method names and straightforward calls make authorizer creation and cluster-resource checking easy to understand, although key and role lack explanatory context. Code length: The implementation is concise without unnecessary logic, but the long createAuthorizer signature could be wrapped for readability. Action granularity: Each statement performs a distinct action on its own line. Reading flow: Instantiation, configuration, and wrapping follow a natural sequence; separating the package declaration from imports and grouping imports consistently would improve presentation.