Skip to content

Commit d9f0278

Browse files
authored
Refactor/final 9 2 tidies (#1753)
* Tidy up cli options to be a bit neater * Add changelog * Update docs in docs/ dir * AF: RSpec/EmptyLineAfterFinalLet * Remove redundant jruby profiles * Remove legacy tag * Reintroduce required tag
1 parent a4598d9 commit d9f0278

File tree

9 files changed

+32
-40
lines changed

9 files changed

+32
-40
lines changed

.rubocop_todo.yml

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -71,16 +71,16 @@ Naming/MemoizedInstanceVariableName:
7171
- 'lib/cucumber/formatter/json.rb'
7272
- 'lib/cucumber/multiline_argument/data_table.rb'
7373

74-
# Offense count: 14
75-
# Configuration parameters: MinNameLength, AllowNamesEndingInNumbers, AllowedNames, ForbiddenNames.
76-
# AllowedNames: as, at, by, cc, db, id, if, in, io, ip, of, on, os, pp, to
77-
Naming/MethodParameterName:
78-
Exclude:
79-
- 'lib/cucumber/cli/options.rb'
80-
- 'lib/cucumber/formatter/ansicolor.rb'
81-
- 'lib/cucumber/formatter/console.rb'
82-
- 'lib/cucumber/gherkin/formatter/ansi_escapes.rb'
83-
- 'lib/cucumber/multiline_argument/data_table.rb'
74+
## Offense count: 14
75+
## Configuration parameters: MinNameLength, AllowNamesEndingInNumbers, AllowedNames, ForbiddenNames.
76+
## AllowedNames: as, at, by, cc, db, id, if, in, io, ip, of, on, os, pp, to
77+
#Naming/MethodParameterName:
78+
# Exclude:
79+
# - 'lib/cucumber/cli/options.rb'
80+
# - 'lib/cucumber/formatter/ansicolor.rb'
81+
# - 'lib/cucumber/formatter/console.rb'
82+
# - 'lib/cucumber/gherkin/formatter/ansi_escapes.rb'
83+
# - 'lib/cucumber/multiline_argument/data_table.rb'
8484

8585
# Offense count: 8
8686
# Configuration parameters: EnforcedStyle, CheckMethodNames, CheckSymbols, AllowedIdentifiers, AllowedPatterns.

CHANGELOG.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,13 @@ This document is formatted according to the principles of [Keep A CHANGELOG](htt
99
Please visit [cucumber/CONTRIBUTING.md](https://github.com/cucumber/cucumber/blob/master/CONTRIBUTING.md) for more info on how to contribute to Cucumber.
1010

1111
## [Unreleased]
12+
### Changed
13+
- Updated cucumber dependencies (Specifically cucumber-core) ([luke-hill](https://github.com/luke-hill))
1214

13-
## [9.1.2] - 2024-01-23
14-
### Added
15+
### Removed
16+
- Some legacy JRuby local testing profiles are now removed ([luke-hill](https://github.com/luke-hill))
1517

18+
## [9.1.2] - 2024-01-23
1619
### Changed
1720
- Moved all CCK step definition/miscellaneous file logic from CCK gem to this repo.
1821
All logic contained in [compatibility](./compatibility) ([luke-hill](https://github.com/luke-hill))
@@ -23,8 +26,6 @@ All logic contained in [compatibility](./compatibility) ([luke-hill](https://git
2326
(This fixes an issue in cucumber-wire when passing legacy steps down the wire)
2427
([#1746](https://github.com/cucumber/cucumber-ruby/pull/1746) [luke-hill](https://github.com/luke-hill))
2528

26-
### Removed
27-
2829
## [9.1.1] - 2024-01-04
2930
### Changed
3031
- Updated dependencies to slightly more permissive / up to date versions ([luke-hill](https://github.com/luke-hill))

cucumber.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,6 @@ else
1111
end
1212
%>
1313
default: <%= std_opts %> --tags "not @jruby"
14-
jruby: <%= std_opts %>
15-
jruby_win: <%= std_opts %>
1614
windows_mri: <%= std_opts %> --tags "not @jruby" --tags "not @needs-many-fonts"
1715
wip: --wip <%= wip_opts %> features
1816
none: --format pretty

docs/jruby-limitations.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
# Cucumber and JRuby limitations
22

3-
`cucumber` can be executed on `JRuby` (tested with `9.2`), although some of the features
3+
`cucumber` can be executed on `JRuby` (tested with `9.4`), although some of the features
44
are not available on this platform.
55

66
## Defining steps with native languages
77

88
There are currently three languages (Russian, Ukrainian and Uzbek) for which the step definition
99
can not be written in native language.
10+
1011
That means, for example, that you can not write the following code:
1112

1213
```ruby

docs/vscode-example-launch-configuration.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,21 @@
22

33
### Ruby Extension
44

5-
Install and configure the
6-
[ruby extension](https://marketplace.visualstudio.com/items?itemName=rebornix.Ruby)
5+
Install and configure the [ruby extension](https://marketplace.visualstudio.com/items?itemName=rebornix.Ruby)
76

87
### Use `debase` and `ruby-debug-ide` gems locally
98

109
Make sure to use a `Gemfile.local` file with `debase` and `ruby-debug-ide` gems.
1110

12-
~~~ruby
11+
```ruby
1312
# Include the regular Gemfile
1413
eval File.read('Gemfile')
1514

1615
group :development do
1716
gem 'debase', require: false
1817
gem 'ruby-debug-ide', require: false
1918
end
20-
~~~
19+
```
2120

2221
Execute `bundle config set --local gemfile Gemfile.local` to use it per default,
2322
then `bundle install`.

lib/cucumber/cli/options.rb

Lines changed: 8 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -116,10 +116,10 @@ def parse!(args)
116116
opts.on('-f FORMAT', '--format FORMAT', *format_msg, *FORMAT_HELP) do |v|
117117
add_option :formats, [*parse_formats(v), @out_stream]
118118
end
119-
opts.on('--init', *init_msg) { |_v| initialize_project }
119+
opts.on('--init', *init_msg) { initialize_project }
120120
opts.on('-o', '--out [FILE|DIR|URL]', *out_msg) { |v| out_stream v }
121-
opts.on('-t TAG_EXPRESSION', '--tags TAG_EXPRESSION', *tags_msg) { |v| add_tag v }
122-
opts.on('-n NAME', '--name NAME', *name_msg) { |v| add_option :name_regexps, /#{v}/ }
121+
opts.on('-t TAG_EXPRESSION', '--tags TAG_EXPRESSION', *tags_msg) { |v| add_tag(v) }
122+
opts.on('-n NAME', '--name NAME', *name_msg) { |v| add_option(:name_regexps, /#{v}/) }
123123
opts.on('-e', '--exclude PATTERN', *exclude_msg) { |v| add_option :excludes, Regexp.new(v) }
124124
opts.on(PROFILE_SHORT_FLAG, "#{PROFILE_LONG_FLAG} PROFILE", *profile_short_flag_msg) { |v| add_profile v }
125125
opts.on(NO_PROFILE_SHORT_FLAG, NO_PROFILE_LONG_FLAG, *no_profile_short_flag_msg) { |_v| disable_profile_loading }
@@ -301,9 +301,9 @@ def parse_formats(value)
301301
[formatter, options_hash]
302302
end
303303

304-
def out_stream(v)
304+
def out_stream(value)
305305
@options[:formats] << ['pretty', {}, nil] if @options[:formats].empty?
306-
@options[:formats][-1][2] = v
306+
@options[:formats][-1][2] = value
307307
end
308308

309309
def tags_msg
@@ -455,7 +455,7 @@ def set_dry_run_and_duration
455455
end
456456

457457
def exit_ok(text)
458-
@out_stream.puts text
458+
@out_stream.puts(text)
459459
Kernel.exit(0)
460460
end
461461

@@ -483,22 +483,11 @@ def extract_environment_variables
483483
end
484484
end
485485

486-
def disable_profile_loading?
487-
@disable_profile_loading
488-
end
489-
490486
def merge_profiles
491-
if @disable_profile_loading
492-
@out_stream.puts 'Disabling profiles...'
493-
return
494-
end
487+
return @out_stream.puts 'Disabling profiles...' if @disable_profile_loading
495488

496489
@profiles << @default_profile if default_profile_should_be_used?
497-
498-
@profiles.each do |profile|
499-
merge_with_profile(profile)
500-
end
501-
490+
@profiles.each { |profile| merge_with_profile(profile) }
502491
@options[:profiles] = @profiles
503492
end
504493

spec/cucumber/cli/main_spec.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ module Cli
1515
let(:stdout) { StringIO.new }
1616
let(:stderr) { StringIO.new }
1717
let(:kernel) { double(:kernel) }
18+
1819
subject { described_class.new(args, stdout, stderr, kernel) }
1920

2021
describe '#execute!' do

spec/cucumber/configuration_spec.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ module Cucumber
1515

1616
describe 'with custom user options' do
1717
let(:user_options) { { autoload_code_paths: ['foo/bar/baz'] } }
18+
1819
subject { described_class.new(user_options) }
1920

2021
it 'allows you to override the defaults' do

spec/cucumber/hooks_spec.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,14 @@ module Hooks
2222
describe BeforeHook do
2323
subject { described_class.new(location) }
2424
let(:location) { Cucumber::Core::Test::Location.new('hooks.rb', 1) }
25+
2526
it_behaves_like 'a source node'
2627
end
2728

2829
describe AfterHook do
2930
subject { described_class.new(location) }
3031
let(:location) { Cucumber::Core::Test::Location.new('hooks.rb', 1) }
32+
3133
it_behaves_like 'a source node'
3234
end
3335
end

0 commit comments

Comments
 (0)