Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Prevent Lint/LiteralInInterpolation from removing necessary interpola…
…tion %W and %I split the content into words before expansion treating each interpolation as a word component. For example, the following array literal evaluates to `["-H", "Cookie: a=1; b=2", "https://example.com/"]`. ```ruby args = %W[-H #{"Cookie: a=1; b=2"} https://example.com/] ``` However, Lint/LiteralInInterpolation will wrongly auto-correct it to this: ```ruby args = %W[-H Cookie: a=1; b=2 https://example.com/] ``` Which gives a completely different set of elements: `["-H", "Cookie:", "a=1;", "b=2", "https://example.com/"]`. This fix teaches the cop not to expand an interpolation when the expanded value contains a space character.
- Loading branch information
Showing
3 changed files
with
92 additions
and
3 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
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