Skip to content

Commit

Permalink
_cli: add a --strict mode
Browse files Browse the repository at this point in the history
Signed-off-by: William Woodruff <[email protected]>
  • Loading branch information
woodruffw committed Oct 5, 2022
1 parent 00e9b9f commit 7bd77d2
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions abi3audit/_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

from rich.logging import RichHandler

from abi3audit._audit import AuditResult, audit
from abi3audit._audit import AuditError, AuditResult, audit
from abi3audit._extract import (
Extractor,
InvalidSpec,
Expand Down Expand Up @@ -174,6 +174,12 @@ def main() -> None:
default=sys.stdout,
help="the path to write the JSON report to (default: stdout)",
)
parser.add_argument(
"-S",
"--strict",
action="store_true",
help="fail the entire audit if an individual audit step fails",
)
args = parser.parse_args()

if args.debug:
Expand All @@ -196,10 +202,12 @@ def main() -> None:

try:
result = audit(so)
except Exception as exc:
except AuditError as exc:
# TODO(ww): Refine exceptions and error states here.
console.log(f"[red]:thumbs_down: {spec}: auditing error: {exc}")
sys.exit(1)
console.log(f"[red]:skull: {so}: auditing error: {exc}")
if args.strict:
sys.exit(1)
continue

results.add(extractor, so, result)
if not result and args.verbose:
Expand Down

0 comments on commit 7bd77d2

Please sign in to comment.