From 2f456123f0d21bdd14b227bffe95a3910a217ae4 Mon Sep 17 00:00:00 2001 From: Sam Washko Date: Thu, 5 Oct 2023 12:35:53 -0700 Subject: [PATCH] readme, condense click exceptions --- README.md | 15 ++++++++------- modelscan/cli.py | 10 ++-------- 2 files changed, 10 insertions(+), 15 deletions(-) diff --git a/README.md b/README.md index 89e146b..1e298d7 100644 --- a/README.md +++ b/README.md @@ -130,6 +130,14 @@ Remember models are just like any other form of digital media, you should scan c **NOTE**: LLMs are large files, it can take a few minutes to download them before scanning. Expect the process to take just a few minutes to complete. +##### CLI Exit Codes +The CLI exit status codes are: +- `0`: Scan completed successfully, no vulnerabilities found +- `1`: Scan completed successfully, vulnerabilities found +- `2`: Scan failed, modelscan threw an error while scanning +- `3`: No supported files were passed to the tool +- `4`: Usage error, CLI was passed invalid or incomplete options + ### Understanding The Results Once a scan has been completed you'll see output like this if an issue is found: @@ -143,13 +151,6 @@ it allows an attacker to read our AWS credentials and write them to another plac That is a firm NO for usage. -The CLI exit status codes are: -- `0`: Scan completed successfully, no vulnerabilities found -- `1`: Scan completed successfully, vulnerabilities found -- `2`: Scan failed, modelscan threw an error while scanning -- `3`: No supported files were passed to the tool -- `4`: Usage error, CLI was passed invalid or incomplete options - ## Integrating ModelScan In Your ML Pipelines and CI/CD Pipelines Ad-hoc scanning is a great first step, please drill it into yourself, peers, and friends to do diff --git a/modelscan/cli.py b/modelscan/cli.py index 4b36a61..5173496 100644 --- a/modelscan/cli.py +++ b/modelscan/cli.py @@ -113,14 +113,8 @@ def main() -> None: try: result = cli.main(standalone_mode=False) - except ( - click.UsageError, - click.BadParameter, - click.BadOptionUsage, - click.NoSuchOption, - click.ClickException, - ) as e: - click.echo(f"Usage Error: {e}") + except (click.ClickException,) as e: + click.echo(f"Error: {e}") with click.Context(cli) as ctx: click.echo(cli.get_help(ctx)) # exit code 4 for CLI usage errors