Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update rubocop to 1.64.1 #369

Merged
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
5 changes: 3 additions & 2 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,22 @@ source 'https://rubygems.org'
gem "activesupport", require: false
gem "parser"
gem "pry", require: false
gem "rubocop", "1.62.1", require: false
gem "rubocop", "1.64.1", require: false
gem "rubocop-capybara", require: false
gem "rubocop-factory_bot", require: false
gem "rubocop-graphql", require: false
gem "rubocop-i18n", require: false
gem "rubocop-minitest", require: false
gem "rubocop-performance", require: false
gem "rubocop-rails", require: false
gem "rubocop-rails-omakase", require: false
gem "rubocop-rake", require: false
gem "rubocop-rspec", require: false
gem "rubocop-rspec_rails", require: false
gem "rubocop-sequel", require: false
gem "rubocop-shopify", require: false
gem "rubocop-sorbet", require: false
gem "rubocop-thread_safety", require: false
gem "rubocop-factory_bot", require: false
gem "test-prof", require: false

group :test do
Expand Down
77 changes: 42 additions & 35 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
GEM
remote: https://rubygems.org/
specs:
activesupport (7.1.3.2)
activesupport (7.1.3.4)
base64
bigdecimal
concurrent-ruby (~> 1.0, >= 1.0.2)
Expand All @@ -13,46 +13,47 @@ GEM
tzinfo (~> 2.0)
ast (2.4.2)
base64 (0.2.0)
bigdecimal (3.1.7)
bigdecimal (3.1.8)
coderay (1.1.3)
concurrent-ruby (1.2.3)
concurrent-ruby (1.3.3)
connection_pool (2.4.1)
diff-lcs (1.5.1)
drb (2.2.1)
i18n (1.14.4)
i18n (1.14.5)
concurrent-ruby (~> 1.0)
json (2.7.1)
json (2.7.2)
language_server-protocol (3.17.0.3)
method_source (1.0.0)
minitest (5.22.3)
method_source (1.1.0)
minitest (5.24.1)
mutex_m (0.2.0)
parallel (1.24.0)
parser (3.3.0.5)
parallel (1.25.1)
parser (3.3.3.0)
ast (~> 2.4.1)
racc
pry (0.14.2)
coderay (~> 1.1)
method_source (~> 1.0)
racc (1.7.3)
rack (3.0.9.1)
racc (1.8.0)
rack (3.1.4)
rainbow (3.1.1)
rake (13.1.0)
regexp_parser (2.9.0)
rexml (3.2.6)
rake (13.2.1)
regexp_parser (2.9.2)
rexml (3.3.1)
strscan
rspec (3.13.0)
rspec-core (~> 3.13.0)
rspec-expectations (~> 3.13.0)
rspec-mocks (~> 3.13.0)
rspec-core (3.13.0)
rspec-support (~> 3.13.0)
rspec-expectations (3.13.0)
rspec-expectations (3.13.1)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.13.0)
rspec-mocks (3.13.0)
rspec-mocks (3.13.1)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.13.0)
rspec-support (3.13.1)
rubocop (1.62.1)
rubocop (1.64.1)
json (~> 2.3)
language_server-protocol (>= 3.17.0)
parallel (~> 1.10)
Expand All @@ -63,45 +64,50 @@ GEM
rubocop-ast (>= 1.31.1, < 2.0)
ruby-progressbar (~> 1.7)
unicode-display_width (>= 2.4.0, < 3.0)
rubocop-ast (1.31.2)
parser (>= 3.3.0.4)
rubocop-capybara (2.20.0)
rubocop-ast (1.31.3)
parser (>= 3.3.1.0)
rubocop-capybara (2.21.0)
rubocop (~> 1.41)
rubocop-factory_bot (2.25.1)
rubocop (~> 1.41)
rubocop-graphql (1.5.0)
rubocop-factory_bot (2.26.1)
rubocop (~> 1.61)
rubocop-graphql (1.5.2)
rubocop (>= 0.90, < 2)
rubocop-i18n (3.0.0)
rubocop (~> 1.0)
rubocop-minitest (0.35.0)
rubocop (>= 1.61, < 2.0)
rubocop-ast (>= 1.31.1, < 2.0)
rubocop-performance (1.20.2)
rubocop-performance (1.21.1)
rubocop (>= 1.48.1, < 2.0)
rubocop-ast (>= 1.30.0, < 2.0)
rubocop-rails (2.24.0)
rubocop-ast (>= 1.31.1, < 2.0)
rubocop-rails (2.25.1)
activesupport (>= 4.2.0)
rack (>= 1.1)
rubocop (>= 1.33.0, < 2.0)
rubocop-ast (>= 1.31.1, < 2.0)
rubocop-rails-omakase (1.0.0)
rubocop
rubocop-minitest
rubocop-performance
rubocop-rails
rubocop-rake (0.6.0)
rubocop (~> 1.0)
rubocop-rspec (2.27.1)
rubocop (~> 1.40)
rubocop-capybara (~> 2.17)
rubocop-factory_bot (~> 2.22)
rubocop-rspec_rails (2.28.2)
rubocop (~> 1.40)
rubocop-rspec (3.0.1)
rubocop (~> 1.61)
rubocop-rspec_rails (2.30.0)
rubocop (~> 1.61)
rubocop-rspec (~> 3, >= 3.0.1)
rubocop-sequel (0.3.4)
rubocop (~> 1.0)
rubocop-shopify (2.15.1)
rubocop (~> 1.51)
rubocop-sorbet (0.7.8)
rubocop-sorbet (0.8.3)
rubocop (>= 0.90.0)
rubocop-thread_safety (0.5.1)
rubocop (>= 0.90.0)
ruby-progressbar (1.13.0)
test-prof (1.3.2)
strscan (3.1.0)
test-prof (1.3.3.1)
tzinfo (2.0.6)
concurrent-ruby (~> 1.0)
unicode-display_width (2.5.0)
Expand All @@ -115,14 +121,15 @@ DEPENDENCIES
pry
rake
rspec
rubocop (= 1.62.1)
rubocop (= 1.64.1)
rubocop-capybara
rubocop-factory_bot
rubocop-graphql
rubocop-i18n
rubocop-minitest
rubocop-performance
rubocop-rails
rubocop-rails-omakase
rubocop-rake
rubocop-rspec
rubocop-rspec_rails
Expand Down
13 changes: 12 additions & 1 deletion config/contents/lint/debugger.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@ Lint/Debugger:
MyDebugger.debug_this
```
Some gems also ship files that will start a debugging session when required,
for example `require 'debug/start'` from `ruby/debug`. These requires can
be configured through `DebuggerRequires`. It has the same structure as
`DebuggerMethods`, which you can read about above.

### Example:

# bad (ok during development)
Expand Down Expand Up @@ -56,4 +61,10 @@ Lint/Debugger:

def some_method
my_debugger
end
end

### Example: DebuggerRequires: [my_debugger/start]

# bad (ok during development)

require 'my_debugger/start'
39 changes: 39 additions & 0 deletions config/contents/style/access_modifier_declarations.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,17 @@ or inline before each method, depending on configuration.
EnforcedStyle config covers only method definitions.
Applications of visibility methods to symbols can be controlled
using AllowModifiersOnSymbols config.
Also, the visibility of `attr*` methods can be controlled using
AllowModifiersOnAttrs config.

In Ruby 3.0, `attr*` methods now return an array of defined method names
as symbols. So we can write the modifier and `attr*` in inline style.
AllowModifiersOnAttrs config allows `attr*` methods to be written in
inline style without modifying applications that have been maintained
for a long time in group style. Furthermore, developers who are not very
familiar with Ruby may know that the modifier applies to `def`, but they
may not know that it also applies to `attr*` methods. It would be easier
to understand if we could write `attr*` methods in inline style.

### Safety:

Expand Down Expand Up @@ -62,4 +73,32 @@ the group access modifier.

private :bar, :baz

end

### Example: AllowModifiersOnAttrs: true (default)
# good
class Foo

public attr_reader :bar
protected attr_writer :baz
private attr_accessor :qux
private attr :quux

def public_method; end

private

def private_method; end

end

### Example: AllowModifiersOnAttrs: false
# bad
class Foo

public attr_reader :bar
protected attr_writer :baz
private attr_accessor :qux
private attr :quux

end
2 changes: 2 additions & 0 deletions config/contents/style/arguments_forwarding.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ e.g., `*args`, `**options`, `&block`, and so on.

Names not on this list are likely to be meaningful and are allowed by default.

This cop handles not only method forwarding but also forwarding to `super`.

### Example:
# bad
def foo(*args, &block)
Expand Down
4 changes: 2 additions & 2 deletions config/contents/style/collection_compact.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,7 @@ when the receiver is a hash object.
### Example:
# bad
array.reject(&:nil?)
array.delete_if(&:nil?)
array.reject { |e| e.nil? }
array.delete_if { |e| e.nil? }
array.select { |e| !e.nil? }
array.grep_v(nil)
array.grep_v(NilClass)
Expand All @@ -27,7 +25,9 @@ when the receiver is a hash object.

# bad
hash.reject!(&:nil?)
array.delete_if(&:nil?)
hash.reject! { |k, v| v.nil? }
array.delete_if { |e| e.nil? }
hash.select! { |k, v| !v.nil? }

# good
Expand Down
48 changes: 24 additions & 24 deletions config/contents/style/documentation.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,36 +24,36 @@ same for all its children.
end

# allowed
# Class without body
# Class without body
class Person
end

# Namespace - A namespace can be a class or a module
# Containing a class
module Namespace
# Description/Explanation of Person class
class Person
# ...
end
end

# Namespace - A namespace can be a class or a module
# Containing a class
module Namespace
# Description/Explanation of Person class
class Person
# ...
end
# Containing constant visibility declaration
module Namespace
class Private
end

# Containing constant visibility declaration
module Namespace
class Private
end

private_constant :Private
end
private_constant :Private
end

# Containing constant definition
module Namespace
Public = Class.new
end
# Containing constant definition
module Namespace
Public = Class.new
end

# Macro calls
module Namespace
extend Foo
end
# Macro calls
module Namespace
extend Foo
end

### Example: AllowedConstants: ['ClassMethods']

Expand All @@ -62,4 +62,4 @@ same for all its children.
module ClassMethods
# ...
end
end
end
11 changes: 11 additions & 0 deletions config/contents/style/documentation_method.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,3 +89,14 @@ they are called constructor to distinguish it from method.
def do_something
end
end

### Example: AllowedMethods: ['method_missing', 'respond_to_missing?']

# good
class Foo
def method_missing(name, *args)
end

def respond_to_missing?(symbol, include_private)
end
end
Loading