From 0ec59794615e711d181c9df7fe02f7daf1d5332d Mon Sep 17 00:00:00 2001 From: Paul Elliott Date: Thu, 18 Mar 2021 18:07:46 +0000 Subject: [PATCH] Pythonify and fix reported line number Use enumerate to give the line number and use the correct offset to actually calculate it. Signed-off-by: Paul Elliott --- scripts/assemble_changelog.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/scripts/assemble_changelog.py b/scripts/assemble_changelog.py index 96d2217a9..2c9fc0b29 100755 --- a/scripts/assemble_changelog.py +++ b/scripts/assemble_changelog.py @@ -246,14 +246,12 @@ class ChangeLog: category.name.decode('utf8')) body_split = category.body.splitlines() - line_number = 1 - for line in body_split: + for line_number, line in enumerate(body_split, 1): if len(line) > MAX_LINE_LENGTH: raise InputFormatError(filename, - line_offset + category.title_line + line_number, + category.body_line + line_number, 'Line is longer than allowed: Length {} (Max {})', len(line), MAX_LINE_LENGTH) - line_number += 1 self.categories[category.name] += category.body