Whole file
terryyin/lizard
The author described this change as “fix line counting with cpre”. It counts as a record because the check below fails on the code as it stood at 2a165bdd1 and passes on e22583990, with nothing else changed between the two runs.
Projectterryyin/lizard
Fix saved2016-02-28
Sharing licenceMIT · LICENSE.txt
Change size+6 −3
What the code was meant to do, written into the code itself as a save note
fix line counting with cpre
The change
| 24 | 24 | else_count -= last.count("#else") | |
| 25 | 25 | if last.startswith("#if"): | |
| 26 | 26 | break | |
| 27 | - | elif not else_count: | |
| 28 | - | if not (if_stack and if_stack[-1].startswith("#elif")): | |
| 29 | - | yield token | |
| 27 | + | elif not else_count and not ( | |
| 28 | + | if_stack and if_stack[-1].startswith("#elif")): | |
| 29 | + | yield token | |
| 30 | + | else: | |
| 31 | + | for _ in range(token.count('\n')): | |
| 32 | + | yield '\n' | |
| 30 | 33 | ||
| 31 | 34 | if "c" not in reader.ext: | |
| 32 | 35 | return tokens |
The check that tells the two apart
fail→pass·test/testCPreprocessorExtension.py::Test_end_2_end::test_line_counting
Check file test/testCPreprocessorExtension.py, taken without changes from the fix and copied onto the older code, so the exact same check runs against both versions.
Origin and history
The code before it2a165bdd1cb1b318a15bf6b1bfdce8bcc32d70df
Broken version dated2016-02-28
Modulelizard_ext.lizardcpre
Units changedLizardExtension
Fingerprinta525242a3d7c9f6e
Checked2026-08-18 by goldset/0.1
Every field above is generated by our program. None of it is written by hand.
Other bugs found in terryyin/lizard
- 2026-08-08fix(java): do not report control structures as methods
- 2026-07-02HalsteadClassifier
- 2026-07-02fix(csv): emit columns for extensions with multiple FUNCTION_INFO fields
- 2026-06-15fix(golike): register generic functions with [...] type params
- 2026-06-15fix(java): enhance parsing of generic and qualified type names in anonymous classes
- 2026-06-11fix(script): stop a '#' comment continuing past a trailing backslash (#317)