Skip to content

Commit

Permalink
Refactor/manual cleanup part2 (#1740)
Browse files Browse the repository at this point in the history
* Remove bespoke JRuby support for something we're deprecating

* Remove edge case JRuby fringe unicode test - cck handles things like this better

* Remove redundant cucumber.yml config

* Delete some ancient testing examples no longer relevant

* Begin simplifying deprecator

* Remove some initial customisation about raising deprecations

* Ensure to set all args at all times when deprecating

* Unpick flaky errors

* Remove redundant test that shows the situation being faiing in tests no longer required

* Remove redundant colour / cleanup overrides for colouring warnings

* Remove secondary module and just directly call

* Add changelog entry

* Fix Lint/SupressedException

* partial fix for cyclomatic score in JSONWorld

* Partial fix for cyclomatic score in ASTLookup

* Use cleaner begin/rescue/end

* Add changelog entry for removal of sample projects

* Fix up some readme styling

* Fix erroneous badges for readme

* Regenerate the auto-gen-config for rubocop after removing some redundant parts of original config

* Sticking-patch for the situation where rubocop doesn't like conflicting numbers

* Add in inherit mode config
  • Loading branch information
luke-hill authored Oct 2, 2023
1 parent 8e519a5 commit c10327a
Show file tree
Hide file tree
Showing 27 changed files with 110 additions and 341 deletions.
18 changes: 6 additions & 12 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
inherit_from: .rubocop_todo.yml

inherit_mode:
merge:
- Exclude

require:
- rubocop-capybara
- rubocop-packaging
Expand All @@ -20,11 +24,6 @@ AllCops:
- 'temp_app/**/*'
- 'cck/features/**/*'

# TODO: [LH] - Candidate for phasing out in v9 patch releases. People should have this stored in editor and ideally not use windows
# for ruby development. Where they are, their editor config should have this setting
Layout/EndOfLine:
EnforcedStyle: lf

# 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 All @@ -36,13 +35,6 @@ Layout/TrailingWhitespace:
- 'spec/cucumber/formatter/pretty_spec.rb'
- 'spec/cucumber/formatter/progress_spec.rb'

# TODO: [LH] - This needs re-reviewing and fixing, we have been partially fixing this up in 2019/2020 onwards
# (Likely that this is primarily already fixed)
# Reviewed: please see PR-1022 for details on why this cop is disabled:
# https://github.com/cucumber/cucumber-ruby/pull/1022
Lint/AmbiguousOperator:
Enabled: false

# TODO: [LH] - This needs a re-review. I think we can pretty much delete / phase this out with incremental updates
# We exclude proto_world for documentation (rdoc) purpose
Lint/UselessMethodDefinition:
Expand All @@ -58,6 +50,7 @@ Metrics/AbcSize:
Exclude:
- lib/cucumber/formatter/junit.rb
- 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:
Expand Down Expand Up @@ -93,6 +86,7 @@ Metrics/MethodLength:
- lib/cucumber/cli/options.rb
- lib/cucumber/formatter/publish_banner_printer.rb
- 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.
Expand Down
35 changes: 27 additions & 8 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-09-12 16:42:15 UTC using RuboCop version 1.56.3.
# on 2023-10-02 12:57:00 UTC using RuboCop version 1.56.3.
# 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 All @@ -9,6 +9,8 @@
# TODO - [LH] -> Aug '23 - 370 files inspected, 1110 offenses detected, 482 offenses autocorrectable
# TODO - [LH] -> Sep 6 '23 - 370 files inspected, 983 offenses detected, 368 offenses autocorrectable
# TODO - [LH] -> Sep 11 '23 - 370 files inspected, 825 offenses detected, 387 offenses autocorrectable
# TODO - [LH] -> Sep 19 '23 - 370 files inspected, 640 offenses detected, 202 offenses autocorrectable
# TODO - [LH] -> Oct '23 - 355 files inspected, 642 offenses detected, 205 offenses autocorrectable

# Offense count: 1
# This cop supports safe autocorrection (--autocorrect).
Expand Down Expand Up @@ -67,24 +69,41 @@ Layout/IndentationWidth:
Exclude:
- 'spec/cucumber/formatter/fail_fast_spec.rb'

# Offense count: 3
# This cop supports safe autocorrection (--autocorrect).
Lint/AmbiguousOperator:
Exclude:
- 'lib/cucumber/multiline_argument/data_table.rb'
- 'lib/cucumber/running_test_case.rb'
- 'spec/cucumber/formatter/spec_helper.rb'

# Offense count: 1
# This cop supports safe autocorrection (--autocorrect).
Lint/RedundantCopDisableDirective:
Exclude:
- 'lib/cucumber/cli/options.rb'

# Offense count: 1
# Configuration parameters: AllowComments, AllowNil.
Lint/SuppressedException:
Lint/RescueException:
Exclude:
- 'lib/cucumber/rake/task.rb'
- 'lib/cucumber/glue/proto_world.rb'

# Offense count: 9
# 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: 9
# Offense count: 1
# Configuration parameters: CountComments, CountAsOne, AllowedMethods, AllowedPatterns.
Metrics/MethodLength:
Max: 57

# Offense count: 7
# Configuration parameters: AllowedMethods, AllowedPatterns.
Metrics/PerceivedComplexity:
Max: 13
Expand Down Expand Up @@ -159,7 +178,7 @@ RSpec/EmptyLineAfterFinalLet:
- 'spec/cucumber/configuration_spec.rb'
- 'spec/cucumber/hooks_spec.rb'

# Offense count: 101
# Offense count: 100
# Configuration parameters: CountAsOne.
RSpec/ExampleLength:
Max: 58
Expand Down Expand Up @@ -204,7 +223,7 @@ RSpec/InstanceVariable:
Exclude:
- 'spec/cucumber/formatter/http_io_spec.rb'

# Offense count: 6
# Offense count: 5
# Configuration parameters: EnforcedStyle.
# SupportedStyles: have_received, receive
RSpec/MessageSpies:
Expand Down
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@ This document is formatted according to the principles of [Keep A CHANGELOG](htt
Please visit [cucumber/CONTRIBUTING.md](https://github.com/cucumber/cucumber/blob/master/CONTRIBUTING.md) for more info on how to contribute to Cucumber.

## [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))
- 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))

## [9.0.2] - 2023-09-11
### Changed
Expand Down
12 changes: 4 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,7 @@
[![Stand With Ukraine](https://raw.githubusercontent.com/vshymanskyy/StandWithUkraine/main/badges/StandWithUkraine.svg)](https://vshymanskyy.github.io/StandWithUkraine)
[![OpenCollective](https://opencollective.com/cucumber/backers/badge.svg)](https://opencollective.com/cucumber)
[![OpenCollective](https://opencollective.com/cucumber/sponsors/badge.svg)](https://opencollective.com/cucumber)
[![pull requests](https://oselvar.com/api/badge?label=pull%20requests&csvUrl=https%3A%2F%2Fraw.githubusercontent.com%2Fcucumber%2Foselvar-github-metrics%2Fmain%2Fdata%2Fcucumber%2Fcucumber-ruby%2FpullRequests.csv)](https://oselvar.com/github/cucumber/oselvar-github-metrics/main/cucumber/cucumber-ruby)
[![issues](https://oselvar.com/api/badge?label=issues&csvUrl=https%3A%2F%2Fraw.githubusercontent.com%2Fcucumber%2Foselvar-github-metrics%2Fmain%2Fdata%2Fcucumber%2Fcucumber-ruby%2Fissues.csv)](https://oselvar.com/github/cucumber/oselvar-github-metrics/main/cucumber/cucumber-ruby)
[![Test cucumber](https://github.com/cucumber/cucumber-ruby/actions/workflows/cucumber-ruby.yml/badge.svg)](https://github.com/cucumber/cucumber-ruby/actions/workflows/cucumber-ruby.yml)
[![Test cucumber](https://github.com/cucumber/cucumber-ruby/actions/workflows/test.yaml/badge.svg)](https://github.com/cucumber/cucumber-ruby/actions/workflows/test.yaml)
[![Code Climate](https://codeclimate.com/github/cucumber/cucumber-ruby.svg)](https://codeclimate.com/github/cucumber/cucumber-ruby)
[![Coverage Status](https://coveralls.io/repos/cucumber/cucumber-ruby/badge.svg?branch=main)](https://coveralls.io/r/cucumber/cucumber-ruby?branch=main)

Expand Down Expand Up @@ -56,8 +54,7 @@ Later in this document, bundler is considered being used so all commands are usi

### Ruby on Rails

Using Ruby on Rails? You can use [cucumber-rails](https://github.com/cucumber/cucumber-rails)
to bring Cucumber into your Rails project.
Using Ruby on Rails? You can use [cucumber-rails](https://github.com/cucumber/cucumber-rails) to bring Cucumber into your Rails project.

## Usage

Expand Down Expand Up @@ -133,16 +130,15 @@ To execute a single example, indicates the line of the name of the example:

$ bundle exec cucumber features/rule.feature:5

To summarize the results on the standard output, and writte a HTML report on disk:
To summarize the results on the standard output, and generate a HTML report on disk:

$ bundle exec cucumber --format summary --format html --out report.html

For more command line options

$ bundle exec cucumber --help

You can also find documentation on the command line possibilities in
[features/docs/cli](features/docs/cli).
You can also find documentation on the command line possibilities in [features/docs/cli](features/docs/cli).

## Documentation and support

Expand Down
4 changes: 2 additions & 2 deletions cucumber.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ end
%>
default: <%= std_opts %> --tags "not @jruby"
jruby: <%= std_opts %>
jruby_win: <%= std_opts %> CUCUMBER_FORWARD_SLASH_PATHS=true
windows_mri: <%= std_opts %> --tags "not @jruby" --tags "not @needs-many-fonts" --tags "not @todo-windows" CUCUMBER_FORWARD_SLASH_PATHS=true
jruby_win: <%= std_opts %>
windows_mri: <%= std_opts %> --tags "not @jruby" --tags "not @needs-many-fonts"
wip: --wip <%= wip_opts %> features
none: --format pretty
6 changes: 0 additions & 6 deletions examples/rspec_doubles/Rakefile

This file was deleted.

9 changes: 0 additions & 9 deletions examples/rspec_doubles/features/mocking.feature

This file was deleted.

21 changes: 0 additions & 21 deletions examples/rspec_doubles/features/step_definitions/calvin_steps.rb

This file was deleted.

14 changes: 0 additions & 14 deletions examples/rspec_doubles/features/support/env.rb

This file was deleted.

11 changes: 0 additions & 11 deletions examples/tcl/README.textile

This file was deleted.

8 changes: 0 additions & 8 deletions examples/tcl/Rakefile

This file was deleted.

17 changes: 0 additions & 17 deletions examples/tcl/features/fibonnacci.feature

This file was deleted.

9 changes: 0 additions & 9 deletions examples/tcl/features/step_definitions/fib_steps.rb

This file was deleted.

9 changes: 0 additions & 9 deletions examples/tcl/features/support/env.rb

This file was deleted.

3 changes: 0 additions & 3 deletions examples/tcl/src/fib.tcl

This file was deleted.

4 changes: 0 additions & 4 deletions examples/test_unit/Gemfile.Xxx

This file was deleted.

8 changes: 0 additions & 8 deletions examples/test_unit/Rakefile

This file was deleted.

15 changes: 0 additions & 15 deletions examples/test_unit/features/step_definitions/test_unit_steps.rb

This file was deleted.

9 changes: 0 additions & 9 deletions examples/test_unit/features/test_unit.feature

This file was deleted.

5 changes: 0 additions & 5 deletions features/docs/formatters/junit_formatter.feature
Original file line number Diff line number Diff line change
Expand Up @@ -528,8 +528,3 @@ You *must* specify --out DIR for the junit formatter
"""
And a file named "tmp/TEST-features-pending.xml" should exist

@wip-jruby
Scenario: mixed encoding outputs are handled across all supported ruby versions, failing on jruby currently
When I run `cucumber --format junit --out tmp/ features/encoding_output.feature`
Then it should pass
32 changes: 0 additions & 32 deletions features/docs/gherkin/unicode_table.feature

This file was deleted.

Loading

0 comments on commit c10327a

Please sign in to comment.