text
stringlengths
0
828
if ':' not in line:
errors.append((""M110"", lineno))
else:
component, msg = line.split(':', 1)
if component not in components:
errors.append((""M111"", lineno, component))
return errors"
1657,"def _check_bullets(lines, **kwargs):
""""""Check that the bullet point list is well formatted.
Each bullet point shall have one space before and after it. The bullet
character is the ""*"" and there is no space before it but one after it
meaning the next line are starting with two blanks spaces to respect the
indentation.
:param lines: all the lines of the message
:type lines: list
:param max_lengths: maximum length of any line. (Default 72)
:return: errors as in (code, line number, *args)
:rtype: list
""""""
max_length = kwargs.get(""max_length"", 72)
labels = {l for l, _ in kwargs.get(""commit_msg_labels"", tuple())}
def _strip_ticket_directives(line):
return re.sub(r'( \([^)]*\)){1,}$', '', line)
errors = []
missed_lines = []
skipped = []
for (i, line) in enumerate(lines[1:]):
if line.startswith('*'):
dot_found = False
if len(missed_lines) > 0:
errors.append((""M130"", i + 2))
if lines[i].strip() != '':
errors.append((""M120"", i + 2))
if _strip_ticket_directives(line).endswith('.'):
dot_found = True
label = _re_bullet_label.search(line)
if label and label.group('label') not in labels:
errors.append((""M122"", i + 2, label.group('label')))
for (j, indented) in enumerate(lines[i + 2:]):
if indented.strip() == '':
break
if not re.search(r""^ {2}\S"", indented):
errors.append((""M121"", i + j + 3))
else:
skipped.append(i + j + 1)
stripped_line = _strip_ticket_directives(indented)
if stripped_line.endswith('.'):
dot_found = True
elif stripped_line.strip():
dot_found = False
if not dot_found:
errors.append((""M123"", i + 2))
elif i not in skipped and line.strip():
missed_lines.append((i + 2, line))
if len(line) > max_length:
errors.append((""M190"", i + 2, max_length, len(line)))
return errors, missed_lines"
1658,"def _check_signatures(lines, **kwargs):
""""""Check that the signatures are valid.
There should be at least three signatures. If not, one of them should be a
trusted developer/reviewer.
Formatting supported being: [signature] full name <email@address>
:param lines: lines (lineno, content) to verify.
:type lines: list
:param signatures: list of supported signature
:type signatures: list
:param alt_signatures: list of alternative signatures, not counted
:type alt_signatures: list
:param trusted: list of trusted reviewers, the e-mail address.
:type trusted: list
:param min_reviewers: minimal number of reviewers needed. (Default 3)
:type min_reviewers: int
:return: errors as in (code, line number, *args)
:rtype: list
""""""
trusted = kwargs.get(""trusted"", ())
signatures = tuple(kwargs.get(""signatures"", ()))
alt_signatures = tuple(kwargs.get(""alt_signatures"", ()))
min_reviewers = kwargs.get(""min_reviewers"", 3)
matching = []
errors = []
signatures += alt_signatures