Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

README Feature: Error codes for check #183

Closed
normoes opened this issue Jan 11, 2019 · 3 comments
Closed

README Feature: Error codes for check #183

normoes opened this issue Jan 11, 2019 · 3 comments
Assignees
Labels
considering Indicates that the issue is under consideration. enhancement Suggests an improvement or new feature.

Comments

@normoes
Copy link

normoes commented Jan 11, 2019

I would love to see a short section about the error codes of check.

Black (under Command line options) does that and it helped me a lot:

--check                     Don't write the files back, just return the
                              status.  Return code 0 means nothing would
                              change.  Return code 1 means some files would be
                              reformatted.  Return code 123 means there was an
                              internal error.

I found this in safety/cli.py (line 90) to be very helpful:

sys.exit(-1 if vulns else 0)
@normoes normoes changed the title Feature: Error codes for check README Feature: Error codes for check Jan 11, 2019
@wadevries
Copy link

Actually it seems -1 is the only exit code ever returned (besides 0). It would be really useful for me to differentiate between a technical failure and "vulnerabilities being found".

I use safety check --bare in a cronjob and I want my cronjob to fail loudly if safety could not run, but just report the vulnerabilities if run successfully. A flag like --exit-0-even-if-vulnerabilities-found or something would also fit my needs.

@normoes
Copy link
Author

normoes commented Jun 15, 2019

@wadevries
Actually, you are right.
It would further improve safety, especially when run in CI jobs. That's exactly my use case as well.

@rafaelpivato rafaelpivato added enhancement Suggests an improvement or new feature. considering Indicates that the issue is under consideration. labels Mar 23, 2020
@yeisonvargasf
Copy link
Member

Hi @normoes and @wadevries, the latest Safety version added support for standard error codes. You can find the code and its meaning in the README: https://github.com/pyupio/safety#using-safety-with-a-ci-service

@yeisonvargasf yeisonvargasf self-assigned this Oct 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
considering Indicates that the issue is under consideration. enhancement Suggests an improvement or new feature.
Projects
None yet
Development

No branches or pull requests

4 participants