-
-
Notifications
You must be signed in to change notification settings - Fork 3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Fix #12667] Avoid loading excluded configuration
This change fixes an error that can occur when file names are given explicitly on the command line together with `--force-exclusion`. In order to check if the given files are to be excluded, we must load configuration. The problem is that `.rubocop.yml` files in directories with excluded files (e.g. a `vendor` directory) might contain directives that will cause RuboCop to crash, such as `require` with an extension that's not available. What saves us in this situation is that we don't need to load configuration for the file as such. We can load configuration for the current directory instead. The reason is that `Exclude` parameters on the top level are not shadowed by `Exclude` in other `.rubocop.yml` files in subdirectories, as documented here: https://docs.rubocop.org/rubocop/1.60/configuration.html#include-and-exclude-are-relative-to-their-directory The `--ignore-parent-exclusion` flag, if given, changes the situation and we must load the most adjacent `.rubocop.yml` file.
- Loading branch information
Showing
3 changed files
with
39 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
* [#12667](https://github.com/rubocop/rubocop/issues/12667): Don't load excluded configuration. ([@jonas054][]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters