Whole file
t3rn0/ast-comments
The author described this change as “fix: ignore empty lines when searching for not-comment line”. It counts as a record because the check below fails on the code as it stood at 616909288 and passes on f9b0221ae, with nothing else changed between the two runs.
Projectt3rn0/ast-comments
Fix saved2023-10-25
Sharing licenceMIT · LICENSE
Change size+2 −0
What the code was meant to do, written into the code itself as a save note
fix: ignore empty lines when searching for not-comment line
The change
| 196 | 196 | # In each block there must be at least one, otherwise the code is not valid | |
| 197 | 197 | def _get_first_line_not_comment(lines: _t.List[str]): | |
| 198 | 198 | for line in lines: | |
| 199 | + | if not line.strip(): | |
| 200 | + | continue | |
| 199 | 201 | if not re.match(r"^ *#.*", line): | |
| 200 | 202 | return line | |
| 201 | 203 | return "" |
The check that tells the two apart
fail→pass·test_parse.py::test_empty_line_not_affect_comment_placement
Check file test_parse.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 it61690928820e7446a4b76dd65d53fd88727cf0ce
Broken version dated2023-10-15
Moduleast_comments
Units changed_get_first_line_not_comment
Fingerprintdaef96e607c66124
Checked2026-08-18 by goldset/0.1
Every field above is generated by our program. None of it is written by hand.