diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index 5dca5472..bf04bb7a 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -1,6 +1,6 @@ # This configuration was generated by # `rubocop --auto-gen-config` -# on 2026-07-13 08:18:00 UTC using RuboCop version 1.88.2. +# on 2026-08-30 17:09:30 UTC using RuboCop version 1.89.0. # 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 @@ -12,25 +12,7 @@ # TODO: [LH] v16.2 (Generic refactors / new events) -> 79 files inspected, 222 offenses detected, 10 offenses autocorrectable # TODO: [LH] v17 prep -> 92 files inspected, 212 offenses detected, 10 offenses autocorrectable # TODO: [LH] v18 prep -> 111 files inspected, 227 offenses detected, 16 offenses autocorrectable - -# Offense count: 1 -# This cop supports safe autocorrection (--autocorrect). -# Configuration parameters: AllowForAlignment, AllowBeforeTrailingComments, ForceEqualSignAlignment. -Layout/ExtraSpacing: - Exclude: - - 'spec/cucumber/core/test/result/summary_spec.rb' - -# Offense count: 1 -# This cop supports safe autocorrection (--autocorrect). -Layout/LeadingEmptyLines: - Exclude: - - 'spec/cucumber/core/test/result/skipped_spec.rb' - -# Offense count: 1 -# This cop supports safe autocorrection (--autocorrect). -Layout/SpaceAroundMethodCallOperator: - Exclude: - - 'spec/cucumber/core/test/result/summary_spec.rb' +# TODO: [BjR] v19 prep -> 109 files inspected, 211 offenses detected, 13 offenses autocorrectable # Offense count: 1 # This cop supports safe autocorrection (--autocorrect). @@ -46,22 +28,23 @@ Metrics/AbcSize: # Offense count: 1 # Configuration parameters: CountComments, CountAsOne. Metrics/ClassLength: - Max: 111 + Max: 115 # Offense count: 3 # Configuration parameters: CountComments, CountAsOne, AllowedMethods, AllowedPatterns. Metrics/MethodLength: Max: 28 -# Offense count: 3 +# Offense count: 1 # Configuration parameters: CountComments, CountAsOne. Metrics/ModuleLength: - Max: 110 + Max: 103 -# Offense count: 1 -# Configuration parameters: CountKeywordArgs, MaxOptionalParameters. +# Offense count: 2 +# Configuration parameters: CountKeywordArgs. Metrics/ParameterLists: Max: 8 + MaxOptionalParameters: 4 # Offense count: 5 # This cop supports unsafe autocorrection (--autocorrect-all). @@ -70,7 +53,7 @@ RSpec/EmptyExampleGroup: - 'spec/cucumber/core/compiler_spec.rb' - 'spec/cucumber/core/gherkin/writer_spec.rb' -# Offense count: 21 +# Offense count: 22 # Configuration parameters: CountAsOne. RSpec/ExampleLength: Max: 11 @@ -87,7 +70,7 @@ RSpec/LeadingSubject: Exclude: - 'spec/cucumber/core/test/result/raisable_spec.rb' -# Offense count: 23 +# Offense count: 22 RSpec/MissingExampleGroupArgument: Exclude: - 'spec/cucumber/core/compiler_spec.rb' @@ -98,21 +81,21 @@ RSpec/MissingExampleGroupArgument: - 'spec/cucumber/core/test/locations_filter_spec.rb' - 'spec/cucumber/core_spec.rb' -# Offense count: 64 +# Offense count: 62 RSpec/MultipleExpectations: Max: 5 -# Offense count: 59 +# Offense count: 53 # Configuration parameters: AllowSubject. RSpec/MultipleMemoizedHelpers: - Max: 11 + Max: 10 -# Offense count: 13 +# Offense count: 8 # Configuration parameters: AllowedGroups. RSpec/NestedGroups: Max: 5 -# Offense count: 22 +# Offense count: 20 # Configuration parameters: AllowedPatterns. # AllowedPatterns: ^expect_, ^assert_ RSpec/NoExpectationExample: @@ -131,11 +114,6 @@ RSpec/RedundantPredicateMatcher: Exclude: - 'spec/cucumber/core/test/location_spec.rb' -# Offense count: 2 -RSpec/RepeatedExample: - Exclude: - - 'spec/cucumber/core/gherkin/parser_spec.rb' - # Offense count: 1 # This cop supports unsafe autocorrection (--autocorrect-all). # Configuration parameters: EnforcedStyle, AllowModifiersOnSymbols, AllowModifiersOnAttrs, AllowModifiersOnAliasMethod. diff --git a/lib/cucumber/core/test/runner.rb b/lib/cucumber/core/test/runner.rb index 85f2f86e..8f6e2c56 100644 --- a/lib/cucumber/core/test/runner.rb +++ b/lib/cucumber/core/test/runner.rb @@ -14,12 +14,14 @@ class Runner attr_reader :event_bus, :running_test_case, :running_test_step, :id_generator private :event_bus, :running_test_case, :running_test_step, :id_generator - def initialize(event_bus, id_generator = Cucumber::Messages::Helpers::IdGenerator::UUID.new, backtrace_filter = nil, max_attempts = 1) + def initialize(event_bus, id_generator = Cucumber::Messages::Helpers::IdGenerator::UUID.new, backtrace_filter = nil, max_attempts = 1, max_total_retried_tests = Float::INFINITY) @event_bus = event_bus @id_generator = id_generator @backtrace_filter = backtrace_filter @max_attempts = max_attempts + @max_total_retried_tests = max_total_retried_tests @current_test_case = nil + @total_permanently_failed = 0 end def test_case(test_case, &descend) @@ -83,11 +85,13 @@ def to_test_case_started_envelope(test_case) end def to_test_case_finished_envelope(result) + will_be_retried = result.failed? && (@attempt < @max_attempts) && (@total_permanently_failed < @max_total_retried_tests) + @total_permanently_failed += 1 if result.failed? && !will_be_retried Cucumber::Messages::Envelope.new( test_case_finished: Cucumber::Messages::TestCaseFinished.new( test_case_started_id: @current_test_case_started_id, timestamp: time_to_timestamp(Time.now), - will_be_retried: result.failed? && (@attempt < @max_attempts) + will_be_retried: will_be_retried ) ) end