Belle II Software  release-06-02-00
trg_cppcheck.py
1 #!/usr/bin/env python3
2 # -*- coding: utf-8 -*-
3 
4 
11 
12 """
13 Perform code quality cppchecks for every commit to the trg package.
14 """
15 
16 import re
17 from b2test_utils import check_error_free
18 from b2test_utils import skip_test
19 
20 skip_test("New cppcheck version in latest externals.")
21 
22 if __name__ == "__main__":
23  # Comment: this is a temporary workaround, since this package is affected by cppcheck warnings
24  # from other packages. check_error_free skips all the lines identified by findall, so here we skip all the lines
25  # that do no not contain the name of the tested package. The output will be incomplete and a bit obscure,
26  # but at least the test will correctly check if there are cppcheck warnings affecting this package.
27  ignoreme = r"^((?!trg\/).)*$"
28  check_error_free("b2code-cppcheck", "cppcheck", "trg",
29  lambda x: re.findall(ignoreme, x) or x == "'", ["-j4"])