Skip to content

Commit 89b8990

Browse files
authored
V10: Initial rework (#1759)
* 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
1 parent 5cec922 commit 89b8990

32 files changed

+373
-265
lines changed

.rubocop.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ AllCops:
2323
- vendor/**/*
2424
- temp_app/**/*
2525

26-
# 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
26+
# 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
2727
Layout/LineLength:
2828
Max: 200
2929

.rubocop_todo.yml

Lines changed: 112 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,27 @@
11
# This configuration was generated by
22
# `rubocop --auto-gen-config`
3-
# on 2024-07-09 14:33:36 UTC using RuboCop version 1.61.0.
3+
# on 2025-01-06 16:14:48 UTC using RuboCop version 1.69.2.
44
# The point is for the user to remove these configuration records
55
# one by one as the offenses are removed from the code base.
66
# Note that changes in the inspected code, or installation of new
77
# versions of RuboCop, may require this file to be generated again.
88

9-
# TODO - [LH] -> Oct '23 - 355 files inspected, 642 offenses detected, 205 offenses autocorrectable
10-
# TODO - [LH] -> Dec '23 - 350 files inspected, 595 offenses detected, 171 offenses autocorrectable
119
# TODO - [LH] -> Feb '24 - 370 files inspected, 635 offenses detected, 166 offenses autocorrectable
1210
# TODO - [LH] -> Jul '24 - 370 files inspected, 637 offenses detected, 97 offenses autocorrectable
11+
# TODO - [LH] -> Jul '24 - 369 files inspected, 661 offenses detected, 98 offenses autocorrectable
12+
# TODO - [LH] -> Jan '25 (Updated deps and v10 prep) - 369 files inspected, 704 offenses detected, 112 offenses autocorrectable
13+
14+
# Offense count: 1
15+
# This cop supports safe autocorrection (--autocorrect).
16+
# Configuration parameters: EmptyLineBetweenMethodDefs, EmptyLineBetweenClassDefs, EmptyLineBetweenModuleDefs, DefLikeMacros, AllowAdjacentOneLineDefs, NumberOfEmptyLines.
17+
Layout/EmptyLineBetweenDefs:
18+
Exclude:
19+
- 'lib/cucumber/glue/snippet.rb'
20+
21+
# Offense count: 2
22+
Lint/IneffectiveAccessModifier:
23+
Exclude:
24+
- 'lib/cucumber/formatter/curl_option_parser.rb'
1325

1426
# Offense count: 4
1527
Lint/RescueException:
@@ -19,6 +31,13 @@ Lint/RescueException:
1931
- 'lib/cucumber/glue/invoke_in_world.rb'
2032
- 'lib/cucumber/glue/proto_world.rb'
2133

34+
# Offense count: 1
35+
# This cop supports safe autocorrection (--autocorrect).
36+
# Configuration parameters: AutoCorrect, ContextCreatingMethods, MethodCreatingMethods.
37+
Lint/UselessAccessModifier:
38+
Exclude:
39+
- 'lib/cucumber/formatter/curl_option_parser.rb'
40+
2241
# Offense count: 2
2342
# This cop supports unsafe autocorrection (--autocorrect-all).
2443
# Configuration parameters: AutoCorrect.
@@ -83,14 +102,30 @@ RSpec/AnyInstance:
83102
Exclude:
84103
- 'spec/cucumber/cli/main_spec.rb'
85104

86-
# Offense count: 9
105+
# Offense count: 4
106+
# This cop supports unsafe autocorrection (--autocorrect-all).
107+
RSpec/BeEq:
108+
Exclude:
109+
- 'spec/cucumber/cli/rerun_spec.rb'
110+
- 'spec/cucumber/multiline_argument/data_table_spec.rb'
111+
112+
# Offense count: 1
87113
# This cop supports safe autocorrection (--autocorrect).
88-
# Configuration parameters: EnabledMethods.
89-
RSpec/Capybara/FeatureMethods:
114+
# Configuration parameters: EnforcedStyle.
115+
# SupportedStyles: be, be_nil
116+
RSpec/BeNil:
90117
Exclude:
91-
- 'spec/cucumber/filters/activate_steps_spec.rb'
118+
- 'spec/cucumber/cli/options_spec.rb'
92119

93-
# Offense count: 5
120+
# Offense count: 1
121+
# This cop supports safe autocorrection (--autocorrect).
122+
# Configuration parameters: EnforcedStyle.
123+
# SupportedStyles: be_a, be_kind_of
124+
RSpec/ClassCheck:
125+
Exclude:
126+
- 'spec/cucumber/glue/proto_world_spec.rb'
127+
128+
# Offense count: 6
94129
# Configuration parameters: Prefixes, AllowedPatterns.
95130
# Prefixes: when, with, without
96131
RSpec/ContextWording:
@@ -99,10 +134,12 @@ RSpec/ContextWording:
99134
- 'spec/cucumber/formatter/http_io_spec.rb'
100135
- 'spec/cucumber/formatter/junit_spec.rb'
101136
- 'spec/cucumber/formatter/publish_banner_printer_spec.rb'
137+
- 'spec/cucumber/formatter/query/hook_by_test_step_spec.rb'
102138
- 'spec/support/shared_context/http_server.rb'
103139

104140
# Offense count: 2
105141
# This cop supports unsafe autocorrection (--autocorrect-all).
142+
# Configuration parameters: AutoCorrect.
106143
RSpec/EmptyExampleGroup:
107144
Exclude:
108145
- 'spec/cucumber/filters/activate_steps_spec.rb'
@@ -121,6 +158,12 @@ RSpec/ExampleWording:
121158
Exclude:
122159
- 'spec/cucumber/multiline_argument/data_table_spec.rb'
123160

161+
# Offense count: 2
162+
# This cop supports safe autocorrection (--autocorrect).
163+
RSpec/ExcessiveDocstringSpacing:
164+
Exclude:
165+
- 'spec/cucumber/formatter/pretty_spec.rb'
166+
124167
# Offense count: 2
125168
# This cop supports safe autocorrection (--autocorrect).
126169
RSpec/ExpectActual:
@@ -146,12 +189,26 @@ RSpec/ExpectOutput:
146189
RSpec/HookArgument:
147190
Enabled: false
148191

149-
# Offense count: 8
192+
# Offense count: 5
193+
# Configuration parameters: Max, AllowedIdentifiers, AllowedPatterns.
194+
RSpec/IndexedLet:
195+
Exclude:
196+
- 'spec/cucumber/filters/retry_spec.rb'
197+
- 'spec/cucumber/glue/registry_and_more_spec.rb'
198+
199+
# Offense count: 26
150200
# Configuration parameters: AssignmentOnly.
151201
RSpec/InstanceVariable:
152202
Exclude:
203+
- 'spec/cucumber/formatter/query/hook_by_test_step_spec.rb'
153204
- 'spec/support/shared_context/http_server.rb'
154205

206+
# Offense count: 2
207+
# This cop supports safe autocorrection (--autocorrect).
208+
RSpec/MatchArray:
209+
Exclude:
210+
- 'spec/cucumber/cli/configuration_spec.rb'
211+
155212
# Offense count: 5
156213
# Configuration parameters: EnforcedStyle.
157214
# SupportedStyles: have_received, receive
@@ -161,6 +218,15 @@ RSpec/MessageSpies:
161218
- 'spec/cucumber/formatter/io_http_buffer_spec.rb'
162219
- 'spec/cucumber/runtime/hooks_examples.rb'
163220

221+
# Offense count: 2
222+
# This cop supports safe autocorrection (--autocorrect).
223+
# Configuration parameters: EnforcedStyle.
224+
# SupportedStyles: hash, symbol
225+
RSpec/MetadataStyle:
226+
Exclude:
227+
- 'compatibility/cck_spec.rb'
228+
- 'spec/cucumber/project_initializer_spec.rb'
229+
164230
# Offense count: 15
165231
RSpec/MissingExampleGroupArgument:
166232
Exclude:
@@ -197,11 +263,34 @@ RSpec/NamedSubject:
197263
- 'spec/cucumber/runtime/support_code_spec.rb'
198264
- 'spec/cucumber/runtime_spec.rb'
199265

266+
# Offense count: 2
267+
# Configuration parameters: AllowedGroups.
268+
RSpec/NestedGroups:
269+
Max: 4
270+
271+
# Offense count: 22
272+
# Configuration parameters: AllowedPatterns.
273+
# AllowedPatterns: ^expect_, ^assert_
274+
RSpec/NoExpectationExample:
275+
Exclude:
276+
- 'spec/cucumber/filters/activate_steps_spec.rb'
277+
- 'spec/cucumber/formatter/fail_fast_spec.rb'
278+
- 'spec/cucumber/formatter/rerun_spec.rb'
279+
- 'spec/cucumber/running_test_case_spec.rb'
280+
200281
# Offense count: 1
201282
RSpec/OverwritingSetup:
202283
Exclude:
203284
- 'spec/cucumber/runtime/support_code_spec.rb'
204285

286+
# Offense count: 10
287+
# This cop supports unsafe autocorrection (--autocorrect-all).
288+
RSpec/ReceiveMessages:
289+
Exclude:
290+
- 'spec/cucumber/cli/configuration_spec.rb'
291+
- 'spec/cucumber/configuration_spec.rb'
292+
- 'spec/cucumber/runtime/support_code_spec.rb'
293+
205294
# Offense count: 8
206295
RSpec/RepeatedExample:
207296
Exclude:
@@ -216,17 +305,30 @@ RSpec/RepeatedExampleGroupDescription:
216305

217306
# Offense count: 3
218307
# This cop supports safe autocorrection (--autocorrect).
308+
# Configuration parameters: AutoCorrect.
219309
RSpec/ScatteredLet:
220310
Exclude:
221311
- 'spec/cucumber/runtime/support_code_spec.rb'
222312

313+
# Offense count: 1
314+
# This cop supports safe autocorrection (--autocorrect).
315+
RSpec/SortMetadata:
316+
Exclude:
317+
- 'compatibility/cck_spec.rb'
318+
223319
# Offense count: 7
224320
RSpec/StubbedMock:
225321
Exclude:
226322
- 'spec/cucumber/cli/configuration_spec.rb'
227323
- 'spec/cucumber/formatter/interceptor_spec.rb'
228324
- 'spec/cucumber/runtime/meta_message_builder_spec.rb'
229325

326+
# Offense count: 2
327+
RSpec/SubjectDeclaration:
328+
Exclude:
329+
- 'spec/cucumber/runtime/after_hooks_spec.rb'
330+
- 'spec/cucumber/runtime/before_hooks_spec.rb'
331+
230332
# Offense count: 57
231333
# Configuration parameters: IgnoreNameless, IgnoreSymbolicNames.
232334
RSpec/VerifiedDoubles:
@@ -257,14 +359,13 @@ Style/ClassVars:
257359
Exclude:
258360
- 'spec/cucumber/glue/step_definition_spec.rb'
259361

260-
# Offense count: 2
362+
# Offense count: 1
261363
# This cop supports unsafe autocorrection (--autocorrect-all).
262364
# Configuration parameters: EnforcedStyle.
263365
# SupportedStyles: always, always_true, never
264366
Style/FrozenStringLiteralComment:
265367
Exclude:
266368
- 'spec/support/shared_context/http_server.rb'
267-
- 'spec/support/webrick_proc_handler_alias.rb'
268369

269370
# Offense count: 7
270371
# Configuration parameters: AllowedVariables.

CHANGELOG.md

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

1724
### Fixed
1825
- Fixed an issue where a change to one example in compatibility testing wasn't fully adhered to ([luke-hill](https://github.com/luke-hill))
1926
- 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))
2027

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

2436
## [9.2.0] - 2024-03-19

bin/rspec

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,22 +8,22 @@
88
# this file is here to facilitate running it.
99
#
1010

11-
require "pathname"
12-
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile.local",
11+
require 'pathname'
12+
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile.local',
1313
Pathname.new(__FILE__).realpath)
1414

15-
bundle_binstub = File.expand_path("../bundle", __FILE__)
15+
bundle_binstub = File.expand_path('../bundle', __FILE__)
1616

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

26-
require "rubygems"
27-
require "bundler/setup"
26+
require 'rubygems'
27+
require 'bundler/setup'
2828

29-
load Gem.bin_path("rspec-core", "rspec")
29+
load Gem.bin_path('rspec-core', 'rspec')
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# frozen_string_literal: true
2+
3+
# The empty CCK scenario does not contain any executable steps. It contains just one scenario
4+
# which will be "ran" and only produce a single pickle for the name of the scenario (No pickles for steps)

compatibility/support/cck/helpers.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ def parse_ndjson_file(path)
1313
end
1414

1515
def parse_ndjson(ndjson)
16-
Cucumber::Messages::NdjsonToMessageEnumerator.new(ndjson)
16+
Cucumber::Messages::Helpers::NdjsonToMessageEnumerator.new(ndjson)
1717
end
1818
end
1919
end

compatibility/support/cck/messages_comparator.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ def not_message?(detected)
6060
!detected.is_a?(Cucumber::Messages::Message)
6161
end
6262

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

76-
# These messages we need to ignore because they are often not of identical shape/value
76+
# These messages need to be ignored because they are often not of identical shape
7777
def incomparable?(detected)
7878
detected.is_a?(Cucumber::Messages::Ci) || detected.is_a?(Cucumber::Messages::Git)
7979
end

cucumber.gemspec

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -26,27 +26,25 @@ Gem::Specification.new do |s|
2626
s.add_dependency 'base64', '~> 0.2'
2727
s.add_dependency 'builder', '~> 3.2'
2828
s.add_dependency 'cucumber-ci-environment', '> 9', '< 11'
29-
s.add_dependency 'cucumber-core', '> 13', '< 14'
29+
s.add_dependency 'cucumber-core', '~> 15.0'
3030
s.add_dependency 'cucumber-cucumber-expressions', '~> 17.0'
31-
s.add_dependency 'cucumber-gherkin', '> 24', '< 28'
3231
s.add_dependency 'cucumber-html-formatter', '> 20.3', '< 22'
33-
s.add_dependency 'cucumber-messages', '> 19', '< 26'
3432
s.add_dependency 'diff-lcs', '~> 1.5'
3533
s.add_dependency 'logger', '~> 1.6'
3634
s.add_dependency 'mini_mime', '~> 1.1'
3735
s.add_dependency 'multi_test', '~> 1.1'
38-
s.add_dependency 'sys-uname', '~> 1.2'
36+
s.add_dependency 'sys-uname', '~> 1.3'
3937

40-
s.add_development_dependency 'cucumber-compatibility-kit', '~> 16.0'
38+
s.add_development_dependency 'cucumber-compatibility-kit', '~> 16.2'
4139
# Only needed whilst we are testing the formatters. Can be removed once we remove tests for those
42-
s.add_development_dependency 'nokogiri', '~> 1.14'
43-
s.add_development_dependency 'rake', '~> 13.1'
44-
s.add_development_dependency 'rspec', '~> 3.12'
45-
s.add_development_dependency 'rubocop', '~> 1.61.0'
46-
s.add_development_dependency 'rubocop-capybara', '~> 2.19.0'
40+
s.add_development_dependency 'nokogiri', '~> 1.15'
41+
s.add_development_dependency 'rake', '~> 13.2'
42+
s.add_development_dependency 'rspec', '~> 3.13'
43+
s.add_development_dependency 'rubocop', '~> 1.69.2'
44+
s.add_development_dependency 'rubocop-capybara', '~> 2.21.0'
4745
s.add_development_dependency 'rubocop-packaging', '~> 0.5.2'
4846
s.add_development_dependency 'rubocop-rake', '~> 0.6.0'
49-
s.add_development_dependency 'rubocop-rspec', '~> 2.25.0'
47+
s.add_development_dependency 'rubocop-rspec', '~> 3.3.0'
5048
s.add_development_dependency 'simplecov', '~> 0.22.0'
5149
s.add_development_dependency 'webrick', '~> 1.8'
5250

lib/cucumber.rb

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@
1010

1111
module Cucumber
1212
class << self
13-
attr_accessor :wants_to_quit, :use_legacy_autoloader
13+
attr_accessor :wants_to_quit
14+
attr_reader :use_legacy_autoloader
1415

1516
def logger
1617
return @log if @log
@@ -23,5 +24,14 @@ def logger
2324
def logger=(logger)
2425
@log = logger
2526
end
27+
28+
def use_legacy_autoloader=(value)
29+
Cucumber.deprecate(
30+
'This will be phased out of cucumber and should not be used. It is only there to support legacy systems',
31+
'.use_legacy_autoloader',
32+
'11.0.0'
33+
)
34+
@use_legacy_autoloader = value
35+
end
2636
end
2737
end

0 commit comments

Comments
 (0)