Skip to content

Commit

Permalink
Use 'enumerate' in main loop
Browse files Browse the repository at this point in the history
  • Loading branch information
cbbayburt committed Nov 30, 2023
1 parent 6653077 commit 8b4660c
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions .github/workflows/changelogs/changelogs.py
Original file line number Diff line number Diff line change
Expand Up @@ -375,11 +375,8 @@ def validate_chlog_file(self, file: str) -> tuple[list[Issue], list[Entry]]:
issues = []
entries = []
entry_buf: list[str] = [] # List to buffer the lines in a single changelog entry
line_no = 0

for line in f:
line_no += 1

for line_no, line in enumerate(f):
if not line.endswith("\n"):
issues.append(Issue(IssueType.MISSING_NEWLINE, file))

Expand Down Expand Up @@ -423,6 +420,7 @@ def validate_chlog_file(self, file: str) -> tuple[list[Issue], list[Entry]]:
issues.append(Issue(IssueType.TRAIL_WHITESPACE, file, line_no))

# EOF
line_no += 1
if entry_buf:
# Validate and append the last entry
entry = self.get_entry_obj(entry_buf, file, line_no + 1)
Expand Down

0 comments on commit 8b4660c

Please sign in to comment.