Skip to content

Commit

Permalink
Refactor/gem tidy (#1715)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
luke-hill authored Aug 31, 2023
1 parent 9a1fa3c commit ba50a6e
Show file tree
Hide file tree
Showing 4 changed files with 55 additions and 50 deletions.
32 changes: 19 additions & 13 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,10 @@ require:

AllCops:
NewCops: disable
# Keep this inline with the lowest ruby-* version in circleci/config.yml and
# the version in the gemspec
# Keep this inline with the lowest ruby version in the gemspec
TargetRubyVersion: 2.7
# Cop names are not displayed in offense messages by default. Change behavior
# by overriding DisplayCopNames, or by giving the `-D/--display-cop-names`
# option.
# Display cop name / style guide references
DisplayCopNames: true
# Style guide URLs are not displayed in offense messages by default. Change
# behavior by overriding `DisplayStyleGuide`, or by giving the
# `-S/--display-style-guide` option.
DisplayStyleGuide: true
Exclude:
- 'bin/*'
Expand All @@ -23,9 +17,12 @@ AllCops:
- 'temp_app/**/*'
- 'cck/features/**/*'

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

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

# Reviewed: Formatters put trailing spaces after things like 'Feature: '
# In pretty_spec.rb, progress_spec.rb offences look false,
# as the trailing spaces are in multiline string literals
# In pretty_spec.rb & progress_spec.rb offences look false as the trailing spaces are in fact multiline string literals
Layout/TrailingWhitespace:
Exclude:
- 'spec/cucumber/formatter/pretty_spec.rb'
- 'spec/cucumber/formatter/progress_spec.rb'

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

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

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

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

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

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

# 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
# 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
Layout/LineLength:
Max: 200

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

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

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

Expand Down Expand Up @@ -155,4 +161,4 @@ Style/RegexpLiteral:
AllowInnerSlashes: true

Style/YodaCondition:
Enabled: true
Enabled: true
10 changes: 3 additions & 7 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,15 +1,11 @@
source 'https://rubygems.org'

git_source(:github) { |repo| "https://github.com/#{repo}.git" }

gemspec

gem 'rubocop', '1.43.0'
gem 'rubocop-packaging', '0.5.2'

# To hack on Cucumber together with any of these libraries, uncomment the line below:
# gem 'cucumber-core', path: '../cucumber-ruby-core'
# gem 'cucumber-cucumber-expressions', path: '../cucumber-expressions/ruby'
# gem 'cucumber-gherkin', path: '../common/gherkin/ruby'
# gem 'cucumber-gherkin', path: '../gherkin/ruby'
# gem 'cucumber-html-formatter', path: '../html-formatter/ruby'
# gem 'cucumber-messages', path: '../common/messages/ruby'
# gem 'cucumber-messages', path: '../messages/ruby'
# gem 'cucumber-tag-expressions', path: '../tag-expressions/ruby'
31 changes: 16 additions & 15 deletions UPGRADING.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ If you are still using the built-in wire protocol here the step to migrate to cu

# ...

gem "cucumber"
gem "cucumber-wire"
gem 'cucumber'
gem 'cucumber-wire'

# ...

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

```ruby
Cucumber::Cli::Main.new(
argument_list,
nil, # <-- this is a former unused `stdin` parameter
@stdout,
@stderr,
@kernel
argument_list,
nil, # <-- this is a former unused `stdin` parameter
@stdout,
@stderr,
@kernel
).execute!
```

Expand All @@ -97,10 +97,10 @@ required anymore:

```ruby
Cucumber::Cli::Main.new(
argument_list,
@stdout,
@stderr,
@kernel
argument_list,
@stdout,
@stderr,
@kernel
).execute!
```

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

```ruby
table.map_column('column', false).do |value|
table.map_column('column', false) do |value|
end
```

### With cucumber 8.0.0

```ruby
table.map_column('column', strict: false).do |value|
table.map_column('column', strict: false) do |value|
end
```

Expand Down Expand Up @@ -149,8 +149,8 @@ Gemfile alongside the `cucumber` one, and install it:
# ...
gem "cucumber"
gem "cucumber-wire"
gem 'cucumber'
gem 'cucumber-wire'
# ...
Expand All @@ -164,6 +164,7 @@ code yet, create a new one. For example `features/support/wire.rb`.

```ruby
# features/support/wire.rb
require 'cucumber/wire'
```

Expand Down
32 changes: 17 additions & 15 deletions cucumber.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -17,39 +17,41 @@ Gem::Specification.new do |s|
'source_code_uri' => 'https://github.com/cucumber/cucumber-ruby'
}

# Keep in sync with .circleci/config.yml & .rubocop.yml
s.required_ruby_version = '>= 2.7'

s.add_dependency 'builder', '~> 3.2', '>= 3.2.4'
s.add_dependency 'cucumber-ci-environment', '~> 9.0', '>= 9.0.4'
s.add_dependency 'cucumber-ci-environment', '~> 9.2', '>= 9.2.0'
s.add_dependency 'cucumber-core', '~> 11.0', '>= 11.0.0'
s.add_dependency 'cucumber-cucumber-expressions', '>= 15.1.1', '< 17.0'
s.add_dependency 'cucumber-cucumber-expressions', '~> 16.1', '>= 16.1.2'
s.add_dependency 'cucumber-gherkin', '>= 23.0.1', '< 26.2.1'
s.add_dependency 'cucumber-html-formatter', '>= 19.1', '< 21.0'
s.add_dependency 'cucumber-html-formatter', '~> 20.4', '>= 20.4.0'
s.add_dependency 'cucumber-messages', '>= 18', '< 23'
s.add_dependency 'diff-lcs', '~> 1.5', '>= 1.5.0'
s.add_dependency 'mini_mime', '~> 1.0'
s.add_dependency 'mini_mime', '~> 1.1', '>= 1.1.5'
s.add_dependency 'multi_test', '~> 1.1', '>= 1.1.0'
s.add_dependency 'sys-uname', '~> 1.2', '>= 1.2.2'
s.add_dependency 'sys-uname', '~> 1.2', '>= 1.2.3'

s.add_development_dependency 'cucumber-compatibility-kit', '~> 9.2', '>= 9.2.1'
s.add_development_dependency 'nokogiri', '~> 1.13', '>= 1.13.6'
s.add_development_dependency 'pry', '~> 0.14', '>= 0.14.1'
s.add_development_dependency 'rake', '~> 13.0', '>= 13.0.6'
s.add_development_dependency 'rspec', '~> 3.11', '>= 3.11.0'
s.add_development_dependency 'simplecov', '~> 0.21', '>= 0.21.2'
s.add_development_dependency 'rspec', '~> 3.12', '>= 3.12.0'
s.add_development_dependency 'rubocop', '1.43.0'
s.add_development_dependency 'rubocop-packaging', '~> 0.5.2'
s.add_development_dependency 'simplecov', '~> 0.22', '>= 0.22.0'
s.add_development_dependency 'syntax', '~> 1.2', '>= 1.2.2'
s.add_development_dependency 'test-unit', '~> 3.5', '>= 3.5.3'
s.add_development_dependency 'webrick', '~> 1.7', '>= 1.7.0'
s.add_development_dependency 'test-unit', '~> 3.6', '>= 3.6.1'
s.add_development_dependency 'webrick', '~> 1.8', '>= 1.8.1'

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

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

s.required_rubygems_version = '>= 1.6.1'
s.required_rubygems_version = '>= 3.0.1'
s.files = Dir[
'CHANGELOG.old.md',
'CONTRIBUTING.md',
Expand Down

0 comments on commit ba50a6e

Please sign in to comment.