check-style: Start enumerating lines from 1
This way "the line before start" and "the line before end" can be expressed as "[start|end] - 1", which looks less like using a magic number. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2733>
This commit is contained in:
parent
ec17d19c76
commit
1493bf9610
@ -43,13 +43,13 @@ def reformat_chunks(chunks, rewrite):
|
||||
with open(file) as f:
|
||||
tmp = tempfile.NamedTemporaryFile()
|
||||
tmp.write(b'/** *INDENT-OFF* **/\n')
|
||||
for i, line in enumerate(f):
|
||||
if i == start - 2:
|
||||
for i, line in enumerate(f, start=1):
|
||||
if i == start - 1:
|
||||
tmp.write(b'/** *INDENT-ON* **/\n')
|
||||
|
||||
tmp.write(bytes(line, 'utf-8'))
|
||||
|
||||
if i == end - 2:
|
||||
if i == end - 1:
|
||||
tmp.write(b'/** *INDENT-OFF* **/\n')
|
||||
|
||||
tmp.seek(0)
|
||||
|
Loading…
Reference in New Issue
Block a user