Skip to content

Commit

Permalink
pr-tool: give hint about commit headline length limit
Browse files Browse the repository at this point in the history
  • Loading branch information
joergsteffens committed Apr 8, 2024
1 parent a3f149a commit 1ae9e8a
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions devtools/pip-tools/pr_tool/main.py
Expand Up @@ -183,8 +183,11 @@ def check_commit(self, commit):
def _check_headline(cls, text):
issues = []
# we encourage to use no more than 50 chars, but still accept up to 60
if len(text) > 60:
issues.append("headline too long")
max_headline_length = 60
if len(text) > max_headline_length:
issues.append(
"headline too long ({} > {})".format(len(text), max_headline_length)
)
res = cls.headline_pattern.match(text)
if res:
issues.append("headline starts with '{}'".format(res.group(0)))
Expand All @@ -198,8 +201,9 @@ def _check_body(text):
"signed-off-by:"
):
continue
if len(line) > 72:
return ["body contains line longer 72 chars"]
max_line_length = 72
if len(line) > max_line_length:
return ["body contains line longer {} chars".format(max_line_length)]
return []

def _record_issues(self, commit, headline, issues):
Expand Down

0 comments on commit 1ae9e8a

Please sign in to comment.