-
-
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 #11652] Generate inherit_from correctly also with ERB
The problem with the existing algorithm, for generating the inherit_from line in --auto-gen-config runs, was that we started by removing the inherit_from (if present) and then inserted it later. The things we must deal with in the algorithm are * there could be a pre-existing inherit_from in .rubocop.yml, or not * there could be a YAML doc start ---, or not * there could be inheritance from one or multiple files A more robust approach to the removing, generating, and re-inserting is to assume that any pre-existing inherit_from directive is already in the right place. By replacing it with a placeholder and later replacing the placeholder with the new inheritance directive, we will get it right without much effort.
- Loading branch information
Showing
3 changed files
with
80 additions
and
47 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 @@ | ||
* [#11652](https://github.com/rubocop/rubocop/issues/11652): Make `--auto-gen-config` generate `inherit_from` correctly inside ERB `if`. ([@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