Sample
Schnappinger/junit4/org.junit.validator.AnnotationsValidator
Human rating uses the original dataset scale.
Scores
| Method | Score | Scale | Dataset rank (0–100) |
|---|---|---|---|
| Posnett | 0 | 0–1; higher is more readable | 36.8Δ 3.5 |
| Scalabrino | 0.438 | 0–1; higher is more readable | 5.5Δ 27.9 |
| Dorn | 0.821 | 0–1; higher is more readable | 88.4Δ 55.1 |
| Mi | 0.101 | 0–1; higher is more readable | 10.6Δ 22.8 |
| LLOC | 38 | Logical lines; fewer is more readable | 44.6Δ 11.2 |
| DeepSeek V4 Pro | 15.67 | 0–20; mean of three runs | 43.9Δ 10.6 |
| GPT-6.1 Sol | 17 | 0–20; mean of three runs | 55.3Δ 21.9 |
| BTTF | 0.592 | 0–1; higher is more readable | 56.8Δ 23.4 |
| Human | 3.2 | 1–4; original rating | 33.3 |
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. | 3659.592 | −120.767 |
| Source linesThe number of non-empty source lines. | 120 | +48 |
| 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.409 | −6.614 |
Intercept 8.87 + feature contributions = -70.51 (log-odds).
Score = sigmoid(-70.51) = 0.
| Score | 0.438 |
|---|
Feature contributions
| Feature | Value | Contribution (log-odds) |
|---|---|---|
| Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code. | 121 | −3.248 |
| Indentation frequencyHow rapidly indentation changes from line to line. | 108 | +2.998 |
| 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. | 119.992 | −1.417 |
| Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom. | 119.901 | +1.266 |
| Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right. | 119.967 | +1.131 |
| 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.064 | +0.322 |
Intercept 0.07 + feature contributions = 1.52 (log-odds).
Score = sigmoid(1.52) = 0.821.
| Score | 0.101 |
|---|
| Score | 38 |
|---|
Run 1
The code demonstrates good structure with clear separation of concerns via class hierarchy and follows the single responsibility principle. However, the private static methods introduce nesting and parameter passing that could be simplified. The code uses a factory pattern and generics appropriately but has minor inconsistencies (spacing before '=', unnecessary fully qualified type in Arrays.asList). Method names are descriptive, but the indirection between validateAnnotatable(T) and validateAnnotatable(AnnotationValidator, T) adds cognitive overhead. Overall, readable but with room for simplification.
Run 2
The code is well-structured with clear separation of concerns via a template method pattern. The use of generics and abstract classes adds clarity but also some cognitive overhead. Nesting is minimal (max 3 levels), and each method has a single responsibility. Variable names are descriptive, and the flow from top-level validator to specific annotatable validators is logical. Minor issues: slight inconsistency in spacing (e.g., 'validationErrors= new'), redundant local variable in validateTestClass, and some line breaks that feel forced. The code is concise but could benefit from small refactors like extracting a helper to add errors. Overall, it is highly readable for experienced Java developers.
Run 3
The code is well-structured, using an interface, abstract class, and subclasses to separate validation concerns by element type (class, method, field). This keeps methods flat and focused. Naming is generally clear, and actions are mostly one per line. However, readability is slightly reduced by some verbose formatting (line-wrapped assignments), a stray semicolon after the FieldValidator class, and repetitive validation-loop logic across methods. The abstract class centralizes shared logic well, but the double validateAnnotatable overloads could be slightly confusing. Overall, the code is readable and maintainable but not perfectly concise.
Run 1
Code Structure: Well organized around a shared generic validator and three focused specializations, separating common logic from class-, method-, and field-specific behavior. Nesting: Shallow overall, with only a conditional inside the annotation loop. Clarity of intent: Descriptive names and documentation clearly communicate annotation validation and error collection; overloaded validation methods and generics add modest cognitive overhead. Code length: Reasonably concise for the functionality, though repeated error-aggregation patterns and adapter classes introduce some boilerplate. Action granularity: Statements generally perform one action each, with intermediate variables making operations explicit. Reading flow: Progresses naturally from the public entry point through shared processing to specialized implementations. Awkward line wrapping, inconsistent spacing around assignments, a documentation typo, and the unnecessary final semicolon slightly detract from readability.
Run 2
Code Structure: Well-organized, with a shared generic validator and small class-, method-, and field-specific implementations. Nesting: Shallow control flow; the deepest logic is an if inside a loop, though nested classes add some conceptual depth. Clarity of intent: Descriptive names and documentation clearly communicate annotation validation and error collection; overloaded validateAnnotatable methods require slight attention. Code length: Reasonably concise through reuse, although repeated error-collection patterns and verbose generic declarations add boilerplate. Action granularity: Statements generally perform one action each, making operations easy to follow. Reading flow: Validation proceeds naturally from the test class to its elements and annotations, but frequent line wrapping, inconsistent spacing around assignments, a documentation typo, and an unnecessary trailing semicolon slightly reduce polish.
Run 3
Code Structure: Well organized around a shared generic validator with focused class, method, and field implementations. Nesting: Shallow loops and a single conditional keep control flow manageable, although nested classes introduce some structural depth. Clarity of intent: Descriptive names and documentation clearly communicate annotation validation and error collection; overloaded validateAnnotatable methods require minor extra attention. Code length: Reasonably concise, with some repetitive error aggregation and subclass boilerplate. Action granularity: Statements generally perform one action per line; wrapped expressions remain understandable. Reading flow: Proceeds naturally from orchestration to shared logic and specialized implementations. Inconsistent assignment spacing, awkward line wrapping, a documentation typo, and an unnecessary trailing semicolon slightly reduce polish.