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
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()