Sample
Dorn/python/89
Human rating uses the original dataset scale.
Scores
| Method | Score | Scale | Dataset rank (0–100) |
|---|---|---|---|
| Posnett | 0 | 0–1; higher is more readable | 40.9Δ 51.0 |
| Scalabrino | 0.455 | 0–1; higher is more readable | 36.0Δ 55.9 |
| Dorn | 0.645 | 0–1; higher is more readable | 57.4Δ 34.5 |
| Mi | 0.37 | 0–1; higher is more readable | 36.2Δ 55.7 |
| LLOC | 21 | Logical lines; fewer is more readable | 29.7Δ 62.3 |
| DeepSeek V4 Pro | 15.67 | 0–20; mean of three runs | 82.6Δ 9.3 |
| GPT-6.1 Sol | 17 | 0–20; mean of three runs | 80.4Δ 11.6 |
| BTTF | 0.568 | 0–1; higher is more readable | 66.0Δ 25.9 |
| Human | 3.99 | 1–5; original rating | 91.9 |
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. | 1089.656 | −35.959 |
| 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.901 | −7.351 |
Intercept 8.87 + feature contributions = -15.24 (log-odds).
Score = sigmoid(-15.24) = 0.
| Score | 0.455 |
|---|
Feature contributions
| Feature | Value | Contribution (log-odds) |
|---|---|---|
| Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right. | 93.959 | +0.712 |
| Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code. | 49 | −0.699 |
| Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *. | 0.042 | +0.537 |
| 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. | 93.98 | −0.315 |
| Indentation frequencyHow rapidly indentation changes from line to line. | 30 | +0.301 |
| Number layout frequencyHow rapidly the number of numeric values per line changes through the code. | 30 | −0.268 |
| Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom. | 47.863 | +0.259 |
Intercept 0.07 + feature contributions = 0.597 (log-odds).
Score = sigmoid(0.597) = 0.645.
| Score | 0.37 |
|---|
| Score | 21 |
|---|
Run 1
The code has clear top-level structure with a logical separation of constants, a single function, and a main loop. Nesting is minimal and each line is focused, aiding readability. The function name clearly indicates intent. However, several issues reduce clarity: use of legacy Python 2 syntax (`print` statements, `file()`), ambiguous variable naming (`year`, `fp`), and a slightly obscure directory filtering condition ('.startswith('.') but not '..'). The main walk loop omits typical `os.walk` error handling and could be broken into smaller functions for better granularity. The code is concise, but line breaks around the copyright notice string and the conditional directory skip disrupt flow. Overall, it is readable but outdated and would benefit from modern conventions.
Run 2
The code is clean and well-organized with clear separation between configuration, logic, and execution. The `change_copyright_notice` function is focused and uses minimal nesting. Intent is explicit through descriptive names like `copyright_notice_last_year` and `change_copyright_notice`. The file-walking section is concise but the directory filtering logic (checking for dot-prefixed directories) is slightly less obvious than it could be. The use of `datetime.date.today().year` instead of a hardcoded year improves maintainability. Python 2 idioms (`print` statement, `file()` built-in) are technically dated but acceptable in context. The code performs one logical action per line and reads naturally from top to bottom. Overall, it demonstrates good readability with only minor room for improvement in commenting the hidden-directory filtering rationale.
Run 3
The code is generally clear and well-organized. It has a logical top-down structure: constants, a function, then the main loop. Nesting is shallow — only two levels in the loop and one in the function. Intent is clear from descriptive names like `change_copyright_notice` and variables such as `copyright_notice_last_year`. Length is concise for what it does. Action granularity is mostly good, though `contents = contents.replace(...)` performs two conceptual actions in one line. The reading flow is natural: setup, function definition, then execution. Minor drawbacks include the use of Python 2 syntax (`print` statements, `file()`), repeated `color` logic for directory filtering that could be extracted, and the multiple operations on one line in the replace assignment slightly hampering readability. Overall, it's accessible and maintainable.
Run 1
Code Structure: Logically separates copyright templates, file updating, and directory traversal, though a main function would better isolate execution. Nesting: Mostly shallow; the directory-filtering loop reaches three levels but remains manageable. Clarity of intent: The introductory comment and descriptive names clearly communicate the purpose. Global dependencies, the subtle directory-filtering condition, and replacing only the first occurrence require closer inspection. Code length: Compact without substantial unnecessary logic; the license header adds length but does not obscure the implementation. Action granularity: Generally one action per line, although combining imports slightly weakens consistency. Reading flow: Setup flows naturally into the helper function and traversal. Long lines and missing spacing around formatting and arithmetic operators modestly reduce scanability.
Run 2
Code Structure: Setup, file-update logic, and directory traversal are logically separated, though a main function would improve organization. Nesting: Mostly shallow; the directory-filtering loop adds modest nesting but remains easy to follow. Clarity of intent: The introductory comment and descriptive names clearly communicate the purpose; global dependencies and the '..' exclusion condition are less explicit. Code length: The executable code is concise, with no substantial duplication; the lengthy license header is standard boilerplate. Action granularity: Most lines perform one action, although combining imports slightly reduces consistency. Reading flow: The script progresses naturally from configuration to processing to traversal. Tight formatting around interpolation operators, long lines, and legacy Python syntax mildly reduce readability.
Run 3
Code Structure: A focused update function separates file handling from directory traversal, though configuration and execution remain at module level. Nesting: Mostly shallow, with modest nesting in traversal and file updates. Clarity of intent: Descriptive names and the introductory comment clearly convey the purpose; global dependencies and the unusual dot-directory exclusion condition require some interpretation. Code length: The implementation is concise without excessive abstraction; the lengthy license header adds scanning overhead but is appropriate metadata. Action granularity: Statements generally perform one action per line, although combining imports reduces consistency. Reading flow: Setup, function definition, and traversal follow a natural sequence. Minor spacing inconsistencies and legacy Python syntax slightly reduce readability.