Introduce RuboCop Performance#8024
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #8024 +/- ##
=======================================
Coverage 99.05% 99.05%
=======================================
Files 184 184
Lines 4738 4740 +2
=======================================
+ Hits 4693 4695 +2
Misses 45 45
☔ View full report in Codecov by Sentry. |
a14ec53 to
d486420
Compare
3bd7398 to
b36bd2d
Compare
b36bd2d to
4041cb4
Compare
javierjulio
left a comment
There was a problem hiding this comment.
@tagliala thank you again for this. I've implemented rubocop-performance at work so I'm familiar with it. It's been a helpful tool. The main concern I have is with what was auto corrected vs what is reported in future updates.
With our config, there are some changes here that shouldn't have occurred since the cops are disabled by default. I believe if you auto correct by rule manually that will override our config settings. Reviewing your commits I believe it was auto correct by rule.
Can you please declare each rubocop-performance cop in the config and whether it should be enabled or not? This is important as we don't want to auto correct something here that isn't being reported as a warning in future updates. I've included a copy of all the cops config so you don't have to write out each one. Please change the values for each as needed.
4041cb4 to
65b1224
Compare
|
Temporary failures |
7acbb5d to
9ff24bb
Compare
javierjulio
left a comment
There was a problem hiding this comment.
Thanks @tagliala! Just two minor changes. This is ready to merge but has a single merge conflict.
Also fixes issues in non-production code
- Performance/CompareWithBlock - Performance/RegexpMatch - Performance/StringReplacement
- Performance/Count - Performance/StringInclude - Performance/TimesMap
- Performance/BlockGivenWithExplicitBlock - Performance/RedundantBlockCall - Performance/RegexpMatch - Performance/StringIdentifierArgument - Performance/StringReplacement
- Performance/EndWith - Performance/InefficientHashSearch - Performance/StringInclude
Fix offenses that cannot be automatically corrected: - Performance/CollectionLiteralInLoop - Performance/MethodObjectAsBlock
2a7c72c to
cdd08b4
Compare
Allow Performance/CollectionLiteralInLoop in specs There are four offenses that may be solved in the future
cdd08b4 to
266aacb
Compare
|
@tagliala this is ready for you to merge. Thank you again for contributing this! ❤️ |
|
@javierjulio welcome. Should I use squash & merge for this PR? |
|
@tagliala yes |
Commits are separated by scope:
Notes:
Performance/EndWithchanges should be safe because minimum required ruby version is 2.7, and 2.7 also supportsSymbol#end_with?Performance/InefficientHashSearchfixes should be safe, because both@menusand@childrenare hashesPerformance/StringIncludefixes should be safe, because@columnis the result of a RegExp matchchangelog:resyncandlocalrake tasks have been tested manually