8000 Use a different error code on early exit · Issue #2754 · python/mypy · GitHub
[go: up one dir, main page]

Skip to content

Use a different error code on early exit #2754

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

Closed
ddfisher opened this issue Jan 24, 2017 · 8 comments
Closed

Use a different error code on early exit #2754

ddfisher opened this issue Jan 24, 2017 · 8 comments

Comments

@ddfisher
Copy link
Collaborator

When running mypy from a script, it's sometimes nice to know when mypy successfully completed a full typechecking run vs exited early due to blocking errors. Perhaps mypy could exit with exit code 2 when exiting due to blocking errors?

@gvanrossum
Copy link
Member

Good idea. Then it should also exit 2 if it can't open a file and for other "early stage" errors. (It already uses exit 2 for command line parsing errors.)

@ddfisher
Copy link
Collaborator Author

Maybe there should be 3 error exit codes?

  1. Typechecking ran to completion and there are some type errors.
  2. The code could not be analyzed at all because e.g. the command line flags don't parse or a file cannot be opened. This should indicate a major configuration error.
  3. There was some code analysis, but it could not be completed because of a parse error or early semantic analysis error.

@gvanrossum
Copy link
Member
gvanrossum commented Jan 25, 2017 via email

@gvanrossum
Copy link
Member

Whoops, I searched for exit status but didn't find this issue. Sorry! Maybe it's time to increase priority?

@ddfisher
Copy link
Collaborator Author

If you think there's a current need for this, sure!

@gvanrossum
Copy link
Member

Mostly that I wish to remove certain code from an internal mypy integration script (you know the one).

@gvanrossum
Copy link
Member

Let's implement the following:

  • exit code 2 for command line syntax errors, missing files, and blocking errors
  • exit code 1 if there are only non-blocking errors
  • exit code 0 if there are no errors (though perhaps warnings or notes)

@gvanrossum
Copy link
Member

Also, note that parse errors are implicitly treated as blocking errors.

msullivan added a commit that referenced this issue Jan 8, 2018
Exit with code 2 on blocking errors, while continuing to exit with 1
when there are nonblocking errors.  Add test infrastructure.

Fixes #2754.
gvanrossum pushed a commit that referenced this issue Jan 9, 2018
Exit with code 2 on blocking errors, while continuing to exit with 1
when there are nonblocking errors.  Add test infrastructure.

Fixes #2754.
msullivan added a commit that referenced this issue Jan 9, 2018
Exit with code 2 on blocking errors, while continuing to exit with 1
when there are nonblocking errors.  Add test infrastructure.

Fixes #2754.
msullivan added a commit that referenced this issue Jan 9, 2018
Exit with code 2 on blocking errors, while continuing to exit with 1
when there are nonblocking errors.  Add test infrastructure.

Fixes #2754.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants
0