Skip to content

Update rubocop to 1.86.1#807

Closed
camilopayan wants to merge 1 commit into
mainfrom
update-rubocop-1.86.1-new
Closed

Update rubocop to 1.86.1#807
camilopayan wants to merge 1 commit into
mainfrom
update-rubocop-1.86.1-new

Conversation

@camilopayan
Copy link
Copy Markdown
Contributor

Updates RuboCop from 1.84.0 to 1.86.1.
Updates standard-performance to 1.9.0.

New cops

These cops were added and need a configuration decision before tests will pass:

Cop Description Recommendation Rationale PR
Lint/DataDefineOverride Checks for Data.define overriding existing methods. Enable Prevents subtle bugs in modern Ruby's Data objects by ensuring methods aren't accidentally shadowed. #14773
Lint/UnreachablePatternBranch Detects unreachable branches in case patterns. Enable This is a safety/lint rule that catches potential bugs in pattern matching, which is highly valuable for code quality. #14925
Style/EmptyClassDefinition Enforces consistent style for empty classes. Enable Promotes consistent coding style for empty classes, which aligns with Standard's goal of eliminating bikeshedding. #14961
Style/FileOpen Checks for File.open without a block. Enable Encourages safe resource management by ensuring files are closed, which is a strong safety improvement. #14942
Style/HashLookupMethod Enforces preference between Hash#[] and Hash#fetch. Ignore This is often a matter of context-specific preference (safety vs brevity) and enforcing one globally can cause high friction. #14977
Style/MapJoin Suggests more efficient alternatives to map { ... }.join. Enable Promotes more efficient and idiomatic Ruby patterns, which aligns with Standard's modernization goals. #14939
Style/OneClassPerFile Enforces one class per file. Ignore While generally good practice, it can be too restrictive for small utility classes or data structures, leading to excessive file proliferation. #14924
Style/PartitionInsteadOfDoubleSelect Suggests partition instead of two select calls. Enable Improves performance and readability by avoiding double iteration over collections. #14923
Style/PredicateWithKind Checks for predicate methods used with kind_of? or is_a?. Enable Encourages idiomatic predicate usage, improving code consistency and readability. #14811
Style/ReduceToHash Encourages each_with_object or to_h instead of reduce. Enable Encourages more readable and idiomatic alternatives for hash building. #14938
Style/RedundantMinMaxBy Detects redundant min_by or max_by calls. Enable Removes redundant code, aligning with the principle of simplicity. #14812
Style/RedundantStructKeywordInit Checks for redundant keyword_init: true. Enable Cleans up redundant configuration in modern Ruby where this might be the default or unnecessary. #13501
Style/SelectByKind Suggests grep instead of select with type check. Enable Encourages use of grep, which is a powerful and idiomatic Ruby feature for type-based filtering. #14808
Style/SelectByRange Suggests range slicing instead of select. Enable Promotes more concise and performant range-based collection access. #14810
Style/TallyMethod Enforces Enumerable#tally. Enable Encourages modern Ruby features (tally) for a very common pattern. #14922

Changed cops

These existing cops had behavioral changes:

Cop Change PR
Style/OneClassPerFile Now excludes spec/**/* and test/**/* by default. #15005
Style/RedundantStructKeywordInit Disabled by default. #15063
Lint/RedundantSafeNavigation Now aware of safe navigation in conditional true branch. #14989
Style/HashAsLastArrayItem Tweaked multiline autocorrection. #14872
Style/EndlessMethod Now considers receivers. #14917
Style/EmptyClassDefinition Renamed class_definition to class_keyword in EnforcedStyle. #14895
Style/RedundantInterpolationUnfreeze Added support for String.new with interpolated strings. #14956
Style/RedundantParentheses Now registers redundant parentheses around block bodies. #14955

The config/ YAML files have not been updated for any of the above cops.
Tests are expected to fail until those configurations are added in a follow-up.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant