test_mbox_signed_off_by.py 938 B

123456789101112131415161718192021222324252627
  1. # Checks related to the patch's signed-off-by lines
  2. #
  3. # Copyright (C) 2016 Intel Corporation
  4. #
  5. # SPDX-License-Identifier: GPL-2.0-only
  6. import base
  7. import parse_signed_off_by
  8. import pyparsing
  9. class SignedOffBy(base.Base):
  10. revert_shortlog_regex = pyparsing.Regex('Revert\s+".*"')
  11. @classmethod
  12. def setUpClassLocal(cls):
  13. # match self.mark with no '+' preceding it
  14. cls.prog = parse_signed_off_by.signed_off_by
  15. def test_signed_off_by_presence(self):
  16. for commit in SignedOffBy.commits:
  17. # skip those patches that revert older commits, these do not required the tag presence
  18. if self.revert_shortlog_regex.search_string(commit.shortlog):
  19. continue
  20. if not SignedOffBy.prog.search_string(commit.payload):
  21. self.fail('Mbox is missing Signed-off-by. Add it manually or with "git commit --amend -s"',
  22. commit=commit)