Skip to content

Commit

Permalink
V10: Initial rework (#1759)
Browse files Browse the repository at this point in the history
* Remove calls to require deprecator that isn't needed

* External programs that wanted to track available and invoked step definitions now no longer can - Initial removal

* Fix ordering of class methods in registry and more file

* Mark step definition light as ready for deletion

* Curl Option parser is now package private

* Remove webrick alias that is no longer needed

* Remove tag expression sanitization completely. Proper tag expression syntax is now mandatory

* Remove a TODO from the generic rubocop config

* Deprecate use_legacy_autoloader

* Convert 2 snippets to use heredocs

* Fix up snippet generation specs to use the #comment method instead of joining up strings

* Remove #append_comment_to

* Deprecate text? boolean checker in multiline arguments

* Fix deprecator requirement

* Remove scriipts dir

* Update cucumber dependencies

* Minor rubocop tidy

* Update changelog

* Update all dev dependencies aside from rubocop/rubocop-rspec

* Bump of runtime dependencies to permit latest

* Fix ref to unskippable action from core update

* Fix up references to defined action from core

* Permit latest gherkin this end

* Permit the next 2 majors for messages - 1 for codegen/dotnet and the next also won't have any major ruby changes

* Bump CCK to latest version - issues to arise

* Regenerate the TODO file

* Add v10 upgrading doc

* Upgrade cucumber core to latest and remove the dependency on messages/gherkin as we will lean on the core library for these dependency requirements

* Update upgrading docs to reflect change to core being controlling of more requirements

* Update all rubocop gems to latest version to remove bugs and re-generate TODO

* Remove unrequired hook deprecation

* Fix up latent references to old time conversion and id generator classes

* Fix CCK test helper from finding incorrect path for ndjson serializer/deserializer

* The CCK expects a folder structure for each CCK feature - so we can add a blank dummy one for the empty feature

* Improve CCK comments about ignorability of tests
  • Loading branch information
luke-hill authored Jan 6, 2025
1 parent 5cec922 commit 89b8990
Show file tree
Hide file tree
Showing 32 changed files with 373 additions and 265 deletions.
2 changes: 1 addition & 1 deletion .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ AllCops:
- vendor/**/*
- temp_app/**/*

# 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

Expand Down
123 changes: 112 additions & 11 deletions .rubocop_todo.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,27 @@
# This configuration was generated by
# `rubocop --auto-gen-config`
# on 2024-07-09 14:33:36 UTC using RuboCop version 1.61.0.
# on 2025-01-06 16:14:48 UTC using RuboCop version 1.69.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.

# TODO - [LH] -> Oct '23 - 355 files inspected, 642 offenses detected, 205 offenses autocorrectable
# TODO - [LH] -> Dec '23 - 350 files inspected, 595 offenses detected, 171 offenses autocorrectable
# TODO - [LH] -> Feb '24 - 370 files inspected, 635 offenses detected, 166 offenses autocorrectable
# TODO - [LH] -> Jul '24 - 370 files inspected, 637 offenses detected, 97 offenses autocorrectable
# TODO - [LH] -> Jul '24 - 369 files inspected, 661 offenses detected, 98 offenses autocorrectable
# TODO - [LH] -> Jan '25 (Updated deps and v10 prep) - 369 files inspected, 704 offenses detected, 112 offenses autocorrectable

# Offense count: 1
# This cop supports safe autocorrection (--autocorrect).
# Configuration parameters: EmptyLineBetweenMethodDefs, EmptyLineBetweenClassDefs, EmptyLineBetweenModuleDefs, DefLikeMacros, AllowAdjacentOneLineDefs, NumberOfEmptyLines.
Layout/EmptyLineBetweenDefs:
Exclude:
- 'lib/cucumber/glue/snippet.rb'

# Offense count: 2
Lint/IneffectiveAccessModifier:
Exclude:
- 'lib/cucumber/formatter/curl_option_parser.rb'

# Offense count: 4
Lint/RescueException:
Expand All @@ -19,6 +31,13 @@ Lint/RescueException:
- 'lib/cucumber/glue/invoke_in_world.rb'
- 'lib/cucumber/glue/proto_world.rb'

# Offense count: 1
# This cop supports safe autocorrection (--autocorrect).
# Configuration parameters: AutoCorrect, ContextCreatingMethods, MethodCreatingMethods.
Lint/UselessAccessModifier:
Exclude:
- 'lib/cucumber/formatter/curl_option_parser.rb'

# Offense count: 2
# This cop supports unsafe autocorrection (--autocorrect-all).
# Configuration parameters: AutoCorrect.
Expand Down Expand Up @@ -83,14 +102,30 @@ RSpec/AnyInstance:
Exclude:
- 'spec/cucumber/cli/main_spec.rb'

# Offense count: 9
# Offense count: 4
# This cop supports unsafe autocorrection (--autocorrect-all).
RSpec/BeEq:
Exclude:
- 'spec/cucumber/cli/rerun_spec.rb'
- 'spec/cucumber/multiline_argument/data_table_spec.rb'

# Offense count: 1
# This cop supports safe autocorrection (--autocorrect).
# Configuration parameters: EnabledMethods.
RSpec/Capybara/FeatureMethods:
# Configuration parameters: EnforcedStyle.
# SupportedStyles: be, be_nil
RSpec/BeNil:
Exclude:
- 'spec/cucumber/filters/activate_steps_spec.rb'
- 'spec/cucumber/cli/options_spec.rb'

# Offense count: 5
# Offense count: 1
# This cop supports safe autocorrection (--autocorrect).
# Configuration parameters: EnforcedStyle.
# SupportedStyles: be_a, be_kind_of
RSpec/ClassCheck:
Exclude:
- 'spec/cucumber/glue/proto_world_spec.rb'

# Offense count: 6
# Configuration parameters: Prefixes, AllowedPatterns.
# Prefixes: when, with, without
RSpec/ContextWording:
Expand All @@ -99,10 +134,12 @@ RSpec/ContextWording:
- 'spec/cucumber/formatter/http_io_spec.rb'
- 'spec/cucumber/formatter/junit_spec.rb'
- 'spec/cucumber/formatter/publish_banner_printer_spec.rb'
- 'spec/cucumber/formatter/query/hook_by_test_step_spec.rb'
- 'spec/support/shared_context/http_server.rb'

# Offense count: 2
# This cop supports unsafe autocorrection (--autocorrect-all).
# Configuration parameters: AutoCorrect.
RSpec/EmptyExampleGroup:
Exclude:
- 'spec/cucumber/filters/activate_steps_spec.rb'
Expand All @@ -121,6 +158,12 @@ RSpec/ExampleWording:
Exclude:
- 'spec/cucumber/multiline_argument/data_table_spec.rb'

# Offense count: 2
# This cop supports safe autocorrection (--autocorrect).
RSpec/ExcessiveDocstringSpacing:
Exclude:
- 'spec/cucumber/formatter/pretty_spec.rb'

# Offense count: 2
# This cop supports safe autocorrection (--autocorrect).
RSpec/ExpectActual:
Expand All @@ -146,12 +189,26 @@ RSpec/ExpectOutput:
RSpec/HookArgument:
Enabled: false

# Offense count: 8
# Offense count: 5
# Configuration parameters: Max, AllowedIdentifiers, AllowedPatterns.
RSpec/IndexedLet:
Exclude:
- 'spec/cucumber/filters/retry_spec.rb'
- 'spec/cucumber/glue/registry_and_more_spec.rb'

# Offense count: 26
# Configuration parameters: AssignmentOnly.
RSpec/InstanceVariable:
Exclude:
- 'spec/cucumber/formatter/query/hook_by_test_step_spec.rb'
- 'spec/support/shared_context/http_server.rb'

# Offense count: 2
# This cop supports safe autocorrection (--autocorrect).
RSpec/MatchArray:
Exclude:
- 'spec/cucumber/cli/configuration_spec.rb'

# Offense count: 5
# Configuration parameters: EnforcedStyle.
# SupportedStyles: have_received, receive
Expand All @@ -161,6 +218,15 @@ RSpec/MessageSpies:
- 'spec/cucumber/formatter/io_http_buffer_spec.rb'
- 'spec/cucumber/runtime/hooks_examples.rb'

# Offense count: 2
# This cop supports safe autocorrection (--autocorrect).
# Configuration parameters: EnforcedStyle.
# SupportedStyles: hash, symbol
RSpec/MetadataStyle:
Exclude:
- 'compatibility/cck_spec.rb'
- 'spec/cucumber/project_initializer_spec.rb'

# Offense count: 15
RSpec/MissingExampleGroupArgument:
Exclude:
Expand Down Expand Up @@ -197,11 +263,34 @@ RSpec/NamedSubject:
- 'spec/cucumber/runtime/support_code_spec.rb'
- 'spec/cucumber/runtime_spec.rb'

# Offense count: 2
# Configuration parameters: AllowedGroups.
RSpec/NestedGroups:
Max: 4

# Offense count: 22
# Configuration parameters: AllowedPatterns.
# AllowedPatterns: ^expect_, ^assert_
RSpec/NoExpectationExample:
Exclude:
- 'spec/cucumber/filters/activate_steps_spec.rb'
- 'spec/cucumber/formatter/fail_fast_spec.rb'
- 'spec/cucumber/formatter/rerun_spec.rb'
- 'spec/cucumber/running_test_case_spec.rb'

# Offense count: 1
RSpec/OverwritingSetup:
Exclude:
- 'spec/cucumber/runtime/support_code_spec.rb'

# Offense count: 10
# This cop supports unsafe autocorrection (--autocorrect-all).
RSpec/ReceiveMessages:
Exclude:
- 'spec/cucumber/cli/configuration_spec.rb'
- 'spec/cucumber/configuration_spec.rb'
- 'spec/cucumber/runtime/support_code_spec.rb'

# Offense count: 8
RSpec/RepeatedExample:
Exclude:
Expand All @@ -216,17 +305,30 @@ RSpec/RepeatedExampleGroupDescription:

# Offense count: 3
# This cop supports safe autocorrection (--autocorrect).
# Configuration parameters: AutoCorrect.
RSpec/ScatteredLet:
Exclude:
- 'spec/cucumber/runtime/support_code_spec.rb'

# Offense count: 1
# This cop supports safe autocorrection (--autocorrect).
RSpec/SortMetadata:
Exclude:
- 'compatibility/cck_spec.rb'

# Offense count: 7
RSpec/StubbedMock:
Exclude:
- 'spec/cucumber/cli/configuration_spec.rb'
- 'spec/cucumber/formatter/interceptor_spec.rb'
- 'spec/cucumber/runtime/meta_message_builder_spec.rb'

# Offense count: 2
RSpec/SubjectDeclaration:
Exclude:
- 'spec/cucumber/runtime/after_hooks_spec.rb'
- 'spec/cucumber/runtime/before_hooks_spec.rb'

# Offense count: 57
# Configuration parameters: IgnoreNameless, IgnoreSymbolicNames.
RSpec/VerifiedDoubles:
Expand Down Expand Up @@ -257,14 +359,13 @@ Style/ClassVars:
Exclude:
- 'spec/cucumber/glue/step_definition_spec.rb'

# Offense count: 2
# Offense count: 1
# This cop supports unsafe autocorrection (--autocorrect-all).
# Configuration parameters: EnforcedStyle.
# SupportedStyles: always, always_true, never
Style/FrozenStringLiteralComment:
Exclude:
- 'spec/support/shared_context/http_server.rb'
- 'spec/support/webrick_proc_handler_alias.rb'

# Offense count: 7
# Configuration parameters: AllowedVariables.
Expand Down
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,24 @@ Please visit [cucumber/CONTRIBUTING.md](https://github.com/cucumber/cucumber/blo
- Added dependencies that will no longer be part of the ruby stdlib ([jeromeag](https://github.com/jerome))
- Updated `cucumber-compatibility-kit` to v16 ([luke-hill](https://github.com/luke-hill))
- Changed compatibility testing to fully lean on external assets instead of duplicating them ([luke-hill](https://github.com/luke-hill))
- Permit usage of latest versions of all cucumber internal gems
- The auto-generation of all placeholder `pending` steps has been refactored (_There should be no visible changes
but the code is now refactored to work using newer ruby standards_)
- The `#text?` method for checking Differences in multi-line text is now deprecated (Users
should lean on an appropriate testing library for this)
- `Cucumber.use_legacy_autoloader` that was intended as a stop-gap for v4/v5 is now deprecated (People
that need to rely on procedural loading / reloading of files should use method invocations) ([luke-hill](https://github.com/luke-hill))

### Fixed
- Fixed an issue where a change to one example in compatibility testing wasn't fully adhered to ([luke-hill](https://github.com/luke-hill))
- Fixed an issue for Ruby 3.4.0 where a default hash instantiation was being picked up as keyword arguments ([Jon Rowe](https://github.com/JonRowe))

### Removed
- `StepDefinitionLight` associated methods. The class itself is present but deprecated
- `Webrick` Proc handling aliases that were long redundant
- Associated legacy scripts for updating dependencies that are no longer used
- Tag Expressions using legacy syntax that were handled / sanitized are no longer done so
(This applies to both regular usage and internal testing)
- Removed support for Ruby 2.7 ([luke-hill](https://github.com/luke-hill))

## [9.2.0] - 2024-03-19
Expand Down
16 changes: 8 additions & 8 deletions bin/rspec
Original file line number Diff line number Diff line change
Expand Up @@ -8,22 +8,22 @@
# this file is here to facilitate running it.
#

require "pathname"
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile.local",
require 'pathname'
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile.local',
Pathname.new(__FILE__).realpath)

bundle_binstub = File.expand_path("../bundle", __FILE__)
bundle_binstub = File.expand_path('../bundle', __FILE__)

if File.file?(bundle_binstub)
if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/
load(bundle_binstub)
else
abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
abort('Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.')
end
end

require "rubygems"
require "bundler/setup"
require 'rubygems'
require 'bundler/setup'

load Gem.bin_path("rspec-core", "rspec")
load Gem.bin_path('rspec-core', 'rspec')
4 changes: 4 additions & 0 deletions compatibility/features/empty/empty_steps.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# frozen_string_literal: true

# The empty CCK scenario does not contain any executable steps. It contains just one scenario
# which will be "ran" and only produce a single pickle for the name of the scenario (No pickles for steps)
2 changes: 1 addition & 1 deletion compatibility/support/cck/helpers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ def parse_ndjson_file(path)
end

def parse_ndjson(ndjson)
Cucumber::Messages::NdjsonToMessageEnumerator.new(ndjson)
Cucumber::Messages::Helpers::NdjsonToMessageEnumerator.new(ndjson)
end
end
end
4 changes: 2 additions & 2 deletions compatibility/support/cck/messages_comparator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ def not_message?(detected)
!detected.is_a?(Cucumber::Messages::Message)
end

# These messages we need to ignore because they are too large or they feature timestamps which always vary
# These messages need to be ignored because they are too large, or they feature timestamps which will be different
def ignorable?(detected)
too_large_message?(detected) || time_message?(detected)
end
Expand All @@ -73,7 +73,7 @@ def time_message?(detected)
detected.is_a?(Cucumber::Messages::Timestamp) || detected.is_a?(Cucumber::Messages::Duration)
end

# These messages we need to ignore because they are often not of identical shape/value
# These messages need to be ignored because they are often not of identical shape
def incomparable?(detected)
detected.is_a?(Cucumber::Messages::Ci) || detected.is_a?(Cucumber::Messages::Git)
end
Expand Down
20 changes: 9 additions & 11 deletions cucumber.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -26,27 +26,25 @@ Gem::Specification.new do |s|
s.add_dependency 'base64', '~> 0.2'
s.add_dependency 'builder', '~> 3.2'
s.add_dependency 'cucumber-ci-environment', '> 9', '< 11'
s.add_dependency 'cucumber-core', '> 13', '< 14'
s.add_dependency 'cucumber-core', '~> 15.0'
s.add_dependency 'cucumber-cucumber-expressions', '~> 17.0'
s.add_dependency 'cucumber-gherkin', '> 24', '< 28'
s.add_dependency 'cucumber-html-formatter', '> 20.3', '< 22'
s.add_dependency 'cucumber-messages', '> 19', '< 26'
s.add_dependency 'diff-lcs', '~> 1.5'
s.add_dependency 'logger', '~> 1.6'
s.add_dependency 'mini_mime', '~> 1.1'
s.add_dependency 'multi_test', '~> 1.1'
s.add_dependency 'sys-uname', '~> 1.2'
s.add_dependency 'sys-uname', '~> 1.3'

s.add_development_dependency 'cucumber-compatibility-kit', '~> 16.0'
s.add_development_dependency 'cucumber-compatibility-kit', '~> 16.2'
# Only needed whilst we are testing the formatters. Can be removed once we remove tests for those
s.add_development_dependency 'nokogiri', '~> 1.14'
s.add_development_dependency 'rake', '~> 13.1'
s.add_development_dependency 'rspec', '~> 3.12'
s.add_development_dependency 'rubocop', '~> 1.61.0'
s.add_development_dependency 'rubocop-capybara', '~> 2.19.0'
s.add_development_dependency 'nokogiri', '~> 1.15'
s.add_development_dependency 'rake', '~> 13.2'
s.add_development_dependency 'rspec', '~> 3.13'
s.add_development_dependency 'rubocop', '~> 1.69.2'
s.add_development_dependency 'rubocop-capybara', '~> 2.21.0'
s.add_development_dependency 'rubocop-packaging', '~> 0.5.2'
s.add_development_dependency 'rubocop-rake', '~> 0.6.0'
s.add_development_dependency 'rubocop-rspec', '~> 2.25.0'
s.add_development_dependency 'rubocop-rspec', '~> 3.3.0'
s.add_development_dependency 'simplecov', '~> 0.22.0'
s.add_development_dependency 'webrick', '~> 1.8'

Expand Down
12 changes: 11 additions & 1 deletion lib/cucumber.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@

module Cucumber
class << self
attr_accessor :wants_to_quit, :use_legacy_autoloader
attr_accessor :wants_to_quit
attr_reader :use_legacy_autoloader

def logger
return @log if @log
Expand All @@ -23,5 +24,14 @@ def logger
def logger=(logger)
@log = logger
end

def use_legacy_autoloader=(value)
Cucumber.deprecate(
'This will be phased out of cucumber and should not be used. It is only there to support legacy systems',
'.use_legacy_autoloader',
'11.0.0'
)
@use_legacy_autoloader = value
end
end
end
Loading

0 comments on commit 89b8990

Please sign in to comment.