Sample
Schnappinger/junit4/org.junit.experimental.categories.CategoryValidator
Human rating uses the original dataset scale.
Scores
| Method | Score | Scale | Dataset rank (0–100) |
|---|---|---|---|
| Posnett | 0 | 0–1; higher is more readable | 46.5Δ 17.2 |
| Scalabrino | 0.593 | 0–1; higher is more readable | 21.6Δ 42.1 |
| Dorn | 0.492 | 0–1; higher is more readable | 60.1Δ 3.6 |
| Mi | 0.161 | 0–1; higher is more readable | 12.9Δ 50.8 |
| LLOC | 12 | Logical lines; fewer is more readable | 69.1Δ 5.4 |
| DeepSeek V4 Pro | 17.67 | 0–20; mean of three runs | 83.0Δ 19.3 |
| GPT-6.1 Sol | 17 | 0–20; mean of three runs | 55.3Δ 8.4 |
| BTTF | 0.592 | 0–1; higher is more readable | 57.1Δ 6.6 |
| Human | 3.95 | 1–4; original rating | 63.7 |
Views
Loading feature diagnosis…
Source regions
Feature contributions
Feature contributions
| Feature | Value | Contribution (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. | 1967.771 | −64.936 |
| Source linesThe number of non-empty source lines. | 62 | +24.8 |
| 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 = -38.465 (log-odds).
Score = sigmoid(-38.465) = 0.
| Score | 0.593 |
|---|
Feature contributions
| Feature | Value | Contribution (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. | 141.984 | −2.349 |
| Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right. | 141.984 | +1.486 |
| Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code. | 63 | −1.194 |
| Indentation frequencyHow rapidly indentation changes from line to line. | 47 | +0.889 |
| Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom. | 61.888 | +0.455 |
| Number layout frequencyHow rapidly the number of numeric values per line changes through the code. | 1 | +0.398 |
| Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *. | 0.075 | +0.214 |
Intercept 0.07 + feature contributions = -0.03 (log-odds).
Score = sigmoid(-0.03) = 0.492.
| Score | 0.161 |
|---|
| Score | 12 |
|---|
Run 1
The code is well-structured and readable. It has a clear single responsibility (validating Category annotation usage), flat nesting (only two levels), and descriptive method/variable names. Imports are organized, and Javadoc explains the purpose. The logic flows naturally: collect annotations, check against incompatible annotations, accumulate errors, return them. The main weakness is the double nested loop with an `isAssignableFrom` check that could be slightly clearer, but it is still understandable. Lines are concise and one action per line is generally followed.
Run 2
The code is well-structured with clear separation of concerns: constants, validation logic, and error reporting. Nesting is minimal (two nested loops plus one conditional), maintaining flat logic. Intent is explicit — the class and method names clearly describe validation of @Category with incompatible annotations. Length is concise; the validator is focused and avoids unnecessary code. Each line generally performs one action, improving readability. Reading flow is natural: from annotation collection to compatibility check to error accumulation. Minor deductions: the isAssignableFrom logic could be clearer, and the @SuppressWarnings("unchecked") suggests a minor type-safety compromise in the constant definition. Overall, the code is highly readable and maintainable.
Run 3
The code is highly readable. It has a clear, single-purpose class with a well-named method and helper. Structure is logical: constant declaration, then public validation method, then private helper. Nesting is only two levels deep in the validation loop, which is acceptable. Intent is explicit through method names, Javadoc, and the descriptive INCOMPATIBLE_ANNOTATIONS constant. Length is concise and focused. Action granularity is good—each line performs one coherent operation. Reading flow is natural, moving from inputs to processing to output. Minor deduction is for the slightly confusing use of isAssignableFrom (semantic inversion) and the absence of a direct import for unmodifiableSet/List could be a style choice, but overall clarity is excellent.
Run 1
Code Structure: Clearly organized into an immutable annotation set, a validation method, and an error-message helper. Nesting: Two nested loops plus a conditional add moderate depth, but the short body remains easy to follow. Clarity of intent: Descriptive names and documentation explain the validation purpose, although clazz is generic and the documentation misleadingly mentions adding to an errors parameter. Code length: Concise overall, with some verbosity from generic types and the collection initializer. Action granularity: Statements generally perform one action per line; the initializer combines several operations. Reading flow: Imports, configuration, validation, and message construction appear in a natural order. The long initializer and assignability check require slightly more effort to interpret.
Run 2
Code Structure: Well organized, with a constant defining incompatible annotations, a validation method, and a focused error-message helper. Nesting: Two nested loops and an if statement add moderate depth, but the small body remains easy to follow. Clarity of intent: Descriptive names and documentation clearly communicate the validation purpose; the generic name clazz and isAssignableFrom check require some interpretation. Code length: Concise overall, though verbose generics and documentation add visual weight, and the documentation misleadingly refers to an errors parameter. Action granularity: Statements generally perform one action per line, except the dense collection initialization combining several calls. Reading flow: Imports, configuration, validation, and error construction follow a natural sequence, with the long constant declaration being the main interruption.
Run 3
Code Structure: Well organized, with incompatible annotations defined centrally, validation in one method, and error construction in a helper. Nesting: Two nested loops and a conditional create moderate nesting, but the short body remains easy to follow. Clarity of intent: Descriptive names and documentation communicate the purpose clearly, although isAssignableFrom requires some interpretation and the Javadoc inaccurately refers to adding to an errors parameter. Code length: Concise overall, with slightly verbose generic syntax and documentation. Action granularity: Statements generally perform one action each; the nested collection construction in the constant declaration is comparatively dense. Reading flow: Imports, configuration, validation, and error formatting follow a natural order, with the long constant declaration being the main visual interruption.