Skip to content

Commit

Permalink
Refactor/v12 updates (#253)
Browse files Browse the repository at this point in the history
* Update minimum version of required gems

* Update workflow to test up to ruby 3.2

* Fix dev deps

* Set default ruby version (Lowest permitted), to 2.5

* Re-generated the TODO file

* Add in rubocop sub-gems and cap rubocop at 1.40

* Use a v2 cap for rubocop rspec and re-generate config

* Remove all redundant rubocop 0.89 config and mark 3 cops to be enabled

* Remove all redundant rubocop 0.86/0.87 config

* Remove rubocop 0.83-0.85 config

* Remove all remaining redundant rubocop config

* Remove excess crud from config file

* Update changelog

* Add minimum ruby note

* Move TODO's to extra configured cops

* Removed 3 cop overrides that are no longer relevant

* Removed final batch of redundant cops!

* Removed all other metric based defunct cops that should be fixed

* Changelog tweaks

* Use exact rubocop version settings to ensure compatibility

* Re-generate todo file one last time to account for any version mismatches
  • Loading branch information
luke-hill committed Sep 6, 2023
1 parent 98a9534 commit f923667
Show file tree
Hide file tree
Showing 7 changed files with 376 additions and 323 deletions.
10 changes: 2 additions & 8 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,28 +18,22 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-latest]
ruby: ['2.6', '2.7', '3.0', '3.1']

ruby: ['2.5', '2.6', '2.7', '3.0', '3.1', '3.2']
include:
- os: ubuntu-latest
ruby: jruby

- os: macos-latest
ruby: '3.0'

- os: windows-latest
ruby: '3.0'

runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4

- name: Set up Ruby
uses: ruby/setup-ruby@v1
- uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
bundler-cache: true

- name: Run tests
run: bundle exec rake
shell: bash
179 changes: 3 additions & 176 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,13 @@ inherit_from: .rubocop_todo.yml

require:
- rubocop-packaging
- rubocop-rake
- rubocop-rspec

AllCops:
# Keep this inline with the lowest ruby-* version in circleci/config.yml and
# the version in the gemspec
# Keep this inline with the gemspec
TargetRubyVersion: 2.5
# Cop names are not displayed in offense messages by default. Change behavior
# by overriding DisplayCopNames, or by giving the `-D/--display-cop-names`
# option.
DisplayCopNames: true
# Style guide URLs are not displayed in offense messages by default. Change
# behavior by overriding `DisplayStyleGuide`, or by giving the
# `-S/--display-style-guide` option.
DisplayStyleGuide: true
NewCops: enable

Expand All @@ -34,187 +29,19 @@ Layout/EndOfLine:
Lint/AmbiguousOperator:
Enabled: false

Metrics/AbcSize:
Max: 45

Metrics/BlockLength:
CountComments: false
Exclude:
- 'cucumber-core.gemspec'
- 'spec/**/*'

Metrics/ClassLength:
Max: 375

Metrics/CyclomaticComplexity:
Max: 9

# 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

Metrics/ModuleLength:
Max: 150
Exclude:
- 'spec/**/*'

Metrics/MethodLength:
Max: 30

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

Naming/MethodName:
EnforcedStyle: snake_case
Enabled: true

# 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

Style/ClassAndModuleChildren:
Enabled: false

Style/Documentation:
Enabled: false

Style/FormatStringToken:
EnforcedStyle: annotated

Style/FloatDivision:
Enabled: false

Style/StderrPuts:
Enabled: false

# Slashes are by far the most used form of regex values in the project.
Style/RegexpLiteral:
EnforcedStyle: slashes

# on rubocop upgrades, new cops are in a pending state so that CI won't break.
# A warning is emitted until new cops are explicitly enabled or disabled.
# See https://docs.rubocop.org/rubocop/versioning.html#pending-cops for details.

### rubocop 0.80 additions

Style/HashEachMethods:
Enabled: true

# requires ruby 2.5
Style/HashTransformKeys:
Enabled: false

# requires ruby 2.5
Style/HashTransformValues:
Enabled: false

### rubocop 0.81 additions

Lint/RaiseException:
Enabled: true

Lint/StructNewOverride:
Enabled: true

### rubocop 0.82 additions

Layout/SpaceAroundMethodCallOperator:
Enabled: true

Style/ExponentialNotation:
Enabled: false

### rubocop 0.83 additions

Layout/EmptyLinesAroundAttributeAccessor:
Enabled: true

Style/SlicingWithRange:
Enabled: true

### rubocop 0.84 additions

Lint/DeprecatedOpenSSLConstant:
Enabled: true

### rubocop 0.85 additions

Lint/MixedRegexpCaptureTypes:
Enabled: true

Style/RedundantFetchBlock:
Enabled: true

Style/RedundantRegexpCharacterClass:
Enabled: true

Style/RedundantRegexpEscape:
Enabled: true

### rubocop 0.87 additions

Style/BisectedAttrAccessor:
Enabled: true

Style/RedundantAssignment:
Enabled: true

### rubocop 0.88 additions

Lint/DuplicateElsifCondition:
Enabled: true

Style/ArrayCoercion:
Enabled: true

Style/CaseLikeIf:
Enabled: true

Style/RedundantFileExtensionInRequire:
Enabled: true

### rubocop 0.89 additions

Lint/BinaryOperatorWithIdenticalOperands:
Enabled: false

Lint/DuplicateRescueException:
Enabled: true

Lint/EmptyConditionalBody:
Enabled: true

Lint/FloatComparison:
Enabled: true

Lint/MissingSuper:
Enabled: true

Lint/OutOfRangeRegexpRef:
Enabled: true

Lint/SelfAssignment:
Enabled: true

Lint/TopLevelReturnWithArgument:
Enabled: true

Lint/UnreachableLoop:
Enabled: true

Style/StringConcatenation:
Enabled: true

Lint/EmptyBlock:
Enabled: false

Lint/ConstantDefinitionInBlock:
Exclude:
- 'spec/**/*.rb'

Style/SoleNestedConditional:
Enabled: false
Loading

0 comments on commit f923667

Please sign in to comment.