extended the Python script checks in the CI and adjusted some scripts (#3186)

This commit is contained in:
Oliver Stöneberg 2021-03-31 22:09:42 +02:00 committed by GitHub
parent 182ae75290
commit 4d526dcbf7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 15 additions and 13 deletions

View File

@ -10,7 +10,8 @@ jobs:
runs-on: ubuntu-20.04
strategy:
matrix:
python-version: [2.7, 3.5, 3.6, 3.7, 3.8]
python-version: [2.7, 3.5, 3.6, 3.7, 3.8, 3.9]
fail-fast: false
steps:
- uses: actions/checkout@v2
@ -41,12 +42,12 @@ jobs:
python -m pip install psutil
- name: run Shellcheck
if: matrix.python-version == '3.8'
if: matrix.python-version == '3.9'
run: |
find . -name "*.sh" | xargs shellcheck --exclude SC2002,SC2013,SC2034,SC2035,SC2043,SC2046,SC2086,SC2089,SC2090,SC2129,SC2211,SC2231
- name: run pylint
if: matrix.python-version == '3.8'
if: matrix.python-version == '3.9'
run: |
pylint --rcfile=pylintrc_travis addons/*.py
pylint --rcfile=pylintrc_travis htmlreport/cppcheck-htmlreport
@ -54,20 +55,22 @@ jobs:
pylint --rcfile=pylintrc_travis tools/*.py
- name: check .json files
if: matrix.python-version == '3.8'
if: matrix.python-version == '3.9'
run: |
find . -name '*.json' | xargs -n 1 python -m json.tool > /dev/null
- name: Validate
if: matrix.python-version == '3.8'
if: matrix.python-version == '3.9'
run: |
make -j$(nproc) validateCFG validatePlatforms validateRules
- name: check python syntax
if: matrix.python-version != '2.7'
run: |
python -m py_compile ./tools/donate-cpu.py
python -m py_compile ./tools/donate-cpu-server.py
python -m py_compile addons/*.py
python -m py_compile htmlreport/cppcheck-htmlreport
python -m py_compile htmlreport/*.py
python -m py_compile tools/*.py
- name: compile addons
run: |
@ -79,7 +82,7 @@ jobs:
PYTHONPATH=./addons python -m pytest addons/test/test-*.py
- name: dmake
if: matrix.python-version == '3.8'
if: matrix.python-version == '3.9'
run: |
make -j$(nproc) run-dmake
git diff --exit-code

View File

@ -12,7 +12,7 @@ import subprocess
CPPCHECK = os.path.expanduser('~/cppcheck/cppcheck')
def run_cppcheck(cppcheck_parameters:str, clang:str):
cmd = f'{CPPCHECK} {cppcheck_parameters} {clang} --debug --verbose'
cmd = '{} {} {} --debug --verbose'.format(CPPCHECK, cppcheck_parameters, clang)
#print(cmd)
p = subprocess.Popen(cmd.split(), stdout=subprocess.PIPE, stderr=subprocess.PIPE)
comm = p.communicate()
@ -63,7 +63,7 @@ def compare_ast_symdb(cppcheck_parameters: str):
ast1 = get_ast(debug1)
ast2 = get_ast(debug2)
if ast1 != ast2:
print(f"ast is not the same: {cppcheck_parameters}")
print("ast is not the same: {}".format(cppcheck_parameters))
with open('cppcheck.ast', 'wt') as f:
f.write(ast1)
with open('clang.ast', 'wt') as f:
@ -73,7 +73,7 @@ def compare_ast_symdb(cppcheck_parameters: str):
symdb1 = get_symdb(debug1)
symdb2 = get_symdb(debug2)
if symdb1 != symdb2:
print(f"symdb is not the same: {cppcheck_parameters}")
print("symdb is not the same: {}".format(cppcheck_parameters))
with open('cppcheck.symdb', 'wt') as f:
f.write(symdb1)
with open('clang.symdb', 'wt') as f:

View File

@ -6,7 +6,6 @@ TRACDB = 'trac.db'
def readdb():
global TRACDB
cmds = ['sqlite3', TRACDB, 'SELECT id,keywords FROM ticket WHERE status<>"closed";']
p = subprocess.Popen(cmds, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
comm = p.communicate()
@ -25,9 +24,9 @@ def readdb():
ret[kw].append(nr)
return ret
for arg in sys.argv[1:]:
if arg.endswith('/trac.db'):
global TRACDB
TRACDB = arg
data = readdb()