Skip to content
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

V10: Initial rework #1759

Merged
merged 37 commits into from
Jan 6, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
faa6aee
Remove calls to require deprecator that isn't needed
luke-hill Jul 10, 2024
b3aeca5
External programs that wanted to track available and invoked step def…
luke-hill Jul 10, 2024
9ee180f
Fix ordering of class methods in registry and more file
luke-hill Jul 10, 2024
69d9d92
Mark step definition light as ready for deletion
luke-hill Jul 10, 2024
c6cec3a
Curl Option parser is now package private
luke-hill Jul 10, 2024
782c92e
Remove webrick alias that is no longer needed
luke-hill Jul 10, 2024
53c4b2a
Remove tag expression sanitization completely. Proper tag expression …
luke-hill Jul 10, 2024
106487b
Remove a TODO from the generic rubocop config
luke-hill Jul 10, 2024
7f4ec3e
Deprecate use_legacy_autoloader
luke-hill Jul 10, 2024
ad28593
Convert 2 snippets to use heredocs
luke-hill Jul 10, 2024
2f9f501
Fix up snippet generation specs to use the #comment method instead of…
luke-hill Jul 10, 2024
f49eb0d
Remove #append_comment_to
luke-hill Jul 10, 2024
75150d9
Deprecate text? boolean checker in multiline arguments
luke-hill Jul 10, 2024
2815092
Fix deprecator requirement
luke-hill Jul 18, 2024
efa0620
Remove scriipts dir
luke-hill Jul 18, 2024
71f7e26
Update cucumber dependencies
luke-hill Jul 18, 2024
dc1e3f5
Minor rubocop tidy
luke-hill Jul 18, 2024
bd5d4e2
Update changelog
luke-hill Aug 8, 2024
982eddb
Update all dev dependencies aside from rubocop/rubocop-rspec
luke-hill Aug 8, 2024
a365ddb
Bump of runtime dependencies to permit latest
luke-hill Aug 8, 2024
73990c7
Fix ref to unskippable action from core update
luke-hill Aug 12, 2024
855b49d
Fix up references to defined action from core
luke-hill Aug 12, 2024
f4a655d
Permit latest gherkin this end
luke-hill Aug 12, 2024
b732f9b
Permit the next 2 majors for messages - 1 for codegen/dotnet and the …
luke-hill Aug 15, 2024
4ddc410
Bump CCK to latest version - issues to arise
luke-hill Aug 15, 2024
33fd1cb
Merge branch 'main' into refactor/v10_redundant_code
luke-hill Aug 23, 2024
c2b3306
Regenerate the TODO file
luke-hill Aug 23, 2024
0754a59
Merge branch 'main' into refactor/v10_redundant_code
luke-hill Sep 10, 2024
0f600e7
Add v10 upgrading doc
luke-hill Jan 6, 2025
a4921f1
Upgrade cucumber core to latest and remove the dependency on messages…
luke-hill Jan 6, 2025
953add8
Update upgrading docs to reflect change to core being controlling of …
luke-hill Jan 6, 2025
7195a05
Update all rubocop gems to latest version to remove bugs and re-gener…
luke-hill Jan 6, 2025
3dda843
Remove unrequired hook deprecation
luke-hill Jan 6, 2025
1e0e347
Fix up latent references to old time conversion and id generator classes
luke-hill Jan 6, 2025
b9a20fa
Fix CCK test helper from finding incorrect path for ndjson serializer…
luke-hill Jan 6, 2025
1649a8a
The CCK expects a folder structure for each CCK feature - so we can a…
luke-hill Jan 6, 2025
9e0393b
Improve CCK comments about ignorability of tests
luke-hill Jan 6, 2025
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
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 @@ -12,12 +12,24 @@ Please visit [cucumber/CONTRIBUTING.md](https://github.com/cucumber/cucumber/blo
### Changed
- 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 @@ -24,26 +24,24 @@ Gem::Specification.new do |s|

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 '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
2 changes: 1 addition & 1 deletion lib/cucumber/configuration.rb
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ def event_bus
end

def id_generator
@id_generator ||= Cucumber::Messages::IdGenerator::UUID.new
@id_generator ||= Cucumber::Messages::Helpers::IdGenerator::UUID.new
end

private
Expand Down
Loading
Loading