mirror of
https://github.com/yuzu-emu/mbedtls.git
synced 2024-12-23 08:55:42 +00:00
Merge pull request #4337 from gilles-peskine-arm/changelog_linelength_enforcement-2.16
Backport 2.16: Make assemble changelog script enforce line length
This commit is contained in:
commit
8d2b7aaede
|
@ -101,6 +101,9 @@ STANDARD_CATEGORIES = (
|
||||||
b'Changes',
|
b'Changes',
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# The maximum line length for an entry
|
||||||
|
MAX_LINE_LENGTH = 80
|
||||||
|
|
||||||
CategoryContent = namedtuple('CategoryContent', [
|
CategoryContent = namedtuple('CategoryContent', [
|
||||||
'name', 'title_line', # Title text and line number of the title
|
'name', 'title_line', # Title text and line number of the title
|
||||||
'body', 'body_line', # Body text and starting line number of the body
|
'body', 'body_line', # Body text and starting line number of the body
|
||||||
|
@ -241,6 +244,15 @@ class ChangeLog:
|
||||||
line_offset + category.title_line,
|
line_offset + category.title_line,
|
||||||
'Unknown category: "{}"',
|
'Unknown category: "{}"',
|
||||||
category.name.decode('utf8'))
|
category.name.decode('utf8'))
|
||||||
|
|
||||||
|
body_split = category.body.splitlines()
|
||||||
|
for line_number, line in enumerate(body_split, 1):
|
||||||
|
if len(line) > MAX_LINE_LENGTH:
|
||||||
|
raise InputFormatError(filename,
|
||||||
|
category.body_line + line_number,
|
||||||
|
'Line is longer than allowed: Length {} (Max {})',
|
||||||
|
len(line), MAX_LINE_LENGTH)
|
||||||
|
|
||||||
self.categories[category.name] += category.body
|
self.categories[category.name] += category.body
|
||||||
|
|
||||||
def __init__(self, input_stream, changelog_format):
|
def __init__(self, input_stream, changelog_format):
|
||||||
|
|
Loading…
Reference in a new issue