How to use the safety.cli.check.main function in safety

To help you get started, we’ve selected a few safety examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Lucas-C / pre-commit-hooks-safety / pre_commit_hooks / safety_check.py View on Github external
def main(argv=None):
    parsed_args, rest = _parser().parse_known_args(argv)
    ignore = [
        arg
        for vs in parsed_args.ignore or []
        for code in vs.split(",")
        for arg in ("--ignore", code.strip())
    ]
    files = [arg for f in parsed_args.files for arg in ("--file", f)]
    args = [parsed_args.full_report] + ignore + files + rest
    try:
        check.main(args)
    except SystemExit as error:
        return error.code
    return 1