From 89880e96b9c54af5dc5b6322c22a75acd1267df8 Mon Sep 17 00:00:00 2001 From: "Kelvin M. Klann" Date: Tue, 18 Oct 2022 04:10:32 -0300 Subject: sort.py: enumerate lines from 1 Instead of manually adding 1 to lineno. --- contrib/sort.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'contrib') diff --git a/contrib/sort.py b/contrib/sort.py index 6f21370ec..0758d5fec 100755 --- a/contrib/sort.py +++ b/contrib/sort.py @@ -53,7 +53,7 @@ def fix_profile(filename): lines = profile.read().split("\n") was_fixed = False fixed_profile = [] - for lineno, line in enumerate(lines): + for lineno, line in enumerate(lines, 1): if line[:12] in ("private-bin ", "private-etc ", "private-lib "): fixed_line = f"{line[:12]}{sort_alphabetical(line[12:])}" elif line[:13] in ("seccomp.drop ", "seccomp.keep "): @@ -69,8 +69,8 @@ def fix_profile(filename): if fixed_line != line: was_fixed = True print( - f"{filename}:{lineno + 1}:-{line}\n" - f"{filename}:{lineno + 1}:+{fixed_line}" + f"{filename}:{lineno}:-{line}\n" + f"{filename}:{lineno}:+{fixed_line}" ) fixed_profile.append(fixed_line) if was_fixed: -- cgit v1.2.3-70-g09d2