Skip to content

Commit

Permalink
ci/package_checks: add check for commit message ending in ]
Browse files Browse the repository at this point in the history
  • Loading branch information
silkeh committed Nov 25, 2023
1 parent ee43706 commit d990a0e
Showing 1 changed file with 20 additions and 0 deletions.
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

0 comments on commit d990a0e

Please sign in to comment.