Always exit 2 when specified configuration file does not exist #5395
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
RuboCop exits with 2 status code on an error.
However when a specified configuration file does not exist, RuboCop exit with a status code that depends on environments. Because
errno
depends on the environment in which Ruby runs.https://ruby-doc.org/core-2.5.0/Errno.html
https://github.com/bbatsov/rubocop/blob/e7cb0e84ee55dcc475001f90b4cfe5aedc2a53f9/lib/rubocop/config_loader.rb#L183
https://github.com/bbatsov/rubocop/blob/e7cb0e84ee55dcc475001f90b4cfe5aedc2a53f9/lib/rubocop/cli.rb#L39-L41
I think it exits with 2 also in the case. This pull-request replace the
errno
withSTATUS_ERROR
.And this pull-request replace magic numbers with constants.
Note: In my environment (Linux),
Errno::ENOENT::Errno
is2
. So this pull-request has nothing changes in my environment (and maybe in Linux).Before submitting the PR make sure the following are checked:
[Fix #issue-number]
(if the related issue exists).master
(if not - rebase it).and description in grammatically correct, complete sentences.
rake default
orrake parallel
. It executes all tests and RuboCop for itself, and generates the documentation.