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

Rubocop bump #1741

Merged
merged 9 commits into from
Oct 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
32 changes: 1 addition & 31 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,14 +52,6 @@ Metrics/AbcSize:
- spec/cucumber/formatter/http_io_spec.rb
- lib/cucumber/glue/proto_world.rb

# 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
Expand All @@ -73,7 +65,6 @@ Metrics/ModuleLength:
Max: 135
Exclude:
- './spec/**/*'
- 'cck/spec/**/*'
# TODO: Manually added! - be careful with regenning the file - this needs a fix
- lib/cucumber/formatter/console.rb

Expand All @@ -88,8 +79,7 @@ Metrics/MethodLength:
- spec/cucumber/formatter/http_io_spec.rb
- lib/cucumber/glue/proto_world.rb

# Rubocop doesn't like method names in other languages but as Cucumber supports
# languages, this cop needs to be disabled.
# Rubocop doesn't like method names in other languages but as Cucumber supports multiple languages, this cop needs to be disabled.
Naming/AsciiIdentifiers:
Enabled: false

Expand All @@ -99,28 +89,8 @@ Naming/MethodName:
Exclude:
- 'examples/i18n/ar/lib/calculator.rb'
- 'examples/i18n/he/lib/calculator.rb'
- 'examples/i18n/he/lib/calculator.rb'
- 'examples/i18n/tr/lib/hesap_makinesi.rb'
- 'lib/cucumber/glue/dsl.rb'

# In most cases, being descriptive with parameter names helps a reader understand
# what the variable is for. In some cases, shorter names are sufficient.
Naming/MethodParameterName:
AllowedNames: _, e, n, v, id, io, gh, pr

# Reviewed: these offenses look false as the variables are in cyrillic
Naming/VariableName:
Exclude:
- 'examples/i18n/ru/features/step_definitions/calculator_steps.rb'
- 'examples/i18n/uk/features/step_definitions/calculator_steps.rb'
- 'examples/i18n/uz/features/step_definitions/calculator_steps.rb'

# Rubocop doesn't handle some international words well for this cop
Naming/VariableNumber:
EnforcedStyle: normalcase
Exclude:
- 'examples/i18n/**/*'

RSpec/ExampleLength:
CountAsOne: ['array', 'hash', 'heredoc']

Expand Down
40 changes: 23 additions & 17 deletions .rubocop_todo.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# This configuration was generated by
# `rubocop --auto-gen-config`
# on 2023-10-02 12:57:00 UTC using RuboCop version 1.56.3.
# on 2023-10-02 14:25:13 UTC using RuboCop version 1.56.4.
# 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
Expand Down Expand Up @@ -88,21 +88,11 @@ Lint/RescueException:
Exclude:
- 'lib/cucumber/glue/proto_world.rb'

# Offense count: 1
# Configuration parameters: AllowedMethods, AllowedPatterns, CountRepeatedAttributes.
Metrics/AbcSize:
Max: 50

# Offense count: 8
# Configuration parameters: AllowedMethods, AllowedPatterns.
Metrics/CyclomaticComplexity:
Max: 12

# Offense count: 1
# Configuration parameters: CountComments, CountAsOne, AllowedMethods, AllowedPatterns.
Metrics/MethodLength:
Max: 57

# Offense count: 7
# Configuration parameters: AllowedMethods, AllowedPatterns.
Metrics/PerceivedComplexity:
Expand All @@ -116,6 +106,28 @@ Naming/FileName:
Exclude:
- 'features/lib/step_definitions/iso-8859-1_steps.rb'

# Offense count: 14
# Configuration parameters: MinNameLength, AllowNamesEndingInNumbers, AllowedNames, ForbiddenNames.
# AllowedNames: as, at, by, cc, db, id, if, in, io, ip, of, on, os, pp, to
Naming/MethodParameterName:
Exclude:
- 'lib/cucumber/cli/options.rb'
- 'lib/cucumber/formatter/ansicolor.rb'
- 'lib/cucumber/formatter/console.rb'
- 'lib/cucumber/gherkin/formatter/ansi_escapes.rb'
- 'lib/cucumber/multiline_argument/data_table.rb'

# Offense count: 8
# Configuration parameters: EnforcedStyle, CheckMethodNames, CheckSymbols, AllowedIdentifiers, AllowedPatterns.
# SupportedStyles: snake_case, normalcase, non_integer
# AllowedIdentifiers: capture3, iso8601, rfc1123_date, rfc822, rfc2822, rfc3339, x86_64
Naming/VariableNumber:
Exclude:
- 'examples/i18n/bg/lib/calculator.rb'
- 'examples/i18n/ru/lib/calculator.rb'
- 'examples/i18n/uk/lib/calculator.rb'
- 'examples/i18n/uz/lib/calculator.rb'

# Offense count: 2
RSpec/AnyInstance:
Exclude:
Expand Down Expand Up @@ -146,11 +158,6 @@ RSpec/ContextWording:
# Configuration parameters: IgnoredMetadata.
RSpec/DescribeClass:
Exclude:
- '**/spec/features/**/*'
- '**/spec/requests/**/*'
- '**/spec/routing/**/*'
- '**/spec/system/**/*'
- '**/spec/views/**/*'
- 'spec/cck/cck_spec.rb'

# Offense count: 8
Expand Down Expand Up @@ -195,7 +202,6 @@ RSpec/ExampleWording:
# This cop supports safe autocorrection (--autocorrect).
RSpec/ExpectActual:
Exclude:
- '**/spec/routing/**/*'
- 'spec/cucumber/cli/configuration_spec.rb'
- 'spec/cucumber/step_match_spec.rb'

Expand Down
4 changes: 2 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ Please visit [cucumber/CONTRIBUTING.md](https://github.com/cucumber/cucumber/blo

## [Unreleased]
### Changed
- First couple of passes of tidying up approximately 30% of the manual fix cops
([#1739](https://github.com/cucumber/cucumber-ruby/pull/1739) [#1740](https://github.com/cucumber/cucumber-ruby/pull/1740) [luke-hill](https://github.com/luke-hill))
- First couple of passes of tidying up approximately 40% of the manual fix cops
([#1739](https://github.com/cucumber/cucumber-ruby/pull/1739) [#1740](https://github.com/cucumber/cucumber-ruby/pull/1740) [#1741](https://github.com/cucumber/cucumber-ruby/pull/1741) [luke-hill](https://github.com/luke-hill))
- Removed a bunch of example files / sample projects from ancient projects no longer viable
[#1740](https://github.com/cucumber/cucumber-ruby/pull/1740) [luke-hill](https://github.com/luke-hill))

Expand Down
12 changes: 6 additions & 6 deletions cucumber.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,12 @@ Gem::Specification.new do |s|
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.12', '>= 3.12.0'
s.add_development_dependency 'rubocop', '~> 1.56', '>= 1.56.2'
s.add_development_dependency 'rubocop-capybara', '~> 2.18', '>= 2.18.0'
s.add_development_dependency 'rubocop-packaging', '~> 0.5', '>= 0.5.2'
s.add_development_dependency 'rubocop-rake', '~> 0.6', '>= 0.6.0'
s.add_development_dependency 'rubocop-rspec', '~> 2.23', '>= 2.23.2'
s.add_development_dependency 'simplecov', '~> 0.22', '>= 0.22.0'
s.add_development_dependency 'rubocop', '~> 1.56.4'
s.add_development_dependency 'rubocop-capybara', '~> 2.19.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.24.1'
s.add_development_dependency 'simplecov', '~> 0.22.0'
s.add_development_dependency 'syntax', '~> 1.2', '>= 1.2.2'
s.add_development_dependency 'test-unit', '~> 3.6', '>= 3.6.1'
s.add_development_dependency 'webrick', '~> 1.8', '>= 1.8.1'
Expand Down
11 changes: 7 additions & 4 deletions examples/i18n/ar/lib/calculator.rb
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
# frozen_string_literal: true

class Calculator
def push(n)
@args ||= []
@args << n
def initialize
@stack = []
end

def push(arg)
@stack.push(arg)
end

def جمع
@args.inject(0) { |n, sum| sum + n }
@stack.inject(0) { |n, sum| sum + n }
end
end
2 changes: 1 addition & 1 deletion examples/i18n/bg/lib/calculator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ def initialize
end

def push(arg)
@stack.push arg
@stack.push(arg)
end

def result
Expand Down
13 changes: 8 additions & 5 deletions examples/i18n/ca/lib/calculadora.rb
Original file line number Diff line number Diff line change
@@ -1,16 +1,19 @@
# frozen_string_literal: true

class Calculadora
def push(n)
@args ||= []
@args << n
def initialize
@stack = []
end

def push(arg)
@stack.push(arg)
end

def add
@args.inject(0) { |n, sum| sum + n }
@stack.inject(0) { |n, sum| sum + n }
end

def divide
@args[0].to_f / @args[1]
@stack[0].to_f / @stack[1]
end
end
13 changes: 8 additions & 5 deletions examples/i18n/cs/lib/calculator.rb
Original file line number Diff line number Diff line change
@@ -1,16 +1,19 @@
# frozen_string_literal: true

class Calculator
def push(n)
@args ||= []
@args << n
def initialize
@stack = []
end

def push(arg)
@stack.push(arg)
end

def add
@args.inject(0) { |n, sum| sum + n }
@stack.inject(0) { |n, sum| sum + n }
end

def divide
@args[0].to_f / @args[1]
@stack[0].to_f / @stack[1]
end
end
11 changes: 7 additions & 4 deletions examples/i18n/da/lib/lommeregner.rb
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
# frozen_string_literal: true

class Lommeregner
def push(n)
@args ||= []
@args << n
def initialize
@stack = []
end

def push(arg)
@stack.push(arg)
end

def add
@args.inject(0) { |n, sum| sum + n }
@stack.inject(0) { |n, sum| sum + n }
end
end
13 changes: 8 additions & 5 deletions examples/i18n/de/lib/calculator.rb
Original file line number Diff line number Diff line change
@@ -1,16 +1,19 @@
# frozen_string_literal: true

class Calculator
def push(n)
@args ||= []
@args << n
def initialize
@stack = []
end

def push(arg)
@stack.push(arg)
end

def add
@args.inject(0) { |n, sum| sum + n }
@stack.inject(0) { |n, sum| sum + n }
end

def divide
@args[0].to_f / @args[1]
@stack[0].to_f / @stack[1]
end
end
13 changes: 8 additions & 5 deletions examples/i18n/el/lib/calculator.rb
Original file line number Diff line number Diff line change
@@ -1,16 +1,19 @@
# frozen_string_literal: true

class Calculator
def push(n)
@args ||= []
@args << n
def initialize
@stack = []
end

def push(arg)
@stack.push(arg)
end

def add
@args.inject(0) { |n, sum| sum + n }
@stack.inject(0) { |n, sum| sum + n }
end

def divide
@args[0].to_f / @args[1]
@stack[0].to_f / @stack[1]
end
end
13 changes: 8 additions & 5 deletions examples/i18n/en/lib/calculator.rb
Original file line number Diff line number Diff line change
@@ -1,16 +1,19 @@
# frozen_string_literal: true

class Calculator
def push(n)
@args ||= []
@args << n
def initialize
@stack = []
end

def push(arg)
@stack.push(arg)
end

def add
@args.inject(0) { |n, sum| sum + n }
@stack.inject(0) { |n, sum| sum + n }
end

def divide
@args[0].to_f / @args[1]
@stack[0].to_f / @stack[1]
end
end
13 changes: 8 additions & 5 deletions examples/i18n/eo/lib/calculator.rb
Original file line number Diff line number Diff line change
@@ -1,16 +1,19 @@
# frozen_string_literal: true

class Calculator
def push(n)
@args ||= []
@args << n
def initialize
@stack = []
end

def push(arg)
@stack.push(arg)
end

def add
@args.inject(0) { |n, sum| sum + n }
@stack.inject(0) { |n, sum| sum + n }
end

def divide
@args[0].to_f / @args[1]
@stack[0].to_f / @stack[1]
end
end
13 changes: 8 additions & 5 deletions examples/i18n/es/lib/calculador.rb
Original file line number Diff line number Diff line change
@@ -1,16 +1,19 @@
# frozen_string_literal: true

class Calculador
def push(n)
@args ||= []
@args << n
def initialize
@stack = []
end

def push(arg)
@stack.push(arg)
end

def add
@args.inject(0) { |n, sum| sum + n }
@stack.inject(0) { |n, sum| sum + n }
end

def divide
@args[0].to_f / @args[1]
@stack[0].to_f / @stack[1]
end
end
Loading