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

ci/package_checks: add check for commit message ending in ] #889

Merged
merged 1 commit into from
Nov 26, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions common/CI/package_checks.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,25 @@ def package_line(self, file: str, expr: str) -> Optional[int]:
return None


class CommitMessage(PullRequestCheck):
def run(self) -> List[Result]:
return [result
for commit in self.commits
for result in self._check_commit(commit)]

def _check_commit(self, commit: str) -> List[Result]:
msg = self.git.commit_message(commit)
files = self.git.files_in_commit(commit)
file = files[0] if files else ''

results: List[Result] = []

if msg.strip().endswith(']'):
results.append(Result(message='commit ends with ]', level=Level.ERROR, file=file))

return results


class Homepage(PullRequestCheck):
_error = '`homepage` is not set'
_level = Level.ERROR
Expand Down Expand Up @@ -341,6 +360,7 @@ def _commit_package_yaml(self, ref: str) -> Optional[Dict[str, Any]]:

class Checker:
checks = [
CommitMessage,
Homepage,
PackageBumped,
PackageDependenciesOrder,
Expand Down