Sample
Dorn/python/87
Human rating uses the original dataset scale.
Scores
| Method | Score | Scale | Dataset rank (0–100) |
|---|---|---|---|
| Posnett | 0 | 0–1; higher is more readable | 23.4Δ 60.4 |
| Scalabrino | 0.593 | 0–1; higher is more readable | 58.5Δ 25.3 |
| Dorn | 0.511 | 0–1; higher is more readable | 43.7Δ 40.1 |
| Mi | 0.423 | 0–1; higher is more readable | 41.8Δ 42.1 |
| LLOC | 40 | Logical lines; fewer is more readable | 1.4Δ 82.5 |
| DeepSeek V4 Pro | 14.33 | 0–20; mean of three runs | 69.9Δ 13.9 |
| GPT-6.1 Sol | 15 | 0–20; mean of three runs | 52.8Δ 31.1 |
| BTTF | 0.6 | 0–1; higher is more readable | 73.3Δ 10.6 |
| Human | 3.81 | 1–5; original rating | 83.8 |
Views
Select the downloaded ZIP or its extracted folder. Files stay in your browser.
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. | 1534.05 | −50.624 |
| Source linesThe number of non-empty source lines. | 50 | +20 |
| Byte entropyHow varied the bytes in the source text are. Repeated bytes give a lower value; a more even mixture gives a higher value. | 3.952 | −5.928 |
Intercept 8.87 + feature contributions = -27.682 (log-odds).
Score = sigmoid(-27.682) = 0.
| Score | 0.593 |
|---|
Feature contributions
| Feature | Value | Contribution (log-odds) |
|---|---|---|
| Indentation frequencyHow rapidly indentation changes from line to line. | 50 | +0.992 |
| 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. | 64.627 | +0.928 |
| 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. | 51 | −0.769 |
| Number layout frequencyHow rapidly the number of numeric values per line changes through the code. | 50 | −0.727 |
| Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom. | 49.712 | +0.285 |
| Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *. | 0.09 | +0.067 |
Intercept 0.07 + feature contributions = 0.042 (log-odds).
Score = sigmoid(0.042) = 0.511.
| Score | 0.423 |
|---|
| Score | 40 |
|---|
Run 1
The code is moderately readable but has notable issues. Structure shows some logical organization with a try/finally for lock handling, but intent is unclear due to missing context (e.g., what error 995 means, relationship of FILE_NOTIFY_INFORMATION to buffer). Nesting is mostly flat, which is good, but the first if/else block feels incomplete without surrounding context. Code length is reasonable, but there’s duplication in the watcher/thread cleanup logic between setFilename and stop, reducing maintainability. Action granularity is mixed: some lines bundle multiple actions (e.g., creating DirectoryWatcher, thread setup, start), while cleanup is more granular. Reading flow is disrupted by the fragment at the top and unclear exception logic. Overall, it’s readable enough for developers familiar with the domain but lacks explanatory comments and refactoring to reduce redundancy.
Run 2
The code is generally structured logically and shows reasonable flat nesting. Most statements follow one-action-per-line and the intent is mostly clear, especially around locking and cleanup. However, some issues reduce readability: the first snippet starts mid-function and relies on surrounding context, making the flow ambiguous. The use of magic numbers (like 995 and FILE_NOTIFY_INFORMATION) without explanation hurts clarity. There is minor duplication between stop() and setFilename() cleanup logic, which could be refactored. The lock acquire/release pattern is consistent, but some variable assignments (like watcher/thread reset) are slightly repetitive. Overall, the code is above average but not highly polished.
Run 3
The code is generally readable with clear structure and logical organization. Classes are properly separated, and methods have single responsibilities. Nesting is moderate — the try/finally blocks with lock acquisition are standard patterns but add some depth. Intent is clear: filesystem notification with thread management. Code length is reasonable, though the watcher cleanup logic is duplicated between setFilename and stop, which could be extracted. Action granularity is mostly one action per line. Reading flow is natural with super() calls and conditional checks placed logically. Minor issues: the duplicated watcher/thread cleanup could be refactored into a helper method to improve maintainability, and the initial code fragment appears disconnected from the class definitions, slightly confusing the context. Overall, the code demonstrates good readability with clear naming conventions and straightforward control flow.
Run 1
Code Structure: Methods logically separate initialization, filename changes, stopping, and callbacks, though watcher cleanup is duplicated. Nesting: Generally moderate, with try/finally and conditional blocks adding manageable indentation. Clarity of intent: Class and method names communicate filesystem monitoring clearly, but error code 995 is unexplained and the opening fragment lacks context. Code length: Mostly concise; duplicated cleanup and an unnecessary else after return add avoidable length. Action granularity: Each statement performs one clear action, making state changes easy to follow. Reading flow: Lifecycle operations follow a natural sequence, but manual lock acquisition/release and the incomplete opening slightly interrupt readability.
Run 2
Code Structure: The class is logically organized into initialization, filename configuration, shutdown, and a callback, though the snippet begins mid-block and repeats cleanup logic. Nesting: Mostly shallow, with manageable conditionals inside try/finally blocks. Clarity of intent: Method names and watcher/thread attributes communicate purpose, but the magic number 995 and missing surrounding context obscure error handling. Code length: Generally concise; duplicated shutdown code and an unnecessary else after return add avoidable length. Action granularity: Each line performs a single clear operation. Reading flow: Lifecycle operations follow a natural sequence, but manual lock acquisition/release and the truncated opening make reading less smooth.
Run 3
Code Structure: Methods and class responsibilities are logically organized, though watcher cleanup is duplicated. Nesting: Mostly shallow, with manageable conditionals inside try/finally blocks. Clarity of intent: Names such as setFilename, DirectoryWatcher, and onFileChanged communicate purpose, but the unexplained error code 995 and truncated opening obscure context. Code length: Reasonably concise, although repeated cleanup and an unnecessary else after return add avoidable lines. Action granularity: Each statement performs a single clear action. Reading flow: Initialization, reconfiguration, shutdown, and the callback hook follow a natural order; explicit lock acquisition/release and the incomplete leading fragment slightly interrupt readability.