# HG changeset patch # User Vincent Hatakeyama <vincent.hatakeyama@xcg-consulting.fr> # Date 1676294326 -3600 # Mon Feb 13 14:18:46 2023 +0100 # Node ID 587f1c601633e0af541a7dfe3c837053f0ac25a7 # Parent de54bc074c53e6ac5e6da1ea27873a513bafa81d ✨ make the pylint format an option diff --git a/NEWS.rst b/NEWS.rst --- a/NEWS.rst +++ b/NEWS.rst @@ -5,7 +5,7 @@ 18.1.0 ------ -Use pylint colorized output. +Add pylint output format option and default to a colorized output. 18.0.1 ------ diff --git a/odoo_scripts/docker_pylint.py b/odoo_scripts/docker_pylint.py --- a/odoo_scripts/docker_pylint.py +++ b/odoo_scripts/docker_pylint.py @@ -52,12 +52,23 @@ default=[], nargs="+", ) + parser.add_argument( + "--pylint-output-format", + help="Run pylint with the --output-format provided (for example colorized or " + "parseable)", + dest="pylint_output_format", + default="colorized", + ) def apply_pylint(namespace: argparse.Namespace) -> int: """Run pylint if the option was set.""" if _PYLINT_DEST in namespace and getattr(namespace, _PYLINT_DEST): - return pylint(getattr(namespace, _PYLINT_DEST), get_build_options(namespace)) + return pylint( + getattr(namespace, _PYLINT_DEST), + get_build_options(namespace), + namespace.pylint_output_format, + ) return 0 @@ -71,7 +82,9 @@ return apply_pylint(nmspc) -def pylint(modules: List[str], build_options: List[str]): +def pylint( + modules: List[str], build_options: List[str], output_format: str = "colorized" +): """Run pylint""" config = Config() mounts: List[Mount] @@ -96,7 +109,7 @@ config.local_tag, { "entrypoint": "pylint", - "command": ["--output-format=colorized"] + modules, + "command": [f"--output-format={output_format}"] + modules, # needed to write in the cache "user": "root", "mounts": mounts,