forked from rubocop/rubocop
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Fix rubocop#12271] Fix a false positive for `Lint/RedundantSafeNavig…
…ation` Fixes rubocop#12271. This PR fixes a false positive for `Lint/RedundantSafeNavigation` when using snake case constant receiver. Camel case is used for naming classes and modules, while snake case is used for all other constants. This naming conforms with `Naming/ConstantName` cop. Since constants that turn into classes or modules are normally not `nil`, they will continue to be detected. However, this PR will update to allow safe navigation for constants in snake case. This change resolves both issue rubocop/rubocop-rails#1104 and rubocop#12271.
- Loading branch information
Showing
3 changed files
with
27 additions
and
9 deletions.
There are no files selected for viewing
1 change: 1 addition & 0 deletions
1
changelog/fix_a_false_positive_for_lint_redundant_safe_navigation.md
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 @@ | ||
* [#12271](https://github.com/rubocop/rubocop/issues/12271): Fix a false positive for `Lint/RedundantSafeNavigation` when using snake case constant receiver. ([@koic][]) |
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