Skip to content

Reduce rubocop_todo things #2628

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

Merged
merged 5 commits into from
Oct 25, 2022
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
79 changes: 20 additions & 59 deletions .rubocop_todo.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
# This configuration was generated by
# `rubocop --auto-gen-config`
# on 2022-07-26 21:27:23 UTC using RuboCop version 1.32.0.
# on 2022-10-25 12:04:09 UTC using RuboCop version 1.28.2.
# The point is for the user to remove these configuration records
# one by one as the offenses are removed from the code base.
# Note that changes in the inspected code, or installation of new
# versions of RuboCop, may require this file to be generated again.

# Offense count: 2
# This cop supports safe autocorrection (--autocorrect).
# This cop supports safe auto-correction (--auto-correct).
# Configuration parameters: EnforcedStyleAlignWith, Severity.
# SupportedStylesAlignWith: start_of_line, begin
Layout/BeginEndAlignment:
Expand All @@ -16,7 +16,7 @@ Layout/BeginEndAlignment:
- 'lib/rspec/rails/tasks/rspec.rake'

# Offense count: 2
# This cop supports safe autocorrection (--autocorrect).
# This cop supports safe auto-correction (--auto-correct).
# Configuration parameters: AllowAliasSyntax, AllowedMethods.
# AllowedMethods: alias_method, public, protected, private
Layout/EmptyLinesAroundAttributeAccessor:
Expand All @@ -25,7 +25,7 @@ Layout/EmptyLinesAroundAttributeAccessor:
- 'spec/rspec/rails/matchers/be_valid_spec.rb'

# Offense count: 4
# This cop supports safe autocorrection (--autocorrect).
# This cop supports safe auto-correction (--auto-correct).
# Configuration parameters: AllowMultipleStyles, EnforcedHashRocketStyle, EnforcedColonStyle, EnforcedLastArgumentHashStyle.
# SupportedHashRocketStyles: key, separator, table
# SupportedColonStyles: key, separator, table
Expand All @@ -35,7 +35,7 @@ Layout/HashAlignment:
- 'rspec-rails.gemspec'

# Offense count: 34
# This cop supports safe autocorrection (--autocorrect).
# This cop supports safe auto-correction (--auto-correct).
# Configuration parameters: .
# SupportedStyles: space, no_space
Layout/SpaceAroundEqualsInParameterDefault:
Expand All @@ -54,13 +54,13 @@ Lint/AmbiguousBlockAssociation:
- 'spec/rspec/rails/view_spec_methods_spec.rb'

# Offense count: 1
# This cop supports safe autocorrection (--autocorrect).
# This cop supports safe auto-correction (--auto-correct).
Lint/AmbiguousOperator:
Exclude:
- 'Rakefile'

# Offense count: 5
# This cop supports safe autocorrection (--autocorrect).
# This cop supports safe auto-correction (--auto-correct).
Lint/AmbiguousRegexpLiteral:
Exclude:
- 'features/step_definitions/additional_cli_steps.rb'
Expand Down Expand Up @@ -98,7 +98,7 @@ Lint/EmptyExpression:
- 'lib/rspec/rails/adapters.rb'

# Offense count: 1
# This cop supports unsafe autocorrection (--autocorrect-all).
# This cop supports unsafe auto-correction (--auto-correct-all).
Lint/NonDeterministicRequireOrder:
Exclude:
- 'spec/spec_helper.rb'
Expand Down Expand Up @@ -165,50 +165,42 @@ Naming/MethodParameterName:
- 'spec/rspec/rails/example/controller_example_group_spec.rb'

# Offense count: 4
# This cop supports safe autocorrection (--autocorrect).
# This cop supports safe auto-correction (--auto-correct).
# Configuration parameters: PreferredName.
Naming/RescuedExceptionsVariableName:
Exclude:
- 'lib/rspec/rails/matchers/base_matcher.rb'
- 'lib/rspec/rails/matchers/have_http_status.rb'

# Offense count: 2
# This cop supports safe autocorrection (--autocorrect).
# This cop supports safe auto-correction (--auto-correct).
Style/BisectedAttrAccessor:
Exclude:
- 'lib/rspec/rails/view_rendering.rb'

# Offense count: 17
# This cop supports unsafe autocorrection (--autocorrect-all).
# Offense count: 18
# This cop supports safe auto-correction (--auto-correct).
# Configuration parameters: EnforcedStyle.
# SupportedStyles: nested, compact
Style/ClassAndModuleChildren:
Enabled: false

# Offense count: 1
# This cop supports safe autocorrection (--autocorrect).
# Configuration parameters: Keywords, RequireColon.
# Keywords: TODO, FIXME, OPTIMIZE, HACK, REVIEW, NOTE
Style/CommentAnnotation:
Exclude:
- 'spec/rspec/rails/matchers/active_job_spec.rb'

# Offense count: 5
# This cop supports unsafe autocorrection (--autocorrect-all).
# This cop supports safe auto-correction (--auto-correct).
Style/CommentedKeyword:
Exclude:
- 'spec/rspec/rails/example/view_example_group_spec.rb'

# Offense count: 6
# This cop supports safe autocorrection (--autocorrect).
# This cop supports safe auto-correction (--auto-correct).
Style/ExplicitBlockArgument:
Exclude:
- 'benchmarks/before_block_capture_block_vs_yield.rb'
- 'features/support/env.rb'
- 'spec/sanity_check_spec.rb'

# Offense count: 152
# This cop supports unsafe autocorrection (--autocorrect-all).
# Offense count: 154
# This cop supports safe auto-correction (--auto-correct).
# Configuration parameters: EnforcedStyle.
# SupportedStyles: always, always_true, never
Style/FrozenStringLiteralComment:
Expand All @@ -228,7 +220,7 @@ Style/HashLikeCase:
- 'lib/rspec/rails/matchers/active_job.rb'

# Offense count: 4
# This cop supports safe autocorrection (--autocorrect).
# This cop supports safe auto-correction (--auto-correct).
# Configuration parameters: EnforcedOctalStyle.
# SupportedOctalStyles: zero_with_o, zero_only
Style/NumericLiteralPrefix:
Expand All @@ -237,12 +229,6 @@ Style/NumericLiteralPrefix:
- 'example_app_generator/generate_app.rb'
- 'spec/sanity_check_spec.rb'

# Offense count: 2
# This cop supports safe autocorrection (--autocorrect).
# Configuration parameters: Strict, AllowedNumbers.
Style/NumericLiterals:
MinDigits: 6

# Offense count: 2
# Configuration parameters: AllowedMethods.
# AllowedMethods: respond_to_missing?
Expand All @@ -251,33 +237,8 @@ Style/OptionalBooleanParameter:
- 'example_app_generator/spec/verify_custom_renderers_spec.rb'
- 'lib/rspec/rails/view_rendering.rb'

# Offense count: 12
# This cop supports safe autocorrection (--autocorrect).
# Configuration parameters: EnforcedStyle, AllowedCompactTypes.
# SupportedStyles: compact, exploded
Style/RaiseArgs:
Exclude:
- 'spec/rspec/rails/matchers/be_routable_spec.rb'
- 'spec/rspec/rails/matchers/have_rendered_spec.rb'
- 'spec/rspec/rails/matchers/redirect_to_spec.rb'
- 'spec/rspec/rails/matchers/route_to_spec.rb'

# Offense count: 36
# This cop supports safe autocorrection (--autocorrect).
Style/RedundantRegexpEscape:
Exclude:
- 'example_app_generator/generate_app.rb'
- 'spec/generators/rspec/feature/feature_generator_spec.rb'
- 'spec/generators/rspec/generator/generator_generator_spec.rb'
- 'spec/generators/rspec/system/system_generator_spec.rb'
- 'spec/generators/rspec/view/view_generator_spec.rb'
- 'spec/rspec/rails/matchers/action_cable/have_stream_spec.rb'
- 'spec/rspec/rails/matchers/have_rendered_spec.rb'
- 'spec/rspec/rails/matchers/redirect_to_spec.rb'
- 'spec/support/generators.rb'

# Offense count: 23
# This cop supports safe autocorrection (--autocorrect).
# This cop supports safe auto-correction (--auto-correct).
# Configuration parameters: AllowIfMethodIsEmpty.
Style/SingleLineMethods:
Exclude:
Expand All @@ -290,14 +251,14 @@ Style/SingleLineMethods:
- 'spec/rspec/rails/setup_and_teardown_adapter_spec.rb'

# Offense count: 1
# This cop supports safe autocorrection (--autocorrect).
# This cop supports safe auto-correction (--auto-correct).
# Configuration parameters: AllowModifier.
Style/SoleNestedConditional:
Exclude:
- 'lib/rspec/rails/tasks/rspec.rake'

# Offense count: 4
# This cop supports unsafe autocorrection (--autocorrect-all).
# This cop supports unsafe auto-correction (--auto-correct-all).
# Configuration parameters: Mode.
Style/StringConcatenation:
Exclude:
Expand Down
2 changes: 1 addition & 1 deletion example_app_generator/generate_app.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
# Remove the existing rails version so we can properly use main or other
# edge branches
gsub_file 'Gemfile', /^.*\bgem ['"]rails.*$/, ''
gsub_file 'Gemfile', /^.*\bgem ['"]selenium\-webdriver.*$/, ''
gsub_file 'Gemfile', /^.*\bgem ['"]selenium-webdriver.*$/, ''
gsub_file "Gemfile", /.*web-console.*/, ''
gsub_file "Gemfile", /.*debug.*/, ''
gsub_file "Gemfile", /.*puma.*/, ''
Expand Down
6 changes: 3 additions & 3 deletions spec/generators/rspec/feature/feature_generator_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
expect(feature_spec).to contain(/require 'rails_helper'/)
end
it "contains the feature" do
expect(feature_spec).to contain(/^RSpec.feature \"Posts\", #{type_metatag(:feature)}/)
expect(feature_spec).to contain(/^RSpec.feature "Posts", #{type_metatag(:feature)}/)
end
end
end
Expand All @@ -34,7 +34,7 @@
expect(feature_spec).to exist
end
it "contains the feature" do
expect(feature_spec).to contain(/^RSpec.feature \"Folder::Posts\", #{type_metatag(:feature)}/)
expect(feature_spec).to contain(/^RSpec.feature "Folder::Posts", #{type_metatag(:feature)}/)
end
end
end
Expand All @@ -49,7 +49,7 @@
expect(feature_spec).to exist
end
it "contains the singularized feature" do
expect(feature_spec).to contain(/^RSpec.feature \"Post\", #{type_metatag(:feature)}/)
expect(feature_spec).to contain(/^RSpec.feature "Post", #{type_metatag(:feature)}/)
end
end
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
expect(generator_spec).to contain(/require 'rails_helper'/)
end
it "includes the generator type in the metadata" do
expect(generator_spec).to contain(/^RSpec.describe \"Posts\", #{type_metatag(:generator)}/)
expect(generator_spec).to contain(/^RSpec.describe "Posts", #{type_metatag(:generator)}/)
end
end
end
2 changes: 1 addition & 1 deletion spec/generators/rspec/system/system_generator_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
expect(system_spec).to contain(/require 'rails_helper'/)
end
it "contains the system" do
expect(system_spec).to contain(/^RSpec.describe \"Posts\", #{type_metatag(:system)}/)
expect(system_spec).to contain(/^RSpec.describe "Posts", #{type_metatag(:system)}/)
end
end
end
Expand Down
6 changes: 3 additions & 3 deletions spec/generators/rspec/view/view_generator_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
run_generator %w[posts index]
file('spec/views/posts/index.html.erb_spec.rb').tap do |f|
expect(f).to contain(/require 'rails_helper'/)
expect(f).to contain(/^RSpec.describe \"posts\/index\", #{type_metatag(:view)}/)
expect(f).to contain(/^RSpec.describe "posts\/index", #{type_metatag(:view)}/)
end
end

Expand All @@ -19,7 +19,7 @@
run_generator %w[admin/posts index]
file('spec/views/admin/posts/index.html.erb_spec.rb').tap do |f|
expect(f).to contain(/require 'rails_helper'/)
expect(f).to contain(/^RSpec.describe \"admin\/posts\/index\", #{type_metatag(:view)}/)
expect(f).to contain(/^RSpec.describe "admin\/posts\/index", #{type_metatag(:view)}/)
end
end
end
Expand All @@ -30,7 +30,7 @@
run_generator %w[posts index --template_engine haml]
file('spec/views/posts/index.html.haml_spec.rb').tap do |f|
expect(f).to contain(/require 'rails_helper'/)
expect(f).to contain(/^RSpec.describe \"posts\/index\", #{type_metatag(:view)}/)
expect(f).to contain(/^RSpec.describe "posts\/index", #{type_metatag(:view)}/)
end
end
end
Expand Down
14 changes: 7 additions & 7 deletions spec/rspec/rails/matchers/action_cable/have_stream_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ def subscribed

expect {
expect(subscription).to have_stream_from("chat_2")
}.to raise_error(/expected to have stream "chat_2" started, but have \[\"chat_1\"\]/)
}.to raise_error(/expected to have stream "chat_2" started, but have \["chat_1"\]/)
end

context "with negated form" do
Expand All @@ -113,7 +113,7 @@ def subscribed

expect {
expect(subscription).not_to have_stream_from("chat_1")
}.to raise_error(/expected not to have stream "chat_1" started, but have \[\"chat_1\"\]/)
}.to raise_error(/expected not to have stream "chat_1" started, but have \["chat_1"\]/)
end
end

Expand All @@ -129,7 +129,7 @@ def subscribed

expect {
expect(subscription).to have_stream_from(a_string_starting_with("room"))
}.to raise_error(/expected to have stream a string starting with "room" started, but have \[\"chat_1\"\]/)
}.to raise_error(/expected to have stream a string starting with "room" started, but have \["chat_1"\]/)
end
end
end
Expand Down Expand Up @@ -159,23 +159,23 @@ def subscribed
subscribe user: 42

expect {
expect(subscription).to have_stream_for(StreamModel.new(31337))
}.to raise_error(/expected to have stream "broadcast:StreamModel#31337" started, but have \[\"broadcast:StreamModel#42\"\]/)
expect(subscription).to have_stream_for(StreamModel.new(31_337))
}.to raise_error(/expected to have stream "broadcast:StreamModel#31337" started, but have \["broadcast:StreamModel#42"\]/)
end

context "with negated form" do
it "passes" do
subscribe user: 42

expect(subscription).not_to have_stream_for(StreamModel.new(31337))
expect(subscription).not_to have_stream_for(StreamModel.new(31_337))
end

it "fails with message" do
subscribe user: 42

expect {
expect(subscription).not_to have_stream_for(StreamModel.new(42))
}.to raise_error(/expected not to have stream "broadcast:StreamModel#42" started, but have \[\"broadcast:StreamModel#42\"\]/)
}.to raise_error(/expected not to have stream "broadcast:StreamModel#42" started, but have \["broadcast:StreamModel#42"\]/)
end
end
end
Expand Down
2 changes: 1 addition & 1 deletion spec/rspec/rails/matchers/active_job_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ def self.name; "LoggingJob"; end
end

it "works with time offsets" do
# note that Time.current does not replicate Rails behavior for 5 seconds from now.
# NOTE: Time.current does not replicate Rails behavior for 5 seconds from now.
time = Time.current.change(usec: 0)
travel_to time do
expect { hello_job.set(wait: 5).perform_later }.to have_enqueued_job.at(time + 5)
Expand Down
4 changes: 2 additions & 2 deletions spec/rspec/rails/matchers/be_routable_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
end

it "fails if routes do not recognize the path" do
allow(routes).to receive(:recognize_path) { raise ActionController::RoutingError.new('ignore') }
allow(routes).to receive(:recognize_path) { raise ActionController::RoutingError, 'ignore' }
expect do
expect({ get: "/a/path" }).to be_routable
end.to raise_error(/expected \{:get=>"\/a\/path"\} to be routable/)
Expand All @@ -27,7 +27,7 @@
context "with should_not" do

it "passes if routes do not recognize the path" do
allow(routes).to receive(:recognize_path) { raise ActionController::RoutingError.new('ignore') }
allow(routes).to receive(:recognize_path) { raise ActionController::RoutingError, 'ignore' }
expect do
expect({ get: "/a/path" }).not_to be_routable
end.to_not raise_error
Expand Down
Loading