Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -24,18 +24,18 @@ GEM
rainbow (3.1.1)
rake (13.3.0)
regexp_parser (2.10.0)
rubocop (1.75.8)
rubocop (1.76.0)
json (~> 2.3)
language_server-protocol (~> 3.17.0.2)
lint_roller (~> 1.1.0)
parallel (~> 1.10)
parser (>= 3.3.0.2)
rainbow (>= 2.2.2, < 4.0)
regexp_parser (>= 2.9.3, < 3.0)
rubocop-ast (>= 1.44.0, < 2.0)
rubocop-ast (>= 1.45.0, < 2.0)
ruby-progressbar (~> 1.7)
unicode-display_width (>= 2.4.0, < 4.0)
rubocop-ast (1.44.1)
rubocop-ast (1.45.0)
parser (>= 3.3.7.2)
prism (~> 1.4)
rubocop-minitest (0.38.1)
Expand Down
2 changes: 2 additions & 0 deletions dev.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
up:
- ruby
- bundler

test: bundle exec rake
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤷 I just want dev test due to habit.

31 changes: 31 additions & 0 deletions rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -378,8 +378,10 @@ Lint/ShadowedArgument:
Lint/ShadowedException:
Enabled: false

<% if rubocop_version < "1.76" %>
Lint/ShadowingOuterLocalVariable:
Enabled: false
<% end %>
Comment on lines +381 to +384
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is now the default, so we only want to keep configuring it for old RuboCop versions.


Lint/SharedMutableDefault:
Enabled: false
Expand Down Expand Up @@ -450,6 +452,11 @@ Lint/UselessAssignment:
Lint/UselessConstantScoping:
Enabled: false

<% if rubocop_version >= "1.76" %>
Lint/UselessDefaultValueArgument:
Enabled: true
<% end %>
Comment on lines +455 to +458
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

https://docs.rubocop.org/rubocop/cops_lint.html#lintuselessdefaultvalueargument

This seems like a good idea, although I do notice that there's an example of including Rails.cache in the AllowedReceivers config. We should see what the results are of running this against Core. If there are many false positives (beyond Rails.cache), it may not be worth enabling.


Lint/UselessDefined:
Enabled: false

Expand All @@ -462,6 +469,11 @@ Lint/UselessMethodDefinition:
Lint/UselessNumericOperation:
Enabled: false

<% if rubocop_version >= "1.76" %>
Lint/UselessOr:
Enabled: true
<% end %>
Comment on lines +472 to +475
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.


Lint/UselessRescue:
Enabled: false

Expand Down Expand Up @@ -558,7 +570,16 @@ Naming/MethodName:
Naming/MethodParameterName:
Enabled: false

<% if rubocop_version >= "1.76" %>
Naming/PredicateMethod:
Enabled: false
<% end %>

<% if rubocop_version >= "1.76" %>
Naming/PredicatePrefix:
<% else %>
Naming/PredicateName:
<% end %>
Comment on lines +578 to +582
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This just handles the cop being renamed. We may want to backport this so consumers don't get the warning.

Enabled: false
NamePrefix:
- is_
Expand Down Expand Up @@ -768,6 +789,11 @@ Style/EmptyLiteral:
Style/EmptyMethod:
Enabled: false

<% if rubocop_version >= "1.76" %>
Style/EmptyStringInsideInterpolation:
Enabled: false
<% end %>
Comment on lines +792 to +795
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

https://docs.rubocop.org/rubocop/cops_style.html#styleemptystringinsideinterpolation

This controls the preference between

"...#{var ? "foo" : ""}...#{var ? "" : "bar"}..."

# or

"...#{"foo" if var}...#{"bar" unless var}..."

defaulting to preferring the latter.

I personally agree with it, but my gut feeling following the "Great Reset" is that we shouldn't enable this and leave it up to the author.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, that is right.


Style/Encoding:
Enabled: false

Expand Down Expand Up @@ -1112,6 +1138,11 @@ Style/RedundantArgument:
Style/RedundantArrayConstructor:
Enabled: false

<% if rubocop_version >= "1.76" %>
Style/RedundantArrayFlatten:
Enabled: true
<% end %>
Comment on lines +1141 to +1144
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

https://docs.rubocop.org/rubocop/cops_style.html#styleredundantarrayflatten

While this is a Style cop, it is also an optimization, as it avoids the work of the redundant flattening operation, so I think we should enable it.


Style/RedundantAssignment:
Enabled: false

Expand Down
44 changes: 40 additions & 4 deletions test/fixtures/full_config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1387,7 +1387,7 @@ Lint/EmptyInterpolation:
Enabled: true
AutoCorrect: contextual
VersionAdded: '0.20'
VersionChanged: '1.61'
VersionChanged: '1.76'
Lint/EmptyWhen:
Description: Checks for `when` branches with empty bodies.
Enabled: false
Expand Down Expand Up @@ -1794,6 +1794,7 @@ Lint/ShadowingOuterLocalVariable:
or block local variables.
Enabled: false
VersionAdded: '0.9'
VersionChanged: '1.76'
Lint/SharedMutableDefault:
Description: Checks for mutable literals used as default arguments during Hash initialization.
StyleGuide: "#no-mutable-defaults"
Expand Down Expand Up @@ -1954,6 +1955,13 @@ Lint/UselessConstantScoping:
Description: Checks for useless constant scoping.
Enabled: false
VersionAdded: '1.72'
Lint/UselessDefaultValueArgument:
Description: Checks for usage of `fetch` or `Array.new` with default value argument
and block.
Enabled: true
VersionAdded: '1.76'
Safe: false
AllowedReceivers: []
Lint/UselessDefined:
Description: Checks for calls to `defined?` with strings and symbols. The result
of such a call will always be truthy.
Expand All @@ -1975,6 +1983,10 @@ Lint/UselessNumericOperation:
Description: Checks for useless numeric operations.
Enabled: false
VersionAdded: '1.66'
Lint/UselessOr:
Description: Checks for useless OR expressions.
Enabled: true
VersionAdded: '1.76'
Lint/UselessRescue:
Description: Checks for useless `rescue`s.
Enabled: false
Expand Down Expand Up @@ -2309,8 +2321,16 @@ Naming/MethodParameterName:
- pp
- to
ForbiddenNames: []
Naming/PredicateName:
Description: Check the names of predicate methods.
Naming/PredicateMethod:
Description: Checks that predicate methods end with `?` and non-predicate methods
do not.
Enabled: false
VersionAdded: '1.76'
Mode: conservative
AllowedMethods:
- call
Naming/PredicatePrefix:
Description: Predicate method names should not be prefixed and end with a `?`.
StyleGuide: "#bool-methods-qmark"
Enabled: false
VersionAdded: '0.50'
Expand Down Expand Up @@ -2943,6 +2963,15 @@ Style/EmptyMethod:
SupportedStyles:
- compact
- expanded
Style/EmptyStringInsideInterpolation:
Description: Checks for empty strings being assigned inside string interpolation.
StyleGuide: "#empty-strings-in-interpolation"
Enabled: false
EnforcedStyle: trailing_conditional
SupportedStyles:
- trailing_conditional
- ternary
VersionAdded: '1.76'
Style/Encoding:
Description: Use UTF-8 as the source file encoding.
StyleGuide: "#utf-8"
Expand Down Expand Up @@ -3331,12 +3360,14 @@ Style/ItBlockParameter:
Description: Checks for blocks with one argument where `it` block parameter can
be used.
Enabled: false
EnforcedStyle: only_numbered_parameters
EnforcedStyle: allow_single_line
SupportedStyles:
- allow_single_line
- only_numbered_parameters
- always
- disallow
VersionAdded: '1.75'
VersionChanged: '1.76'
Style/KeywordArgumentsMerging:
Description: When passing an existing hash as keyword arguments, provide additional
arguments directly rather than using `merge`.
Expand Down Expand Up @@ -3908,6 +3939,11 @@ Style/RedundantArrayConstructor:
Description: Checks for the instantiation of array using redundant `Array` constructor.
Enabled: false
VersionAdded: '1.52'
Style/RedundantArrayFlatten:
Description: Checks for redundant calls of `Array#flatten`.
Enabled: true
Safe: false
VersionAdded: '1.76'
Style/RedundantAssignment:
Description: Checks for redundant assignment before returning.
Enabled: false
Expand Down