jendrikseipp/vulture

Dedicated exit code for "Dead code found"

kevinr-electric opened this issue · 2 comments

Right now, the 1 exit code shares 2 meanings:

  • Dead code found
  • Invalid input (file missing, syntax error, wrong encoding)

in the first case, vulture successfully ran, but in the second case it failed. This means that a script using Vulture can't use the exit code to make a distinction between those 2 cases. Using a dedicated exit code for "Dead code found" would allow scripts to distinguish between those 2 cases.

I'd like to propose using exit code 3 to mean "Dead code found", and removing that meaning from exit code 1. So in a table:

Exit code Description
0 No dead code found
1 Invalid input (file missing, syntax error, wrong encoding)
2 Invalid command line arguments
3 Dead code found

I'm fine with any number, I just want the "Dead code found" case to have a dedicated exit code. I'd be happy to create a PR to do this, but first I wanted to check if this would be something the maintainers would be open to.

I like the proposed change! Happy to review a PR for this. Please make sure to update the exit code table in the README.md file.

Fixed in #319.