pyupio / safety

Safety checks Python dependencies for known security vulnerabilities and suggests the proper remediations for vulnerabilities detected.
https://safetycli.com/product/safety-cli
MIT License
1.66k stars 141 forks source link

Provide terse output when no problems are found #457

Open arthurzenika opened 1 year ago

arthurzenika commented 1 year ago

Description

It would be nice to have an output that provides a full-report when a vulnerability is found and a single line when no vulnerabilities are found.

We run safety in a collection of lint tools and the output is too verbose (and contains red text when 0 vulnerabilities are found).

What I Did

safety check --full-report
jl-applied commented 1 year ago

If it helps, you can fairly trivially workaround this in shell (bash for example),

function run_safety_and_echo_on_failure() {
  output=$(safety check --full-repo 2>&1)
  exit_status=$?

  if [ $exit_status -ne 0 ]; then
    echo "$output"
  fi
}