Sample
Dorn/python/97
Human rating uses the original dataset scale.
Scores
| Method | Score | Scale | Dataset rank (0–100) |
|---|---|---|---|
| Posnett | 0.001 | 0–1; higher is more readable | 60.7Δ 34.0 |
| Dorn | 0.78 | 0–1; higher is more readable | 75.5Δ 19.2 |
| Mi | 0.408 | 0–1; higher is more readable | 39.8Δ 54.9 |
| LLOC | 19 | Logical lines; fewer is more readable | 35.5Δ 59.2 |
| DeepSeek V4 Pro | 16 | 0–20; mean of three runs | 84.5Δ 10.2 |
| GPT-6.1 Sol | 15.33 | 0–20; mean of three runs | 58.6Δ 36.1 |
| BTTF | 0.618 | 0–1; higher is more readable | 78.3Δ 16.4 |
| Human | 4.11 | 1–5; original rating | 94.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. | 849.407 | −28.03 |
| Source linesThe number of non-empty source lines. | 48 | +19.2 |
| 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.488 | −6.732 |
Intercept 8.87 + feature contributions = -6.693 (log-odds).
Score = sigmoid(-6.693) = 0.001.
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. | 49 | −0.699 |
| Indentation frequencyHow rapidly indentation changes from line to line. | 38 | +0.577 |
| 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. | 73 | +0.573 |
| Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *. | 0.039 | +0.562 |
| Number layout frequencyHow rapidly the number of numeric values per line changes through the code. | 38 | −0.451 |
| Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right. | 73 | +0.373 |
| Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom. | 47.892 | +0.26 |
Intercept 0.07 + feature contributions = 1.266 (log-odds).
Score = sigmoid(1.266) = 0.78.
| Score | 0.408 |
|---|
| Score | 19 |
|---|
Run 1
The code is well-structured with clear imports, error handling, and separated functions. It uses flat nesting with minimal indentation levels, making control flow easy to follow. Intent is clearly stated in the docstring and function names. The code is concise without unnecessary verbosity. Each action is on its own line, including function calls and timer setup. Reading flow is natural: imports, error checks, function definitions, and main execution. Minor deductions: Python 2 syntax (e.g., `except ImportError,err`, `print` statement) may confuse modern readers, and the global timer variable could be better documented. The try/except blocks are slightly repetitive but acceptably so. Overall, the code is highly readable and maintainable.
Run 2
The code is generally readable: it has a clear structure with imports, a utility function, and a main function. Nesting is minimal and intent is mostly clear. However, readability issues reduce the score. The script uses Python 2 syntax (`except ImportError,err`, `print`), which is obsolete. The docstring is verbose and mixes explanation with a warning that could be more concise. The `main()` function uses `global timer`, which is slightly ambiguous without context. The timer setup is compact but the chained `timer.connect(timer, qt.SIGNAL(...), msg)` combines multiple actions on one line, lowering action granularity. The `if __name__ == '__main__':` block is empty, which disrupts reading flow. Overall, the code is understandable but could be more concise and modernized.
Run 3
The code is clear and logically organized with a simple structure. It has minimal nesting, which helps readability. The variables, functions, and imports are named descriptively, and the code includes comments explaining behavior. However, the use of Python 2 syntax (e.g., `print` statement, `except ImportError, err`) may confuse readers expecting modern Python. The final `if __name__ == '__main__':` lacks a call to `main()`, which makes the script incomplete and slightly ambiguous. The action granularity is mostly one action per line, and the reading flow is natural. Overall, it is quite readable but could benefit from updating the syntax and adding the missing function call.
Run 1
Code Structure: Imports, dependency checks, callback, and timer setup are logically separated, but the final entry-point guard has no body, leaving the script incomplete. Nesting: Shallow nesting makes the code easy to scan. Clarity of intent: The docstring and messages explain the timer demonstration and its lifetime caveat, although names such as msg are generic and the global timer introduces implicit state. Code length: Short and focused; the dependency-installation message is somewhat lengthy but useful. Action granularity: Each statement generally performs one action, and multiline calls remain clear. Reading flow: The progression from dependency checks to callback and setup is natural, but the unfinished entry point abruptly breaks the flow and obscures how main is invoked.
Run 2
Code Structure: Imports, dependency checks, callback, and timer setup are logically separated, but the final main guard has no body, leaving the script incomplete. Nesting: Shallow blocks make the code easy to follow. Clarity of intent: The introductory docstring and user-facing messages clearly explain the timer demonstration; however, names such as msg and the positional True argument are less descriptive. Code length: The script is concise overall, with a somewhat lengthy but useful dependency-error message. Action granularity: Each statement performs a single clear action, and multiline calls remain readable. Reading flow: The progression from dependency checks to callback and setup is natural, but the empty entry-point block interrupts completion. Global timer state adds some cognitive overhead, though its lifetime implications are explicitly documented.
Run 3
Code Structure: Imports, dependency checks, callback, and timer setup are logically separated, though the final entry-point block is incomplete. Nesting: Shallow exception handlers and simple functions make the code easy to scan. Clarity of intent: The introductory docstring and dialog messages clearly explain the timer demo; however, the generic callback name 'msg', global timer state, and positional boolean argument are less explicit. Code length: The script is concise, with a somewhat lengthy but useful dependency error message. Action granularity: Each statement performs one main action, and multiline calls are formatted clearly. Reading flow: Execution proceeds naturally from dependency checks to function definitions, but the empty '__main__' block abruptly interrupts the flow and leaves the intended invocation missing.