diff options
author | Hunor Csomortáni <csomh@redhat.com> | 2022-12-02 14:32:50 +0100 |
---|---|---|
committer | Hunor Csomortáni <csomh@redhat.com> | 2022-12-06 14:08:37 +0100 |
commit | 1493bf96101308762fd9c799d0c817619d463846 (patch) | |
tree | 22810f4ae3e65265f32be95b6c8a938bfe5f8732 | |
parent | ec17d19c76fdb53e5b0a96d3783403c7517abc26 (diff) | |
download | mutter-1493bf96101308762fd9c799d0c817619d463846.tar.gz |
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>
-rwxr-xr-x | check-style.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/check-style.py b/check-style.py index 9c3190576..94dcd2ad9 100755 --- a/check-style.py +++ b/check-style.py @@ -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) |