-
Notifications
You must be signed in to change notification settings - Fork 46
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- General bundle update. - Update the docs too.
- Loading branch information
1 parent
af40822
commit d174500
Showing
16 changed files
with
180 additions
and
39 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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
In Ruby 3.1, `Array#intersect?` has been added. | ||
|
||
This cop identifies places where `(array1 & array2).any?` | ||
can be replaced by `array1.intersect?(array2)`. | ||
|
||
The `array1.intersect?(array2)` method is faster than | ||
`(array1 & array2).any?` and is more readable. | ||
|
||
### Safety: | ||
|
||
This cop cannot guarantee that array1 and array2 are | ||
actually arrays while method `intersect?` is for arrays only. | ||
|
||
### Example: | ||
# bad | ||
(array1 & array2).any? | ||
(array1 & array2).empty? | ||
|
||
# good | ||
array1.intersect?(array2) | ||
!array1.intersect?(array2) | ||
|
||
### Example: AllCops:ActiveSupportExtensionsEnabled: false (default) | ||
# good | ||
(array1 & array2).present? | ||
(array1 & array2).blank? | ||
|
||
### Example: AllCops:ActiveSupportExtensionsEnabled: true | ||
# bad | ||
(array1 & array2).present? | ||
(array1 & array2).blank? | ||
|
||
# good | ||
array1.intersect?(array2) | ||
!array1.intersect?(array2) |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
Avoid redundant `::` prefix on constant. | ||
|
||
How Ruby searches constant is a bit complicated, and it can often be difficult to | ||
understand from the code whether the `::` is intended or not. Where `Module.nesting` | ||
is empty, there is no need to prepend `::`, so it would be nice to consistently | ||
avoid such meaningless `::` prefix to avoid confusion. | ||
|
||
### Example: | ||
# bad | ||
::Const | ||
|
||
# good | ||
Const | ||
|
||
# bad | ||
class << self | ||
::Const | ||
end | ||
|
||
# good | ||
class << self | ||
Const | ||
end | ||
|
||
# good | ||
class A | ||
::Const | ||
end | ||
|
||
# good | ||
module A | ||
::Const | ||
end |
Oops, something went wrong.