Sample
Schnappinger/junit4/org.junit.internal.MethodSorter
Human rating uses the original dataset scale.
Scores
| Method | Score | Scale | Dataset rank (0–100) |
|---|---|---|---|
| Posnett | 0 | 0–1; higher is more readable | 49.5Δ 44.6 |
| Scalabrino | 0.694 | 0–1; higher is more readable | 37.0Δ 57.1 |
| Dorn | 0.36 | 0–1; higher is more readable | 52.5Δ 41.6 |
| Mi | 0.365 | 0–1; higher is more readable | 22.4Δ 71.6 |
| LLOC | 24 | Logical lines; fewer is more readable | 54.3Δ 39.8 |
| DeepSeek V4 Pro | 17 | 0–20; mean of three runs | 66.8Δ 27.2 |
| GPT-6.1 Sol | 18 | 0–20; mean of three runs | 73.8Δ 20.3 |
| BTTF | 0.565 | 0–1; higher is more readable | 52.1Δ 41.9 |
| Human | 4 | 1–4; original rating | 94.1 |
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. | 1867.718 | −61.635 |
| Source linesThe number of non-empty source lines. | 72 | +28.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.688 | −7.032 |
Intercept 8.87 + feature contributions = -30.997 (log-odds).
Score = sigmoid(-30.997) = 0.
| Score | 0.694 |
|---|
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. | 73 | −1.548 |
| 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. | 118.973 | −1.374 |
| Indentation frequencyHow rapidly indentation changes from line to line. | 55 | +1.165 |
| Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right. | 118.959 | +1.115 |
| Number layout frequencyHow rapidly the number of numeric values per line changes through the code. | 55 | −0.841 |
| Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom. | 71.875 | +0.595 |
| Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *. | 0.072 | +0.243 |
Intercept 0.07 + feature contributions = -0.576 (log-odds).
Score = sigmoid(-0.576) = 0.36.
| Score | 0.365 |
|---|
| Score | 24 |
|---|
Run 1
The code is well-structured with clear separation of concerns: comparators are defined as constants, the sorting logic is centralized in getDeclaredMethods, and helper methods have single responsibilities. Nesting is minimal with only one level of conditionals. Intent is clearly documented through Javadoc comments and descriptive method/field names. Code length is appropriate for the functionality. Action granularity is generally one action per line, though the ternary-like return in getSorter could be slightly more explicit. Reading flow is natural, progressing from public API to private helpers. Minor deductions: the DEFAULT comparator's hash-based comparison could use Integer.compare for clarity, and getSorter's null check adds slight cognitive overhead.
Run 2
The code is well-structured with clear separation of concerns: constants for comparators, a public API method, and a private helper. Nesting is minimal and flat. Intent is explicit through comments and method names like getSorter and getDeclaredMethods. The comparators are concise but slightly verbose due to anonymous class syntax; alternative approaches like lambda or Comparator.comparing could reduce length. Action granularity is appropriate, with one logical action per line in most cases. Reading flow is natural, though the Javadoc for getDeclaredMethods is somewhat lengthy and interrupts the code. Overall, readability is high with minor opportunities for modernization and brevity.
Run 3
The code is well-structured with clear separation of concerns: comparators are defined as constants, and helper methods are focused and single-purpose. Nesting is minimal, with only one level of anonymous inner classes and straightforward conditional logic. Intent is clearly communicated through descriptive names and Javadoc. Code length is concise and avoids unnecessary verbosity. Each line typically performs one logical action, promoting readability. The reading flow is natural: constants are introduced first, followed by the public API and private helpers. Minor deductions: anonymous inner classes could be replaced with lambdas for brevity, and the null-check in getDeclaredMethods could be clarified, but overall readability is high.
Run 1
Code Structure: Comparators, method retrieval, and annotation-based sorter selection are logically separated. Nesting: Shallow conditionals and early returns keep control flow simple, despite anonymous comparator classes. Clarity of intent: Descriptive method and constant names plus documentation explain deterministic sorting; DEFAULT's hash-based ordering and null meaning JVM order could be documented more explicitly. Code length: Implementation is concise, though anonymous classes and lengthy documentation add some bulk. Action granularity: Statements generally perform one action each; the nested annotation lookup remains easy to follow. Reading flow: Comparators precede their usage, and methods read naturally from lookup through optional sorting to return. Minor drawbacks include abbreviated comparator variables and placing the private constructor between related methods.
Run 2
Code Structure: Comparators, method retrieval, and annotation-based sorter selection are logically separated. Nesting: Shallow conditionals and early returns keep control flow simple, although anonymous comparator classes add structural nesting. Clarity of intent: Descriptive API names and documentation explain deterministic ordering and tie-breaking; DEFAULT's hash-based ordering and abbreviated variables i1/i2 are less immediately clear. Code length: Compact implementation with useful documentation, though anonymous classes add boilerplate. Action granularity: Each statement performs a focused action, with no crowded multi-statement lines. Reading flow: Comparator definitions lead naturally into their use, and the small helper is easy to follow; the private constructor between operational methods slightly interrupts the flow. Overall, highly readable with minor naming and boilerplate limitations.
Run 3
Code Structure: Well-organized utility class with separate comparators and a small helper for selecting the sort order. Nesting: Shallow conditionals and early returns keep control flow simple, although anonymous comparator classes add some visual nesting. Clarity of intent: Descriptive constants, method names, and documentation explain predictable method ordering; however, the DEFAULT comment does not explain hash-based ordering, and i1/i2 are vague names. Code length: Compact implementation with useful documentation, though anonymous classes introduce boilerplate. Action granularity: Statements generally perform one clear action per line; chained calls remain straightforward. Reading flow: Natural progression from sorting strategies to the public operation and supporting helper, with consistent formatting and spacing.