Skip to content
Snippets Groups Projects
Commit 587f1c60 authored by Vincent Hatakeyama's avatar Vincent Hatakeyama
Browse files

:sparkles: make the pylint format an option

parent de54bc07
No related branches found
No related tags found
1 merge request!170✨ make the pylint format an option
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
18.1.0 18.1.0
------ ------
Use pylint colorized output. Add pylint output format option and default to a colorized output.
18.0.1 18.0.1
------ ------
......
...@@ -52,8 +52,15 @@ ...@@ -52,8 +52,15 @@
default=[], default=[],
nargs="+", 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: def apply_pylint(namespace: argparse.Namespace) -> int:
"""Run pylint if the option was set.""" """Run pylint if the option was set."""
if _PYLINT_DEST in namespace and getattr(namespace, _PYLINT_DEST): if _PYLINT_DEST in namespace and getattr(namespace, _PYLINT_DEST):
...@@ -55,9 +62,13 @@ ...@@ -55,9 +62,13 @@
def apply_pylint(namespace: argparse.Namespace) -> int: def apply_pylint(namespace: argparse.Namespace) -> int:
"""Run pylint if the option was set.""" """Run pylint if the option was set."""
if _PYLINT_DEST in namespace and getattr(namespace, _PYLINT_DEST): 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 return 0
...@@ -71,7 +82,9 @@ ...@@ -71,7 +82,9 @@
return apply_pylint(nmspc) 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""" """Run pylint"""
config = Config() config = Config()
mounts: List[Mount] mounts: List[Mount]
...@@ -96,7 +109,7 @@ ...@@ -96,7 +109,7 @@
config.local_tag, config.local_tag,
{ {
"entrypoint": "pylint", "entrypoint": "pylint",
"command": ["--output-format=colorized"] + modules, "command": [f"--output-format={output_format}"] + modules,
# needed to write in the cache # needed to write in the cache
"user": "root", "user": "root",
"mounts": mounts, "mounts": mounts,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment