Allow -fix-errors to fix linter errors

This commit is contained in:
Joost Rijneveld 2019-04-06 13:57:35 +02:00
parent 671a4e60aa
commit 7dcedfc56c
No known key found for this signature in database
GPG Key ID: A4FE39CF49CBC553

View File

@ -1,9 +1,12 @@
import os import os
from glob import glob from glob import glob
import sys
import pqclean import pqclean
import helpers import helpers
additional_flags = []
def test_clang_tidy(): def test_clang_tidy():
for scheme in pqclean.Scheme.all_schemes(): 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')) common_files = glob(os.path.join('..', 'common', '*.c'))
helpers.run_subprocess(['clang-tidy', helpers.run_subprocess(['clang-tidy',
'-quiet', '-quiet',
'-header-filter=.*', '-header-filter=.*'] +
*cfiles, additional_flags +
[*cfiles,
*common_files, *common_files,
'--', '--',
'-iquote', os.path.join('..', 'common'), '-iquote', os.path.join('..', 'common'),
@ -28,6 +32,10 @@ def check_tidy(implementation: pqclean.Implementation):
if __name__ == "__main__": 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: try:
import nose2 import nose2
nose2.main() nose2.main()