Sample
Schnappinger/diarymanagement/TBA.Logging.TBALogger
Human rating uses the original dataset scale.
Scores
| Method | Score | Scale | Dataset rank (0–100) |
|---|---|---|---|
| Posnett | 0 | 0–1; higher is more readable | 65.9Δ 61.6 |
| Scalabrino | 0.882 | 0–1; higher is more readable | 84.2Δ 80.0 |
| Dorn | 0.472 | 0–1; higher is more readable | 59.1Δ 54.8 |
| Mi | 0.818 | 0–1; higher is more readable | 97.7Δ 93.4 |
| LLOC | 24 | Logical lines; fewer is more readable | 54.3Δ 50.0 |
| DeepSeek V4 Pro | 10 | 0–20; mean of three runs | 9.6Δ 5.3 |
| GPT-6.1 Sol | 14 | 0–20; mean of three runs | 16.2Δ 11.9 |
| BTTF | 0.764 | 0–1; higher is more readable | 92.1Δ 87.8 |
| Human | 2 | 1–4; original rating | 4.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. | 1720.703 | −56.783 |
| Source linesThe number of non-empty source lines. | 116 | +46.4 |
| 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.694 | −7.041 |
Intercept 8.87 + feature contributions = -8.554 (log-odds).
Score = sigmoid(-8.554) = 0.
| Score | 0.882 |
|---|
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. | 115 | −3.035 |
| Indentation frequencyHow rapidly indentation changes from line to line. | 64 | +1.477 |
| Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom. | 114.815 | +1.195 |
| Number layout frequencyHow rapidly the number of numeric values per line changes through the code. | 64 | −1.048 |
| Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *. | 0.048 | +0.476 |
| Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right. | 79.233 | +0.474 |
| 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. | 79.948 | +0.279 |
Intercept 0.07 + feature contributions = -0.113 (log-odds).
Score = sigmoid(-0.113) = 0.472.
| Score | 0.818 |
|---|
| Score | 24 |
|---|
Run 1
The code has inconsistent indentation, mixed tabs and spaces, and Javadoc comments that inaccurately describe constructors when the methods are static. Logical errors exist, such as the condition `logfile.compareTo("") == 0 || logfile != null`, which can cause a NullPointerException. The `removeConsole()` method removes the first handler without checking if it is actually the console handler, and ignores handler count. The class structure is generally flat, but the methods are not entirely cohesive; `setup()` overloads duplicate logic. Import statements include unused entries. Overall, the intent is understandable for a simple logging utility, but these issues make the code confusing and unsafe.
Run 2
The code has clear intent and is logically organized with separated methods, but suffers from several readability issues. The boolean condition `if(logfile.compareTo("") == 0 || logfile != null)` is ambiguous and likely incorrect, undermining clarity. Inconsistent indentation with mixed tabs/spaces disrupts reading flow. There is dead or unused imported classes. Javadoc comments are verbose and often poorly worded, adding length without improving understanding. Variable naming like `fileTxt` is not descriptive, and actions are combined in some lines. Nesting is minimal, which is good, but the overall structure could be more concise. Error handling and redundant logger creation further reduce clarity.
Run 3
The code is generally organized with clear method separation and Javadoc comments, but suffers from several readability issues. The conditional `if(logfile.compareTo("") == 0 || logfile != null)` is logically inverted and confusing - it suggests the file handler is created when the string is empty or not null, which is essentially always true but contradicts the apparent intent. Variable declarations like `fileTxt` are unnecessarily pre-declared, and mixing tabs and spaces creates inconsistent indentation. The class Javadoc and method comments are verbose relative to the simple logic. The `removeConsole()` method assumes index 0 is ConsoleHandler, which is fragile and unclear without a guard check. There's also no consistency between the two `setup()` overloads in how they apply handlers. While each method performs one logical action, the flow is somewhat disjointed, and unused imports like `Handler` and `ConsoleHandler` are declared but not properly utilized. The overall action granularity is acceptable, but the nesting and clarity of intent need improvement.
Run 1
Code Structure: Small, logically separated methods organize logger setup and configuration, although setup logic is duplicated. Nesting: Shallow conditionals and a single loop make control flow easy to follow. Clarity of intent: Method names mostly communicate purpose, but documentation incorrectly calls methods constructors, some comments are misleading, and removeConsole assumes the first handler is the console handler. The logfile condition is confusing: it dereferences before checking null and accepts every non-null string. Code length: Implementation is reasonably concise, but repetitive Javadoc and duplicated setup steps add unnecessary length. Action granularity: Each statement performs one clear action, aiding readability. Reading flow: Operations follow a natural sequence, but inconsistent indentation, mixed tabs and spaces, and uneven formatting interrupt scanning.
Run 2
Code Structure: Small, logically separated methods organize logger setup, level changes, and handler removal, though setup logic is duplicated. Nesting: Shallow conditionals and a single loop make control flow easy to follow. Clarity of intent: Method names and documentation communicate the overall purpose, but comments incorrectly call methods constructors, removeConsole assumes the first handler is the console handler, and the logfile condition is confusing and null-unsafe. Code length: Implementation is reasonably concise, but repetitive setup and verbose documentation add unnecessary length. Action granularity: Statements generally perform one action per line, supporting readability. Reading flow: Method ordering is natural, but inconsistent indentation, mixed tabs and spaces, outdated metadata, and misleading comments interrupt the flow.
Run 3
Code Structure: Small, focused methods provide logical organization, but the setup overloads duplicate initialization. Nesting: Shallow conditionals and a single loop make control flow easy to follow. Clarity of intent: Method names and logging API calls mostly communicate purpose, but the logfile condition is confusing and null-unsafe. Documentation incorrectly calls methods constructors, and removeConsole removes the first handler rather than explicitly identifying a console handler. Code length: Implementation is reasonably concise, though repetitive Javadoc, obvious comments, and duplicated setup code add noise. Action granularity: Statements generally perform one action per line. Reading flow: Method ordering is natural, but inconsistent indentation, mixed tabs and spaces, and misleading comments interrupt scanning.