scripts: ci: Enable pylint check for argument parser abbreviations

Enables running CI checks which will now search for initialisation
of argument parser where abbreviations are not disabled.

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
This commit is contained in:
Jamie McCrae 2023-01-18 12:26:06 +00:00 committed by Stephanos Ioannidis
commit d72e135b2b
2 changed files with 17 additions and 2 deletions

View file

@ -816,6 +816,10 @@ class PyLint(ComplianceTest):
pylintrc = os.path.abspath(os.path.join(os.path.dirname(__file__),
"pylintrc"))
# Path to additional pylint check scripts
check_script_dir = os.path.abspath(os.path.join(os.path.dirname(__file__),
"../pylint/checkers"))
# List of files added/modified by the commit(s).
files = get_files(filter="d")
@ -826,14 +830,23 @@ class PyLint(ComplianceTest):
if not py_files:
return
pylintcmd = ["pylint", "--rcfile=" + pylintrc] + py_files
python_environment = os.environ.copy()
if "PYTHONPATH" in python_environment:
python_environment["PYTHONPATH"] = check_script_dir + ":" + \
python_environment["PYTHONPATH"]
else:
python_environment["PYTHONPATH"] = check_script_dir
pylintcmd = ["pylint", "--rcfile=" + pylintrc,
"--load-plugins=argparse-checker"] + py_files
logger.info(cmd2str(pylintcmd))
try:
subprocess.run(pylintcmd,
check=True,
stdout=subprocess.PIPE,
stderr=subprocess.STDOUT,
cwd=GIT_TOP)
cwd=GIT_TOP,
env=python_environment)
except subprocess.CalledProcessError as ex:
output = ex.output.decode("utf-8")
regex = r'^\s*(\S+):(\d+):(\d+):\s*([A-Z]\d{4}):\s*(.*)$'

View file

@ -247,6 +247,8 @@ enable=
deprecated-str-translate-call,
deprecated-itertools-function,
deprecated-types-field,
# Custom Zephyr check scripts
zephyr-arg-parse,
[SIMILARITIES]