Skip to content

Commit d73a14c

Browse files
authored
v3: rubocop update (#581)
* Update rubocop from 1.31 to 1.45 (Large update) * AF: Style/RedundantConstantBase * AF: Style/RedundantStringEscape * Update packaging to latest version to mitigating spam deprecations * Add in latest version of rubocop-rake and reasonably up to date version of rubocop-rails * AF: Rake/Desc * Ignore Environment Rake cop * gsub_file does write to stdout or a form of it now * Update config * Partial update towards later versions of rubocop gems * Fix heredoc warnings * Fix quotes * Add changelog
1 parent 9879b81 commit d73a14c

File tree

17 files changed

+33
-90
lines changed

17 files changed

+33
-90
lines changed

.rubocop.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
require:
22
- rubocop-packaging
33
- rubocop-performance
4+
- rubocop-rails
5+
- rubocop-rake
46
- rubocop-rspec
57

68
AllCops:
@@ -24,6 +26,10 @@ Layout/LineLength:
2426
- '^When'
2527
- '^Then'
2628

29+
# This cop isn't relevant for our codebase
30+
Rails/RakeEnvironment:
31+
Enabled: false
32+
2733
# This allows us to read the chmod action in a more reproducible way
2834
Style/NumericLiteralPrefix:
2935
EnforcedOctalStyle: zero_only

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ This file is intended to be modified using the [`changelog`](github.com/cucumber
1010
## [Unreleased]
1111
### Changed
1212
- Add support for Rails 7.1 [#575](https://github.com/cucumber/cucumber-rails/pull/575)
13+
- Added new rubocop sub-gems (rails / rake) and updated versions to 2.6 ruby-conformance [#581](https://github.com/cucumber/cucumber-rails/pull/581)
1314

1415
### Fixed
1516
- Some of the rails 5.2 tests were installing lots of old conflicting gems ([luke-hill])

Rakefile

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,15 +34,16 @@ namespace :test do
3434
end
3535

3636
namespace :gemfiles do
37-
desc 'Install dependencies for all gemfiles'
37+
desc 'Re-install dependencies for all gemfiles'
3838
task :install do
3939
system 'bundle exec appraisal update'
4040
end
4141

42+
desc 'Remove all generated gemfiles'
4243
task :clean do
4344
FileUtils.rm_rf('gemfiles/*')
4445
end
4546

46-
desc 'Rebuild generated gemfiles and install dependencies'
47+
desc 'Remove all generated gemfiles and re-install dependencies'
4748
task rebuild: %i[clean install]
4849
end

cucumber-rails.gemspec

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,12 @@ Gem::Specification.new do |s|
3636
s.add_development_dependency('rails', '>= 5.2', '< 8')
3737
s.add_development_dependency('rake', '>= 12.0')
3838
s.add_development_dependency('rspec', '~> 3.6')
39-
s.add_development_dependency('rubocop', '~> 1.31.0')
40-
s.add_development_dependency('rubocop-packaging', '~> 0.5.1')
41-
s.add_development_dependency('rubocop-performance', '~> 1.17.0')
42-
s.add_development_dependency('rubocop-rspec', '~> 2.12.0')
39+
s.add_development_dependency('rubocop', '~> 1.45.0')
40+
s.add_development_dependency('rubocop-packaging', '~> 0.5.2')
41+
s.add_development_dependency('rubocop-performance', '~> 1.17.1')
42+
s.add_development_dependency('rubocop-rails', '~> 2.18.0')
43+
s.add_development_dependency('rubocop-rake', '~> 0.6.0')
44+
s.add_development_dependency('rubocop-rspec', '~> 2.17.0')
4345

4446
# For Documentation:
4547
s.add_development_dependency('yard', '~> 0.9.10')

dev_tasks/yard.rake

Lines changed: 0 additions & 28 deletions
This file was deleted.
Binary file not shown.

dev_tasks/yard/default/layout/html/footer.erb

Lines changed: 0 additions & 5 deletions
This file was deleted.

dev_tasks/yard/default/layout/html/index.erb

Lines changed: 0 additions & 1 deletion
This file was deleted.

dev_tasks/yard/default/layout/html/layout.erb

Lines changed: 0 additions & 25 deletions
This file was deleted.

dev_tasks/yard/default/layout/html/logo.erb

Lines changed: 0 additions & 1 deletion
This file was deleted.

dev_tasks/yard/default/layout/html/setup.rb

Lines changed: 0 additions & 9 deletions
This file was deleted.

lib/cucumber/rails.rb

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,12 @@
1414
require 'rails/test_help'
1515

1616
unless Rails.application.config.cache_classes || defined?(Spring)
17-
warn "WARNING: You have set Rails' config.cache_classes to false
18-
(Spring needs cache_classes set to false). This is known to cause problems
19-
with database transactions. Set config.cache_classes to true if you want to use transactions."
17+
warn <<~MESSAGE
18+
WARNING: You have set Rails' config.cache_classes to false (Spring needs cache_classes set to false).
19+
This is known to cause problems with database transactions.
20+
21+
Set config.cache_classes to true if you want to use transactions.
22+
MESSAGE
2023
end
2124

2225
require 'cucumber/rails/world'
@@ -31,8 +34,10 @@
3134

3235
MultiTest.disable_autorun
3336
else
34-
warn "WARNING: Cucumber-rails required outside of env.rb. The rest of loading is being deferred
35-
until env.rb is called. To avoid this warning, move 'gem \'cucumber-rails\', require: false'
36-
under only group :test in your Gemfile. If already in the :test group, be sure you are
37-
specifying 'require: false'."
37+
warn <<~MESSAGE
38+
WARNING: Cucumber-rails has been required outside of env.rb. The rest of loading is being deferred until env.rb is called.
39+
40+
To avoid this warning, move `gem 'cucumber-rails', require: false` under `group :test` in your Gemfile.
41+
If it is already in the `:test` group, be sure you are specifying 'require: false'.
42+
MESSAGE
3843
end

lib/cucumber/rails/capybara/javascript_emulation.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,14 +108,14 @@ class Node
108108

109109
Before('not @no-js-emulation') do
110110
# Enable javascript emulation
111-
::Capybara::RackTest::Node.class_eval do
111+
Capybara::RackTest::Node.class_eval do
112112
alias_method :click, :click_with_javascript_emulation
113113
end
114114
end
115115

116116
Before('@no-js-emulation') do
117117
# Disable javascript emulation
118-
::Capybara::RackTest::Node.class_eval do
118+
Capybara::RackTest::Node.class_eval do
119119
alias_method :click, :click_without_javascript_emulation
120120
end
121121
end

lib/cucumber/rails/capybara/select_dates_and_times.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,4 +70,4 @@ def get_base_dom_id_from_label_tag(field)
7070
end
7171
end
7272

73-
World(::Cucumber::Rails::Capybara::SelectDatesAndTimes)
73+
World(Cucumber::Rails::Capybara::SelectDatesAndTimes)

lib/cucumber/rails/hooks/mail.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# frozen_string_literal: true
22

3-
if defined?(::ActionMailer)
3+
if defined?(ActionMailer)
44
Before do
55
ActionMailer::Base.deliveries = []
66
end

lib/generators/cucumber/install_generator.rb

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,6 @@ def create_database
5353

5454
gsub_file 'config/database.yml', /^test:.*\n/, "test: &test\n"
5555
gsub_file 'config/database.yml', /\z/, "\ncucumber:\n <<: *test\n"
56-
57-
# Since gsub_file doesn't ask the user, just inform user that the file was overwritten.
58-
puts ' force config/database.yml'
5956
end
6057

6158
protected

spec/generators/cucumber/install_generator_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ def create_config_files_the_generator_is_expected_to_modify
6565
it { is_expected.to contain 'load Cucumber::BINARY' }
6666
end
6767

68-
if ::Rails::VERSION::MAJOR >= 6
68+
if Rails::VERSION::MAJOR >= 6
6969
%w[development test].each do |environment|
7070
describe "config/environments/#{environment}.rb" do
7171
subject { file("config/environments/#{environment}.rb") }

0 commit comments

Comments
 (0)