diff --git a/test/test_linter.py b/test/test_linter.py index f9bf430e..07e01180 100644 --- a/test/test_linter.py +++ b/test/test_linter.py @@ -1,9 +1,12 @@ import os from glob import glob +import sys import pqclean import helpers +additional_flags = [] + def test_clang_tidy(): for scheme in pqclean.Scheme.all_schemes(): @@ -18,8 +21,9 @@ def check_tidy(implementation: pqclean.Implementation): common_files = glob(os.path.join('..', 'common', '*.c')) helpers.run_subprocess(['clang-tidy', '-quiet', - '-header-filter=.*', - *cfiles, + '-header-filter=.*'] + + additional_flags + + [*cfiles, *common_files, '--', '-iquote', os.path.join('..', 'common'), @@ -28,6 +32,10 @@ def check_tidy(implementation: pqclean.Implementation): if __name__ == "__main__": + # allow a user to specify --fix-errors, to immediately fix errors + if len(sys.argv) >= 2 and sys.argv[1] == '-fix-errors': + additional_flags = ['-fix-errors'] + sys.argv = sys.argv[0:1] + sys.argv[2:] try: import nose2 nose2.main()