in tasks.py [0:0]
def lint(ctx, linter="all", warn=False, hide=False, run_autofix=True):
"""Run a linter(s) using pyinvoke."""
if linter == "all":
if run_autofix:
autofix(ctx)
any_failure = False
for curr_linter in _LINTER_CONFIG:
result = lint(ctx, curr_linter, warn=True, hide=True, run_autofix=False)
print_result(curr_linter, result, hide)
if result.exited:
any_failure = result.exited
if (not warn) and any_failure:
sys.exit(result.exited)
return result
if run_autofix:
autofix(ctx)
result = ctx.run(
_LINTER_PATTERN.format(
validate=_LINTER_CONFIG[linter]["validate"],
config=_LINTER_CONFIG[linter]["config"],
),
warn=True,
hide=True,
)
print_result(linter, result, hide)
if (not warn) and result.exited:
sys.exit(result.exited)
return result