forked from rubocop/rubocop
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Fix rubocop#7929] Accept frozen_string_literal anywhere in leading c…
…omment lines The frozen_string_literal comment can exist anywhere in the "leading comment lines" (i.e. before the first line of ruby code). If it appears after any ruby code it is ignored which does not cause an errors but could cause the absence of an expected error which is bad. The previous implementation was checking if this comment was one of the first three comments which had two issues: - The comments it was checking could be anywhere, even after ruby code - Since it was only checking three comments, it's possible that you can have an appropriate frozen_string_literal but this cop would show an error. This commit updates the logic to look at all leading comment lines, which may be more or less than three depending on where the first non-comment token is.
- Loading branch information
Showing
3 changed files
with
130 additions
and
1 deletion.
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