From 90708c123bcbdf1b3dd3a5a6d8ee130b04be0559 Mon Sep 17 00:00:00 2001 From: William Ballenthin Date: Fri, 27 Aug 2021 08:21:09 -0600 Subject: [PATCH] linter: show progress bar --- scripts/lint.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/scripts/lint.py b/scripts/lint.py index ad2b9b11..c71c78c8 100644 --- a/scripts/lint.py +++ b/scripts/lint.py @@ -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