chutney 3.2.1 → 3.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/Rakefile +1 -1
- data/chutney.gemspec +2 -2
- data/config/chutney_defaults.yml +8 -0
- data/docs/usage/configuration.md +1 -1
- data/docs/usage/rules.md +8 -0
- data/exe/chutney +7 -0
- data/lib/chutney/linter/avoid_outline_for_single_example.rb +1 -0
- data/lib/chutney/linter/avoid_splat_steps_in_background.rb +16 -0
- data/lib/chutney/linter/avoid_splat_steps_in_scenarios.rb +12 -0
- data/lib/chutney/linter/missing_example_table.rb +17 -0
- data/lib/chutney/linter/missing_scenario_outline.rb +17 -0
- data/lib/chutney/version.rb +1 -1
- data/lib/chutney.rb +4 -0
- data/lib/config/locales/en.yml +8 -0
- data/spec/spec_helper.rb +4 -4
- metadata +11 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 72a8913c71a8e2291fa14ef87b527e11481dfe45519370455fbddf2df8856836
|
4
|
+
data.tar.gz: cd4fded7ea629dd5ae5e5b74ac204c8b5d3dfee96e21f65db3c3355449dbb0c1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2387b637bdb751865c8f6fbc97f61e90e25f7d6dc52f6da7dae598f5d156c06226f985df609b3a58597213f7e9b6e5a87be2fd5c67c78b57ae60c16603cde040
|
7
|
+
data.tar.gz: b7d67216485f10777e91250582facc4143e0f463360463f87aa8bf219e16b91e8e000a4e8ae94f442130f5246d0adf61e4df0b50b22bea1a05743145ea77e346
|
data/.gitignore
CHANGED
data/Rakefile
CHANGED
data/chutney.gemspec
CHANGED
@@ -50,7 +50,7 @@ Gem::Specification.new do |spec|
|
|
50
50
|
|
51
51
|
spec.add_runtime_dependency 'amatch', '~> 0.4.0'
|
52
52
|
spec.add_runtime_dependency 'cuke_modeler', '~> 3.3'
|
53
|
-
spec.add_runtime_dependency 'i18n', '>= 1.8.2', '< 1.
|
53
|
+
spec.add_runtime_dependency 'i18n', '>= 1.8.2', '< 1.13.0'
|
54
54
|
spec.add_runtime_dependency 'pastel', '~> 0.7'
|
55
55
|
spec.add_runtime_dependency 'tty-pie', '~> 0.3'
|
56
56
|
|
@@ -61,7 +61,7 @@ Gem::Specification.new do |spec|
|
|
61
61
|
spec.add_development_dependency 'rake', '~> 13.0'
|
62
62
|
spec.add_development_dependency 'rerun', '~> 0.13'
|
63
63
|
spec.add_development_dependency 'rspec-expectations', '~> 3.0'
|
64
|
-
spec.add_development_dependency 'rubocop', '~> 1.
|
64
|
+
spec.add_development_dependency 'rubocop', '~> 1.45.1'
|
65
65
|
spec.add_development_dependency 'rspec', '~> 3.8'
|
66
66
|
|
67
67
|
spec.required_ruby_version = '>= 2.6'
|
data/config/chutney_defaults.yml
CHANGED
@@ -4,6 +4,10 @@ AvoidFullStop:
|
|
4
4
|
Enabled: true
|
5
5
|
AvoidScripting:
|
6
6
|
Enabled: true
|
7
|
+
AvoidSplatStepsInBackground:
|
8
|
+
Enabled: true
|
9
|
+
AvoidSplatStepsInScenarios:
|
10
|
+
Enabled: true
|
7
11
|
AvoidTypographersQuotes:
|
8
12
|
Enabled: true
|
9
13
|
BackgroundDoesMoreThanSetup:
|
@@ -20,12 +24,16 @@ GivensAfterBackground:
|
|
20
24
|
Enabled: true
|
21
25
|
MissingExampleName:
|
22
26
|
Enabled: true
|
27
|
+
MissingExampleTable:
|
28
|
+
Enabled: true
|
23
29
|
MissingFeatureDescription:
|
24
30
|
Enabled: true
|
25
31
|
MissingFeatureName:
|
26
32
|
Enabled: true
|
27
33
|
MissingScenarioName:
|
28
34
|
Enabled: true
|
35
|
+
MissingScenarioOutline:
|
36
|
+
Enabled: true
|
29
37
|
MissingTestAction:
|
30
38
|
Enabled: true
|
31
39
|
MissingVerification:
|
data/docs/usage/configuration.md
CHANGED
@@ -9,4 +9,4 @@ nav_order: 3
|
|
9
9
|
|
10
10
|
Chutney looks for a configuration file in the current directory called `config/.chutney.yml`. This configuration mostly switches on individual linters globally, but a few have addition parameters which can be configured (e.g. the maximum characters in a step).
|
11
11
|
|
12
|
-
A default configuration can be found [here](https://github.com/BillyRuffian/chutney/blob/master/config/
|
12
|
+
A default configuration can be found [here](https://github.com/BillyRuffian/chutney/blob/master/config/chutney_defaults.yml).
|
data/docs/usage/rules.md
CHANGED
@@ -15,6 +15,10 @@ Chutney enforces its rules with the linters. These are:
|
|
15
15
|
|
16
16
|
[AvoidScripting](https://github.com/BillyRuffian/chutney/blob/master/features/avoid_scripting.feature): You have a lot of steps, are you sure you're not scripting the scenario when you should be specifying the behaviour of the system?
|
17
17
|
|
18
|
+
[AvoidSplatStepsInBackground](https://github.com/BillyRuffian/chutney/blob/master/features/avoid_splat_steps_in_background.feature): The Background contains a splat step. It should only contain named steps.
|
19
|
+
|
20
|
+
[AvoidSplatStepsInScenarios](https://github.com/BillyRuffian/chutney/blob/master/features/avoid_splat_steps_in_scenarios.feature): The Scenario contains a splat step. It should only contain named steps.
|
21
|
+
|
18
22
|
[AvoidTypographersQuotes](https://github.com/BillyRuffian/chutney/blob/master/features/avoid_typographers_quotes.feature): Cutting and pasting from Word documents? Is that pasting in curly-quotes instead of neutral ones you would type on a keyboard? Are you sure that's what you want?
|
19
23
|
|
20
24
|
[BackgroundDoesMoreThanSetup](https://github.com/BillyRuffian/chutney/blob/master/features/background_does_more_than_setup.feature): Background in feature files should only do setup activity and so they should only contain `Given` steps.
|
@@ -35,12 +39,16 @@ Chutney enforces its rules with the linters. These are:
|
|
35
39
|
|
36
40
|
[MissingExampleName](https://github.com/BillyRuffian/chutney/blob/master/features/missing_example_name.feature): If you have more than one example table in your scenario, they should each be given unique names.
|
37
41
|
|
42
|
+
[MissingExampleTable](https://github.com/BillyRuffian/chutney/blob/master/features/missing_example_table.feature): You are missing an example table. You should have at least one example table when using Scenario outlines.
|
43
|
+
|
38
44
|
[MissingFeatureDescription](https://github.com/BillyRuffian/chutney/blob/master/features/missing_feature_description.feature): Your feature should have a value statement. These are usually in the form 'As a... I want.. So that...'.
|
39
45
|
|
40
46
|
[MissingFeatureName](https://github.com/BillyRuffian/chutney/blob/master/features/missing_feature_name.feature): You should give your features a descriptive name.
|
41
47
|
|
42
48
|
[MissingScenarioName](https://github.com/BillyRuffian/chutney/blob/master/features/missing_scenario_name.feature): You should name your scenarios and scenario outlines.
|
43
49
|
|
50
|
+
[MissingScenarioOutline](https://github.com/BillyRuffian/chutney/blob/master/features/missing_scenario_outline.feature): You should use Scenario Outline instead of Scenario when there is an Examples table to indicate that this scenario will be run multiple times with different data.
|
51
|
+
|
44
52
|
[MissingTestAction](https://github.com/BillyRuffian/chutney/blob/master/features/missing_test_action.feature): You don't have an action (a `When` step) in your scenario.
|
45
53
|
|
46
54
|
[MissingVerification](https://github.com/BillyRuffian/chutney/blob/master/features/missing_verification.feature): You don't have a verification step (a `Then` step) in your scenario.
|
data/exe/chutney
CHANGED
@@ -10,6 +10,7 @@ require 'optparse'
|
|
10
10
|
|
11
11
|
formatters = Set.new
|
12
12
|
|
13
|
+
# rubocop:disable Metrics/BlockLength
|
13
14
|
OptionParser.new do |opts|
|
14
15
|
opts.banner = 'Usage: chutney [files]'
|
15
16
|
opts.on('-f',
|
@@ -20,6 +21,11 @@ OptionParser.new do |opts|
|
|
20
21
|
formatters << formatter
|
21
22
|
end
|
22
23
|
|
24
|
+
opts.on('-v', '--version', 'Display the version.') do
|
25
|
+
puts Chutney::VERSION
|
26
|
+
exit
|
27
|
+
end
|
28
|
+
|
23
29
|
opts.on('-l',
|
24
30
|
'--linters',
|
25
31
|
'List the linter status by this configuration and exit') do
|
@@ -38,6 +44,7 @@ OptionParser.new do |opts|
|
|
38
44
|
exit
|
39
45
|
end
|
40
46
|
end.parse!
|
47
|
+
# rubocop:enable Metrics/BlockLength
|
41
48
|
|
42
49
|
formatters << 'RainbowFormatter' if formatters.empty?
|
43
50
|
|
@@ -9,6 +9,7 @@ module Chutney
|
|
9
9
|
next unless scenario.examples
|
10
10
|
|
11
11
|
next if scenario.examples.length > 1
|
12
|
+
next if scenario.examples.first.nil? # dont run lint if the example does not exist
|
12
13
|
next if scenario.examples.first.rows.length > 2 # first row is the header
|
13
14
|
|
14
15
|
add_issue(I18n.t('linters.avoid_outline_for_single_example'), feature, scenario)
|
@@ -0,0 +1,16 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Chutney
|
4
|
+
# service class to lint for avoiding splats
|
5
|
+
class AvoidSplatStepsInBackground < Linter
|
6
|
+
def lint
|
7
|
+
background do |feature, background|
|
8
|
+
splat_steps = background&.steps&.select { |s| s.keyword == '*' }
|
9
|
+
# add_issue(I18n.t('linters.avoid_full_stop'), feature, child, step) if step.text.strip.end_with? '.'
|
10
|
+
if splat_steps && !splat_steps.empty?
|
11
|
+
add_issue(I18n.t('linters.avoid_splat_steps_in_background'), feature, background, splat_steps.first)
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Chutney
|
4
|
+
# service class to lint for avoiding splats
|
5
|
+
class AvoidSplatStepsInScenarios < Linter
|
6
|
+
def lint
|
7
|
+
steps do |feature, child, step|
|
8
|
+
add_issue(I18n.t('linters.avoid_splat_steps_in_scenarios'), feature, child, step) if step.keyword == '*'
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'chutney/linter'
|
4
|
+
|
5
|
+
module Chutney
|
6
|
+
# service class to lint for missing example tables in scenario outlines
|
7
|
+
class MissingExampleTable < Linter
|
8
|
+
def lint
|
9
|
+
scenarios do |_feature, scenario|
|
10
|
+
next unless scenario.is_a? CukeModeler::Outline
|
11
|
+
next unless scenario.examples.empty?
|
12
|
+
|
13
|
+
add_issue(I18n.t('linters.missing_example_table'), feature, scenario)
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'chutney/linter'
|
4
|
+
|
5
|
+
module Chutney
|
6
|
+
# service class to lint for missing scenario outlines when examples tables given
|
7
|
+
class MissingScenarioOutline < Linter
|
8
|
+
def lint
|
9
|
+
scenarios do |_feature, scenario|
|
10
|
+
next unless scenario.is_a? CukeModeler::Outline
|
11
|
+
next unless scenario.keyword == 'Scenario'
|
12
|
+
|
13
|
+
add_issue(I18n.t('linters.missing_scenario_outline'), feature, scenario)
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
data/lib/chutney/version.rb
CHANGED
data/lib/chutney.rb
CHANGED
@@ -7,6 +7,8 @@ require 'chutney/linter'
|
|
7
7
|
require 'chutney/linter/avoid_full_stop'
|
8
8
|
require 'chutney/linter/avoid_outline_for_single_example'
|
9
9
|
require 'chutney/linter/avoid_scripting'
|
10
|
+
require 'chutney/linter/avoid_splat_steps_in_background'
|
11
|
+
require 'chutney/linter/avoid_splat_steps_in_scenarios'
|
10
12
|
require 'chutney/linter/avoid_typographers_quotes'
|
11
13
|
require 'chutney/linter/background_does_more_than_setup'
|
12
14
|
require 'chutney/linter/background_requires_multiple_scenarios'
|
@@ -17,9 +19,11 @@ require 'chutney/linter/givens_after_background'
|
|
17
19
|
require 'chutney/linter/invalid_file_name'
|
18
20
|
require 'chutney/linter/invalid_step_flow'
|
19
21
|
require 'chutney/linter/missing_example_name'
|
22
|
+
require 'chutney/linter/missing_example_table'
|
20
23
|
require 'chutney/linter/missing_feature_description'
|
21
24
|
require 'chutney/linter/missing_feature_name'
|
22
25
|
require 'chutney/linter/missing_scenario_name'
|
26
|
+
require 'chutney/linter/missing_scenario_outline'
|
23
27
|
require 'chutney/linter/missing_test_action'
|
24
28
|
require 'chutney/linter/missing_verification'
|
25
29
|
require 'chutney/linter/required_tags_starts_with'
|
data/lib/config/locales/en.yml
CHANGED
@@ -11,6 +11,10 @@ en:
|
|
11
11
|
avoid_scripting: >-
|
12
12
|
You have %{count} When steps when you should only have one.
|
13
13
|
Be careful not to add And steps following a When.
|
14
|
+
avoid_splat_steps_in_background: >-
|
15
|
+
The Background contains a splat step. It should only contain named steps.
|
16
|
+
avoid_splat_steps_in_scenarios: >-
|
17
|
+
The Scenario contains a splat step. It should only contain named steps.
|
14
18
|
avoid_typographers_quotes: >-
|
15
19
|
You are using typographers quotation marks (curly quotes).
|
16
20
|
Make sure you intend to use this character and not a neutral quote
|
@@ -45,6 +49,8 @@ en:
|
|
45
49
|
You have a scenerio with more than one example table, at least one of which is
|
46
50
|
unnamed or has a duplicate name.
|
47
51
|
You should give your example tables clear and meaningful names when you have more than one.
|
52
|
+
missing_example_table: >-
|
53
|
+
Scenario Outline must have at least one Examples table.
|
48
54
|
missing_feature_description: >-
|
49
55
|
Features should have a description / value statement so that the importance of the feature
|
50
56
|
is well understood.
|
@@ -52,6 +58,8 @@ en:
|
|
52
58
|
This feature is unnamed. You should name all features.
|
53
59
|
missing_scenario_name: >-
|
54
60
|
This scenario is unnamed. You should name all scenarios.
|
61
|
+
missing_scenario_outline: >-
|
62
|
+
Scenario Outline should be used instead of Scenario when there is an Examples table.
|
55
63
|
missing_test_action: >-
|
56
64
|
Your test has no action step. All scenarios should have a 'When' step indicating the
|
57
65
|
action being taken.
|
data/spec/spec_helper.rb
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require 'simplecov'
|
4
|
-
require 'coveralls'
|
5
|
-
# Coveralls.wear!
|
6
|
-
SimpleCov.start
|
3
|
+
# require 'simplecov'
|
4
|
+
# require 'coveralls'
|
5
|
+
# # Coveralls.wear!
|
6
|
+
# SimpleCov.start
|
7
7
|
|
8
8
|
# This file was generated by the `rspec --init` command. Conventionally, all
|
9
9
|
# specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: chutney
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.
|
4
|
+
version: 3.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nigel Brookes-Thomas
|
@@ -11,7 +11,7 @@ authors:
|
|
11
11
|
autorequire:
|
12
12
|
bindir: exe
|
13
13
|
cert_chain: []
|
14
|
-
date:
|
14
|
+
date: 2023-02-22 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: amatch
|
@@ -50,7 +50,7 @@ dependencies:
|
|
50
50
|
version: 1.8.2
|
51
51
|
- - "<"
|
52
52
|
- !ruby/object:Gem::Version
|
53
|
-
version: 1.
|
53
|
+
version: 1.13.0
|
54
54
|
type: :runtime
|
55
55
|
prerelease: false
|
56
56
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -60,7 +60,7 @@ dependencies:
|
|
60
60
|
version: 1.8.2
|
61
61
|
- - "<"
|
62
62
|
- !ruby/object:Gem::Version
|
63
|
-
version: 1.
|
63
|
+
version: 1.13.0
|
64
64
|
- !ruby/object:Gem::Dependency
|
65
65
|
name: pastel
|
66
66
|
requirement: !ruby/object:Gem::Requirement
|
@@ -179,14 +179,14 @@ dependencies:
|
|
179
179
|
requirements:
|
180
180
|
- - "~>"
|
181
181
|
- !ruby/object:Gem::Version
|
182
|
-
version: 1.
|
182
|
+
version: 1.45.1
|
183
183
|
type: :development
|
184
184
|
prerelease: false
|
185
185
|
version_requirements: !ruby/object:Gem::Requirement
|
186
186
|
requirements:
|
187
187
|
- - "~>"
|
188
188
|
- !ruby/object:Gem::Version
|
189
|
-
version: 1.
|
189
|
+
version: 1.45.1
|
190
190
|
- !ruby/object:Gem::Dependency
|
191
191
|
name: rspec
|
192
192
|
requirement: !ruby/object:Gem::Requirement
|
@@ -253,6 +253,8 @@ files:
|
|
253
253
|
- lib/chutney/linter/avoid_full_stop.rb
|
254
254
|
- lib/chutney/linter/avoid_outline_for_single_example.rb
|
255
255
|
- lib/chutney/linter/avoid_scripting.rb
|
256
|
+
- lib/chutney/linter/avoid_splat_steps_in_background.rb
|
257
|
+
- lib/chutney/linter/avoid_splat_steps_in_scenarios.rb
|
256
258
|
- lib/chutney/linter/avoid_typographers_quotes.rb
|
257
259
|
- lib/chutney/linter/background_does_more_than_setup.rb
|
258
260
|
- lib/chutney/linter/background_requires_multiple_scenarios.rb
|
@@ -263,9 +265,11 @@ files:
|
|
263
265
|
- lib/chutney/linter/invalid_file_name.rb
|
264
266
|
- lib/chutney/linter/invalid_step_flow.rb
|
265
267
|
- lib/chutney/linter/missing_example_name.rb
|
268
|
+
- lib/chutney/linter/missing_example_table.rb
|
266
269
|
- lib/chutney/linter/missing_feature_description.rb
|
267
270
|
- lib/chutney/linter/missing_feature_name.rb
|
268
271
|
- lib/chutney/linter/missing_scenario_name.rb
|
272
|
+
- lib/chutney/linter/missing_scenario_outline.rb
|
269
273
|
- lib/chutney/linter/missing_test_action.rb
|
270
274
|
- lib/chutney/linter/missing_verification.rb
|
271
275
|
- lib/chutney/linter/required_tags_starts_with.rb
|
@@ -310,7 +314,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
310
314
|
- !ruby/object:Gem::Version
|
311
315
|
version: '0'
|
312
316
|
requirements: []
|
313
|
-
rubygems_version: 3.
|
317
|
+
rubygems_version: 3.4.1
|
314
318
|
signing_key:
|
315
319
|
specification_version: 4
|
316
320
|
summary: A linter for multi-lingual Gherkin
|