Skip to content

Commit ba50a6e

Browse files
authored
Refactor/gem tidy (#1715)
* Remove un-needed comments / capybara pin. Up rubygems requirement to supported version * Remove superfluous git source repo * Tidy up refs to locally stored gems * Add tag expressions to local run * Tweak of gems * Amalgamation of an interim update mixed with the script updater * Standardise gem requirements into one place (Will re-remove items back out once rubocop upgrades are done) * Permit rubocop-packaging updates * Minor tidy up of upgrading notes * Downgrade messages to solve compatibility problem * Downgrade cucumber-core and cucumber-gherkin to solve dependency mismatches * Add in a series of potential TODO fixups for me to tackle in the v9 series of cucumber * Minor patch update for cucumber gherkin min requirement
1 parent 9a1fa3c commit ba50a6e

File tree

4 files changed

+55
-50
lines changed

4 files changed

+55
-50
lines changed

.rubocop.yml

Lines changed: 19 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,10 @@ require:
55

66
AllCops:
77
NewCops: disable
8-
# Keep this inline with the lowest ruby-* version in circleci/config.yml and
9-
# the version in the gemspec
8+
# Keep this inline with the lowest ruby version in the gemspec
109
TargetRubyVersion: 2.7
11-
# Cop names are not displayed in offense messages by default. Change behavior
12-
# by overriding DisplayCopNames, or by giving the `-D/--display-cop-names`
13-
# option.
10+
# Display cop name / style guide references
1411
DisplayCopNames: true
15-
# Style guide URLs are not displayed in offense messages by default. Change
16-
# behavior by overriding `DisplayStyleGuide`, or by giving the
17-
# `-S/--display-style-guide` option.
1812
DisplayStyleGuide: true
1913
Exclude:
2014
- 'bin/*'
@@ -23,9 +17,12 @@ AllCops:
2317
- 'temp_app/**/*'
2418
- 'cck/features/**/*'
2519

20+
# TODO: [LH] - Candidate for phasing out in v9 patch releases. People should have this stored in editor and ideally not use windows
21+
# for ruby development. Where they are, their editor config should have this setting
2622
Layout/EndOfLine:
2723
EnforcedStyle: lf
2824

25+
# TODO: [LH] - This needs removing - legacy code. Initially move to auto-gen-config and then fix
2926
# Disabling this cop until the minimum Ruby version is >= 2.3 as squiggly
3027
# heredocs '<<~' were introduced then. The files below are the current ones
3128
# with offenses
@@ -39,56 +36,65 @@ Layout/HeredocIndentation:
3936
- 'spec/cucumber/formatter/pretty_spec.rb'
4037

4138
# Reviewed: Formatters put trailing spaces after things like 'Feature: '
42-
# In pretty_spec.rb, progress_spec.rb offences look false,
43-
# as the trailing spaces are in multiline string literals
39+
# In pretty_spec.rb & progress_spec.rb offences look false as the trailing spaces are in fact multiline string literals
4440
Layout/TrailingWhitespace:
4541
Exclude:
4642
- 'spec/cucumber/formatter/pretty_spec.rb'
4743
- 'spec/cucumber/formatter/progress_spec.rb'
4844

45+
# TODO: [LH] - This needs re-reviewing and fixing, we have been partially fixing this up in 2019/2020 onwards
46+
# (Likely that this is primarily already fixed)
4947
# Reviewed: please see PR-1022 for details on why this cop is disabled:
5048
# https://github.com/cucumber/cucumber-ruby/pull/1022
5149
Lint/AmbiguousOperator:
5250
Enabled: false
5351

52+
# TODO: [LH] - This needs a re-review. I think we can pretty much delete / phase this out with incremental updates
5453
# We exclude proto_world for documentation (rdoc) purpose
5554
Lint/UselessMethodDefinition:
5655
Enabled: true
5756
Exclude:
5857
- 'lib/cucumber/glue/proto_world.rb'
5958

59+
# TODO: [LH] - This definitely needs a partial fix / reduction. Even if only an interim one that pushes some stuff
60+
# to the auto-gen-config
6061
Metrics/AbcSize:
6162
Max: 45
6263

64+
# TODO: [LH] - This needs a re-review. I think we can pretty much delete / phase this out with incremental updates
6365
Metrics/BlockLength:
6466
CountComments: false
6567
Exclude:
6668
- './cucumber.gemspec'
6769
- './spec/**/*'
6870
- 'cck/spec/**/*'
6971

72+
# TODO: [LH] - This definitely needs a partial fix / reduction. Even if only an interim one that pushes some stuff
7073
Metrics/ClassLength:
7174
Max: 375
7275
Exclude:
7376
- 'lib/cucumber/cli/options.rb'
7477

78+
# TODO: [LH] - This definitely needs a partial fix / reduction. Even if only an interim one that pushes some stuff
7579
Metrics/CyclomaticComplexity:
7680
Max: 12
7781

78-
# A line length of 200 covers most violations in the repo while still being
79-
# a more up to date length given today's screen sizes
82+
# A line length of 200 covers most violations in the repo while still being a more up to date length given today's screen sizes
8083
Layout/LineLength:
8184
Max: 200
8285

86+
# TODO: [LH] - This definitely needs a partial fix / reduction. Even if only an interim one that pushes some stuff
8387
Metrics/ModuleLength:
8488
Max: 150
8589
Exclude:
8690
- './spec/**/*'
8791
- 'cck/spec/**/*'
8892

93+
# TODO: [LH] - This definitely needs a partial fix / reduction. Even if only an interim one that pushes some stuff
8994
Metrics/MethodLength:
9095
Max: 30
9196

97+
# TODO: [LH] - This definitely needs a partial fix / reduction. Even if only an interim one that pushes some stuff
9298
Metrics/PerceivedComplexity:
9399
Max: 13
94100

@@ -155,4 +161,4 @@ Style/RegexpLiteral:
155161
AllowInnerSlashes: true
156162

157163
Style/YodaCondition:
158-
Enabled: true
164+
Enabled: true

Gemfile

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,11 @@
11
source 'https://rubygems.org'
22

3-
git_source(:github) { |repo| "https://github.com/#{repo}.git" }
4-
53
gemspec
64

7-
gem 'rubocop', '1.43.0'
8-
gem 'rubocop-packaging', '0.5.2'
9-
105
# To hack on Cucumber together with any of these libraries, uncomment the line below:
116
# gem 'cucumber-core', path: '../cucumber-ruby-core'
127
# gem 'cucumber-cucumber-expressions', path: '../cucumber-expressions/ruby'
13-
# gem 'cucumber-gherkin', path: '../common/gherkin/ruby'
8+
# gem 'cucumber-gherkin', path: '../gherkin/ruby'
149
# gem 'cucumber-html-formatter', path: '../html-formatter/ruby'
15-
# gem 'cucumber-messages', path: '../common/messages/ruby'
10+
# gem 'cucumber-messages', path: '../messages/ruby'
11+
# gem 'cucumber-tag-expressions', path: '../tag-expressions/ruby'

UPGRADING.md

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,8 @@ If you are still using the built-in wire protocol here the step to migrate to cu
5555

5656
# ...
5757

58-
gem "cucumber"
59-
gem "cucumber-wire"
58+
gem 'cucumber'
59+
gem 'cucumber-wire'
6060

6161
# ...
6262

@@ -82,11 +82,11 @@ You would have used `Cucumber::Cli::Main` with a dummy parameter:
8282

8383
```ruby
8484
Cucumber::Cli::Main.new(
85-
argument_list,
86-
nil, # <-- this is a former unused `stdin` parameter
87-
@stdout,
88-
@stderr,
89-
@kernel
85+
argument_list,
86+
nil, # <-- this is a former unused `stdin` parameter
87+
@stdout,
88+
@stderr,
89+
@kernel
9090
).execute!
9191
```
9292

@@ -97,10 +97,10 @@ required anymore:
9797

9898
```ruby
9999
Cucumber::Cli::Main.new(
100-
argument_list,
101-
@stdout,
102-
@stderr,
103-
@kernel
100+
argument_list,
101+
@stdout,
102+
@stderr,
103+
@kernel
104104
).execute!
105105
```
106106

@@ -111,14 +111,14 @@ The `strict` argument for the `map_column` method has changed to a keyword argum
111111
### Before 8.0.0
112112

113113
```ruby
114-
table.map_column('column', false).do |value|
114+
table.map_column('column', false) do |value|
115115
end
116116
```
117117

118118
### With cucumber 8.0.0
119119

120120
```ruby
121-
table.map_column('column', strict: false).do |value|
121+
table.map_column('column', strict: false) do |value|
122122
end
123123
```
124124

@@ -149,8 +149,8 @@ Gemfile alongside the `cucumber` one, and install it:
149149

150150
# ...
151151

152-
gem "cucumber"
153-
gem "cucumber-wire"
152+
gem 'cucumber'
153+
gem 'cucumber-wire'
154154

155155
# ...
156156

@@ -164,6 +164,7 @@ code yet, create a new one. For example `features/support/wire.rb`.
164164

165165
```ruby
166166
# features/support/wire.rb
167+
167168
require 'cucumber/wire'
168169
```
169170

cucumber.gemspec

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -17,39 +17,41 @@ Gem::Specification.new do |s|
1717
'source_code_uri' => 'https://github.com/cucumber/cucumber-ruby'
1818
}
1919

20-
# Keep in sync with .circleci/config.yml & .rubocop.yml
2120
s.required_ruby_version = '>= 2.7'
21+
2222
s.add_dependency 'builder', '~> 3.2', '>= 3.2.4'
23-
s.add_dependency 'cucumber-ci-environment', '~> 9.0', '>= 9.0.4'
23+
s.add_dependency 'cucumber-ci-environment', '~> 9.2', '>= 9.2.0'
2424
s.add_dependency 'cucumber-core', '~> 11.0', '>= 11.0.0'
25-
s.add_dependency 'cucumber-cucumber-expressions', '>= 15.1.1', '< 17.0'
25+
s.add_dependency 'cucumber-cucumber-expressions', '~> 16.1', '>= 16.1.2'
2626
s.add_dependency 'cucumber-gherkin', '>= 23.0.1', '< 26.2.1'
27-
s.add_dependency 'cucumber-html-formatter', '>= 19.1', '< 21.0'
27+
s.add_dependency 'cucumber-html-formatter', '~> 20.4', '>= 20.4.0'
2828
s.add_dependency 'cucumber-messages', '>= 18', '< 23'
2929
s.add_dependency 'diff-lcs', '~> 1.5', '>= 1.5.0'
30-
s.add_dependency 'mini_mime', '~> 1.0'
30+
s.add_dependency 'mini_mime', '~> 1.1', '>= 1.1.5'
3131
s.add_dependency 'multi_test', '~> 1.1', '>= 1.1.0'
32-
s.add_dependency 'sys-uname', '~> 1.2', '>= 1.2.2'
32+
s.add_dependency 'sys-uname', '~> 1.2', '>= 1.2.3'
3333

3434
s.add_development_dependency 'cucumber-compatibility-kit', '~> 9.2', '>= 9.2.1'
3535
s.add_development_dependency 'nokogiri', '~> 1.13', '>= 1.13.6'
3636
s.add_development_dependency 'pry', '~> 0.14', '>= 0.14.1'
3737
s.add_development_dependency 'rake', '~> 13.0', '>= 13.0.6'
38-
s.add_development_dependency 'rspec', '~> 3.11', '>= 3.11.0'
39-
s.add_development_dependency 'simplecov', '~> 0.21', '>= 0.21.2'
38+
s.add_development_dependency 'rspec', '~> 3.12', '>= 3.12.0'
39+
s.add_development_dependency 'rubocop', '1.43.0'
40+
s.add_development_dependency 'rubocop-packaging', '~> 0.5.2'
41+
s.add_development_dependency 'simplecov', '~> 0.22', '>= 0.22.0'
4042
s.add_development_dependency 'syntax', '~> 1.2', '>= 1.2.2'
41-
s.add_development_dependency 'test-unit', '~> 3.5', '>= 3.5.3'
42-
s.add_development_dependency 'webrick', '~> 1.7', '>= 1.7.0'
43+
s.add_development_dependency 'test-unit', '~> 3.6', '>= 3.6.1'
44+
s.add_development_dependency 'webrick', '~> 1.8', '>= 1.8.1'
4345

4446
# For maintainer scripts
4547
s.add_development_dependency 'octokit', '~> 6.0', '>= 6.1.0'
4648

47-
# Needed for examples (rake examples)
48-
s.add_development_dependency 'capybara', '~> 3.36', '>= 3.36.0', '< 3.37'
49-
s.add_development_dependency 'rack-test', '>= 1.1.0', '~> 2.0'
50-
s.add_development_dependency 'sinatra', '>= 2.2.0', '~> 3.0'
49+
# Needed for rake examples
50+
s.add_development_dependency 'capybara', '~> 3.39', '>= 3.39.2'
51+
s.add_development_dependency 'rack-test', '~> 2.1', '>= 2.1.0'
52+
s.add_development_dependency 'sinatra', '~> 3.1', '>= 3.1.0'
5153

52-
s.required_rubygems_version = '>= 1.6.1'
54+
s.required_rubygems_version = '>= 3.0.1'
5355
s.files = Dir[
5456
'CHANGELOG.old.md',
5557
'CONTRIBUTING.md',

0 commit comments

Comments
 (0)