linter: show progress bar

This commit is contained in:
William Ballenthin
2021-08-27 08:21:09 -06:00
parent 9e579f9de3
commit 90708c123b

View File

@@ -27,6 +27,7 @@ import posixpath
import termcolor
import ruamel.yaml
import tqdm.contrib.logging
import capa.main
import capa.rules
@@ -699,11 +700,13 @@ def lint(ctx, rules):
"""
ret = {}
for name, rule in rules.rules.items():
if rule.meta.get("capa/subscope-rule", False):
continue
with tqdm.contrib.logging.tqdm_logging_redirect(rules.rules.items(), unit="rule") as pbar:
for name, rule in pbar:
if rule.meta.get("capa/subscope-rule", False):
continue
ret[name] = lint_rule(ctx, rule)
pbar.set_description("linting rule: %s" % (name))
ret[name] = lint_rule(ctx, rule)
return ret