Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pr-tool: give hint about commit headline length limits #1763

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Expand Up @@ -57,6 +57,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- python-bareos: use TLS-PSK from core ssl module (available since Python >= 3.13) [PR #1756]
- [percona-xtrabackup] prevent High memory usage for no reason (IO_CLOSE) [PR #1724]
- docs: improve handling of ResourceItem descriptions [PR #1761]
- pr-tool: give hint about commit headline length limits [PR #1763]

### Removed
- plugins: remove old deprecated postgres plugin [PR #1606]
Expand Down Expand Up @@ -141,4 +142,5 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
[PR #1756]: https://github.com/bareos/bareos/pull/1756
[PR #1761]: https://github.com/bareos/bareos/pull/1761
[PR #1762]: https://github.com/bareos/bareos/pull/1762
[PR #1763]: https://github.com/bareos/bareos/pull/1763
[unreleased]: https://github.com/bareos/bareos/tree/master
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