summaryrefslogtreecommitdiff
path: root/check-style.py
diff options
context:
space:
mode:
authorHunor Csomortáni <csomh@redhat.com>2022-12-02 14:32:50 +0100
committerCarlos Garnacho <carlosg@gnome.org>2022-12-07 12:29:23 +0100
commit2970ac3449d13734458da1e3738111010163d7d6 (patch)
tree9939fde0b352b071c0fa888c94f2c6b1b5bee458 /check-style.py
parenta066b1e607e182167f6e6e083df1e963df421ef9 (diff)
downloadtracker-2970ac3449d13734458da1e3738111010163d7d6.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.
Diffstat (limited to 'check-style.py')
-rwxr-xr-xcheck-style.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/check-style.py b/check-style.py
index 7275af042..8721b8589 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)