From 1493bf96101308762fd9c799d0c817619d463846 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hunor=20Csomort=C3=A1ni?= Date: Fri, 2 Dec 2022 14:32:50 +0100 Subject: [PATCH] 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: --- check-style.py | 6 +++--- 1 file 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)