Sample

int-af724394859f-I08

Select one of ten high-readability unrelated code templates per class

Matched original source

Lines25

Scores

MethodScoreScale
Posnett00–1; higher is more readable
Scalabrino0.510–1; higher is more readable
Dorn0.0130–1; higher is more readable
Mi0.1680–1; higher is more readable
LLOC9Logical lines; fewer is more readable
DeepSeek V4 Pro4.670–20; mean of three runs
GPT-6.1 Sol140–20; mean of three runs
BTTF0.1770–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 { { int totalScore = 240; int numberOfScores = 3; int averageScore = totalScore / numberOfScores; } 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.1162.425−38.36
Source linesThe number of non-empty source lines.25+10
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.829−7.244

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

Score0.51

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.173.962−3.703
Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right.0−0.804
Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code.24+0.187
Number layout frequencyHow rapidly the number of numeric values per line changes through the code.25−0.153
Indentation frequencyHow rapidly indentation changes from line to line.25+0.128
Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom.24.886−0.062
Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *.0.098−0.009

Intercept 0.07 + feature contributions = -4.347 (log-odds).
Score = sigmoid(-4.347) = 0.013.

Score0.168
Score9
Run 1

The code has a critical structural flaw: an orphaned block containing dead code (totalScore, numberOfScores, averageScore) that serves no purpose and disrupts the flow of the createAuthorizer method. This creates disorganized reading flow and ambiguity about intent. The method signatures and actual logic are relatively concise and flat, with one action per line for key operations. However, the unexplained empty block, terse parameter names like 'key' and 'role', and lack of comments or validation reduce clarity. The class is short, and imports are minimal, but the dead code block dominates the readability penalty. The proper code (excluding dead block) would score around 14, but the confusing artifact drops it significantly.

Run 2

The code is largely unreadable due to severe structural and logical issues. The presence of an orphaned, meaningless code block (declaring variables and computing an average) in the middle of createAuthorizer completely breaks the reading flow and indicates tangled logic or an editing artifact. The method imports ClassNotFoundException but does not throw it, creating ambiguity about intent. Naming is inconsistent: methods reference 'key' and 'role' parameters but hardcode the string 'role' as a key when wrapping. Action granularity is acceptable within the actual logic, but the overall organization is compromised. The isClusterResource method is simple, but the file lacks coherent structure and clear purpose due to the stray block and mismatched exception handling.

Run 3

The code is severely unreadable due to major structural and logical issues. A random block of dead code (totalScore, numberOfScores, averageScore) is inexplicably inserted inside the method, completely breaking logical organization and clarity of intent. The Action granularity and Reading flow are also poor because this dead code sits between the method signature and the actual logic, disrupting natural reading order. The method createAuthorizer mixes high-level concerns (instantiation, configuration, wrapping) with no helper breakdown, though the code length is short. The isClusterResource method is simple and clear, but the overall file is dominated by confusing structure and ambiguous purpose. Nesting is flat, which is the only positive aspect, but it does not compensate for the fundamental disorganization and dead code.

Run 1

Code Structure: The utility class has logically separated methods, but an unrelated averaging block disrupts createAuthorizer. Nesting: Mostly flat, with one unnecessary nested scope. Clarity of intent: Method names and the authorizer initialization sequence are clear; unused scoring variables introduce ambiguity. Code length: Generally concise, though the dead calculation adds unnecessary lines. Action granularity: Each statement performs one action, making individual operations easy to follow. Reading flow: Authorizer creation, configuration, and wrapping follow a natural sequence, but inconsistent indentation, sparse spacing, and the long method signature reduce readability.

Run 2

Code Structure: Two focused utility methods are logically organized, but the unrelated scoring block disrupts createAuthorizer. Nesting: Mostly flat, with one unnecessary nested block. Clarity of intent: Method names and authorizer initialization clearly communicate purpose; unused scoring variables introduce ambiguity. Code length: Generally concise, although the scoring block adds needless lines and the method signature is overly long. Action granularity: Each statement performs one action, making individual operations easy to follow. Reading flow: Instantiation, configuration, and wrapping follow a natural sequence, but inconsistent indentation, limited spacing around imports, and the irrelevant block interrupt readability.

Run 3

Code Structure: The class separates authorizer creation and resource checking into focused methods, but an unrelated scoring block disrupts organization. Nesting: Generally shallow, with one unnecessary nested block. Clarity of intent: Method names and authorizer operations communicate purpose clearly; unused scoring variables introduce ambiguity. Code length: Mostly concise, though the scoring block adds needless lines and the createAuthorizer signature is long. Action granularity: Each statement performs a single action, making operations easy to distinguish. Reading flow: Authorizer instantiation, configuration, and wrapping follow a natural sequence, but inconsistent indentation, sparse spacing around imports, and the unrelated block interrupt that flow.