Commit 5b0e7103 authored by Francesco Witz's avatar Francesco Witz
Browse files

Merge branch 'fix' into 'main'

fix: section detection with empty changelog file

See merge request !10
parents 51ec4db1 1972745f
......@@ -17,11 +17,14 @@ class File():
lines: list[str] = file.readlines()
# Creating regex to find section title
version_pattern = re.compile("## \[[0-9].[0-9].[0-9]\] - [0-9]+-[0-9]+-[0-9]+")
# Checking the lines one by one
for l in lines:
# If we find a section title, return line index
if version_pattern.match(l):
return lines.index(l)
if len(lines) > 5:
# Checking the lines one by one
for l in lines:
# If we find a section title, return line index
if version_pattern.match(l):
return lines.index(l)
else:
return 5
def read_chlog(self) -> list[str]:
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment