Skip to content

Commit

Permalink
Merge pull request Mbed-TLS#4253 from mstarzyk-mobica/long_url_in_cha…
Browse files Browse the repository at this point in the history
…ngelog_entry

Allow changelog entries to have URLs exceeding 80 char limit.
  • Loading branch information
gilles-peskine-arm authored Apr 15, 2021
2 parents c039514 + 9b31ad6 commit 9013489
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions scripts/assemble_changelog.py
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,8 @@ class ChangeLog:
# a version that is not yet released. Something like "3.1a" is accepted.
_version_number_re = re.compile(br'[0-9]+\.[0-9A-Za-z.]+')
_incomplete_version_number_re = re.compile(br'.*\.[A-Za-z]')
_only_url_re = re.compile(br'^\s*\w+://\S+\s*$')
_has_url_re = re.compile(br'.*://.*')

def add_categories_from_text(self, filename, line_offset,
text, allow_unknown_category):
Expand All @@ -219,12 +221,18 @@ def add_categories_from_text(self, filename, line_offset,
category.name.decode('utf8'))

body_split = category.body.splitlines()

for line_number, line in enumerate(body_split, 1):
if len(line) > MAX_LINE_LENGTH:
if not self._only_url_re.match(line) and \
len(line) > MAX_LINE_LENGTH:
long_url_msg = '. URL exceeding length limit must be alone in its line.' \
if self._has_url_re.match(line) else ""
raise InputFormatError(filename,
category.body_line + line_number,
'Line is longer than allowed: Length {} (Max {})',
len(line), MAX_LINE_LENGTH)
'Line is longer than allowed: '
'Length {} (Max {}){}',
len(line), MAX_LINE_LENGTH,
long_url_msg)

self.categories[category.name] += category.body

Expand Down

0 comments on commit 9013489

Please sign in to comment.