chutney 2.2.1 → 3.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/dependabot.yml +16 -0
- data/.rubocop.yml +10 -3
- data/Gemfile +2 -0
- data/LICENSE.txt +1 -1
- data/README.md +7 -1
- data/Rakefile +8 -8
- data/chutney.gemspec +13 -6
- data/config/{chutney.yml → chutney_defaults.yml} +2 -0
- data/config/cucumber.yml +1 -0
- data/docs/index.md +1 -1
- data/docs/usage/rules.md +34 -64
- data/exe/chutney +23 -3
- data/lib/chutney.rb +18 -14
- data/lib/chutney/configuration.rb +9 -2
- data/lib/chutney/formatter.rb +6 -5
- data/lib/chutney/formatter/json_formatter.rb +2 -0
- data/lib/chutney/formatter/pie_formatter.rb +10 -13
- data/lib/chutney/formatter/rainbow_formatter.rb +13 -13
- data/lib/chutney/issue.rb +2 -0
- data/lib/chutney/linter.rb +92 -86
- data/lib/chutney/linter/avoid_full_stop.rb +4 -4
- data/lib/chutney/linter/avoid_outline_for_single_example.rb +7 -5
- data/lib/chutney/linter/avoid_scripting.rb +8 -6
- data/lib/chutney/linter/avoid_typographers_quotes.rb +16 -14
- data/lib/chutney/linter/background_does_more_than_setup.rb +8 -7
- data/lib/chutney/linter/background_requires_multiple_scenarios.rb +7 -4
- data/lib/chutney/linter/bad_scenario_name.rb +6 -4
- data/lib/chutney/linter/empty_feature_file.rb +2 -0
- data/lib/chutney/linter/file_name_differs_feature_name.rb +7 -5
- data/lib/chutney/linter/givens_after_background.rb +7 -8
- data/lib/chutney/linter/invalid_file_name.rb +3 -1
- data/lib/chutney/linter/invalid_step_flow.rb +9 -9
- data/lib/chutney/linter/missing_example_name.rb +9 -9
- data/lib/chutney/linter/missing_feature_description.rb +5 -4
- data/lib/chutney/linter/missing_feature_name.rb +5 -4
- data/lib/chutney/linter/missing_scenario_name.rb +4 -6
- data/lib/chutney/linter/missing_test_action.rb +4 -2
- data/lib/chutney/linter/missing_verification.rb +4 -2
- data/lib/chutney/linter/required_tags_starts_with.rb +7 -6
- data/lib/chutney/linter/same_tag_different_case.rb +37 -0
- data/lib/chutney/linter/same_tag_for_all_scenarios.rb +20 -19
- data/lib/chutney/linter/scenario_names_match.rb +6 -6
- data/lib/chutney/linter/tag_used_multiple_times.rb +3 -1
- data/lib/chutney/linter/too_clumsy.rb +4 -2
- data/lib/chutney/linter/too_long_step.rb +6 -4
- data/lib/chutney/linter/too_many_different_tags.rb +10 -8
- data/lib/chutney/linter/too_many_steps.rb +6 -4
- data/lib/chutney/linter/too_many_tags.rb +5 -3
- data/lib/chutney/linter/unique_scenario_names.rb +5 -5
- data/lib/chutney/linter/unknown_variable.rb +15 -15
- data/lib/chutney/linter/unused_variable.rb +15 -16
- data/lib/chutney/linter/use_background.rb +20 -19
- data/lib/chutney/linter/use_outline.rb +15 -14
- data/lib/chutney/version.rb +3 -1
- data/lib/config/locales/en.yml +3 -0
- data/spec/chutney_spec.rb +11 -9
- data/spec/spec_helper.rb +2 -0
- metadata +21 -16
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ad89ad439835c7acb1f2d3d0b4ee44895f714c7b6fc4f1a07f68e23594384979
|
4
|
+
data.tar.gz: c8eb1551cd49f668882ccbf047f65403e6f5724d8193c483d5fd16c14e456747
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4a1a21294785d98f9e1997eb02547ddc6556200d0d3261d0e57ee2586725808aa2221452b341a7f9badb9ed3fdf9784b185a552ef15fa7f9c30e4c50cee99190
|
7
|
+
data.tar.gz: ffc03086fba54bdd0747593170f33e696d009241778d6794392517d3541aa45fe20d20bd64aab41fbbdbb4382d47c47832f3d17762f316a8f6e11d245558fbb9
|
@@ -0,0 +1,16 @@
|
|
1
|
+
version: 2
|
2
|
+
updates:
|
3
|
+
- package-ecosystem: bundler
|
4
|
+
directory: "/"
|
5
|
+
schedule:
|
6
|
+
interval: daily
|
7
|
+
open-pull-requests-limit: 10
|
8
|
+
ignore:
|
9
|
+
- dependency-name: rubocop
|
10
|
+
versions:
|
11
|
+
- 1.10.0
|
12
|
+
- 1.11.0
|
13
|
+
- 1.12.0
|
14
|
+
- 1.12.1
|
15
|
+
- 1.9.0
|
16
|
+
- 1.9.1
|
data/.rubocop.yml
CHANGED
@@ -8,7 +8,7 @@
|
|
8
8
|
|
9
9
|
# Offense count: 1
|
10
10
|
Metrics/AbcSize:
|
11
|
-
|
11
|
+
Enabled: false
|
12
12
|
|
13
13
|
# Offense count: 1
|
14
14
|
# Configuration parameters: CountComments.
|
@@ -25,7 +25,8 @@ Layout/LineLength:
|
|
25
25
|
# Offense count: 1
|
26
26
|
# Configuration parameters: CountComments.
|
27
27
|
Metrics/MethodLength:
|
28
|
-
Max:
|
28
|
+
Max: 20
|
29
|
+
|
29
30
|
|
30
31
|
# Offense count: 1
|
31
32
|
# Cop supports --auto-correct.
|
@@ -52,7 +53,13 @@ Layout/HeredocIndentation:
|
|
52
53
|
- "**/*_spec.rb"
|
53
54
|
|
54
55
|
Layout/TrailingWhitespace:
|
55
|
-
Enabled:
|
56
|
+
Enabled: true
|
56
57
|
|
57
58
|
Style/FrozenStringLiteralComment:
|
59
|
+
Enabled: true
|
60
|
+
|
61
|
+
Style/StringConcatenation:
|
58
62
|
Enabled: false
|
63
|
+
|
64
|
+
AllCops:
|
65
|
+
NewCops: enable
|
data/Gemfile
CHANGED
data/LICENSE.txt
CHANGED
data/README.md
CHANGED
@@ -19,4 +19,10 @@
|
|
19
19
|
|
20
20
|
</div>
|
21
21
|
|
22
|
-
Read the documentation [here](https://billyruffian.github.io/chutney/).
|
22
|
+
Read the documentation [here](https://billyruffian.github.io/chutney/) or try [Chutney Online](https://chutney.billy-ruffian.co.uk).
|
23
|
+
|
24
|
+
See [this page](https://billyruffian.github.io/chutney/usage/rules.html) for a full list of the rules chutney encourages.
|
25
|
+
|
26
|
+
## Notes
|
27
|
+
|
28
|
+
Chutney 3+ has replaced its direct dependency on Cucumber and instead uses the excellent [cuke_modeller](https://github.com/enkessler/cuke_modeler) to parse your feature files.
|
data/Rakefile
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'rake/testtask'
|
2
4
|
|
3
5
|
task default: :build
|
@@ -16,14 +18,12 @@ end
|
|
16
18
|
|
17
19
|
desc 'Checks ruby style'
|
18
20
|
task :rubocop do
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
puts 'Rubocop failed'
|
26
|
-
end
|
21
|
+
sh 'rubocop -a'
|
22
|
+
rescue RuntimeError => e
|
23
|
+
# Rubocop failing due to style violations is fine. Other errors should bubble up to our attention.
|
24
|
+
raise e unless e.message =~ /status \(1\).*rubocop/
|
25
|
+
|
26
|
+
puts 'Rubocop failed'
|
27
27
|
end
|
28
28
|
|
29
29
|
task :spec do
|
data/chutney.gemspec
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
# Disable rubocop checks for the .gemspec
|
2
4
|
# I'll take the output from 'bundle gem new' to be authoritative
|
3
5
|
# rubocop:disable all
|
@@ -12,9 +14,13 @@ Gem::Specification.new do |spec|
|
|
12
14
|
spec.authors = ['Nigel Brookes-Thomas', 'Stefan Rohe', 'Nishtha Argawal', 'John Gluck']
|
13
15
|
spec.email = ['nigel@brookes-thomas.co.uk']
|
14
16
|
|
15
|
-
spec.summary = 'A linter for
|
16
|
-
spec.description = 'A linter for your Cucumber features. '
|
17
|
-
|
17
|
+
spec.summary = 'A linter for multi-lingual Gherkin'
|
18
|
+
spec.description = 'A linter for your Cucumber features. ' \
|
19
|
+
'Making sure you have nice, expressible Gherkin is ' \
|
20
|
+
'essential is making sure you have a readable test-base. ' \
|
21
|
+
'Chutney is designed to sniff out smells in your feature ' \
|
22
|
+
'files. ' \
|
23
|
+
'It supports any spoken language Cucumber supports.'
|
18
24
|
|
19
25
|
spec.homepage = 'https://billyruffian.github.io/chutney/'
|
20
26
|
spec.license = 'MIT'
|
@@ -43,19 +49,20 @@ Gem::Specification.new do |spec|
|
|
43
49
|
spec.require_paths = ['lib']
|
44
50
|
|
45
51
|
spec.add_runtime_dependency 'amatch', '~> 0.4.0'
|
46
|
-
spec.add_runtime_dependency '
|
52
|
+
spec.add_runtime_dependency 'cuke_modeler', '~> 3.3'
|
47
53
|
spec.add_runtime_dependency 'i18n', '~> 1.8.2'
|
48
54
|
spec.add_runtime_dependency 'pastel', '~> 0.7'
|
49
55
|
spec.add_runtime_dependency 'tty-pie', '~> 0.3'
|
50
56
|
|
51
57
|
|
52
58
|
spec.add_development_dependency 'coveralls', '~> 0.8'
|
53
|
-
spec.add_development_dependency 'cucumber', '~>
|
59
|
+
spec.add_development_dependency 'cucumber', '~> 6.0'
|
54
60
|
spec.add_development_dependency 'pry-byebug', '~> 3.0'
|
55
61
|
spec.add_development_dependency 'rake', '~> 13.0'
|
56
62
|
spec.add_development_dependency 'rerun', '~> 0.13'
|
57
63
|
spec.add_development_dependency 'rspec-expectations', '~> 3.0'
|
58
|
-
spec.add_development_dependency 'rubocop', '~>
|
64
|
+
spec.add_development_dependency 'rubocop', '~> 1.14.0'
|
59
65
|
spec.add_development_dependency 'rspec', '~> 3.8'
|
60
66
|
|
67
|
+
spec.required_ruby_version = '~> 2.6'
|
61
68
|
end
|
data/config/cucumber.yml
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
default: --publish-quiet
|
data/docs/index.md
CHANGED
@@ -18,4 +18,4 @@ You're trying to follow TDD or ATDD principles, you're writing executable specif
|
|
18
18
|
|
19
19
|
Cucumber itself is an awesome tool which bridges with gap between business language, software development language and the language of testers. With all these folks interested, it's easy to write problematic and hard to maintain features. Chutney tries to help with that by having a common set of quality rules for your feature files.
|
20
20
|
|
21
|
-
Chutney is able to lint feature files in any spoken language supported by Cucumber
|
21
|
+
Chutney is able to lint feature files in any spoken language supported by Cucumber.
|
data/docs/usage/rules.md
CHANGED
@@ -9,98 +9,68 @@ nav_order: 2
|
|
9
9
|
|
10
10
|
Chutney enforces its rules with the linters. These are:
|
11
11
|
|
12
|
-
[AvoidFullStop](https://github.com/BillyRuffian/chutney/blob/master/features/avoid_full_stop.feature)
|
13
|
-
: Don't have a full stop (period) at the end of step because it makes step reuse really hard.
|
12
|
+
[AvoidFullStop](https://github.com/BillyRuffian/chutney/blob/master/features/avoid_full_stop.feature): Don't have a full stop (period) at the end of step because it makes step reuse really hard.
|
14
13
|
|
15
|
-
[AvoidOutlineForSingleExample](https://github.com/BillyRuffian/chutney/blob/master/features/avoid_outline_for_single_example.feature)
|
16
|
-
: If you only have a single example in your example table, use a plain-old scenario instead.
|
14
|
+
[AvoidOutlineForSingleExample](https://github.com/BillyRuffian/chutney/blob/master/features/avoid_outline_for_single_example.feature): If you only have a single example in your example table, use a plain-old scenario instead.
|
17
15
|
|
18
|
-
[AvoidScripting](https://github.com/BillyRuffian/chutney/blob/master/features/avoid_scripting.feature)
|
19
|
-
: 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?
|
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?
|
20
17
|
|
21
|
-
[AvoidTypographersQuotes](https://github.com/BillyRuffian/chutney/blob/master/features/avoid_typographers_quotes.feature)
|
22
|
-
: 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?
|
18
|
+
[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?
|
23
19
|
|
24
|
-
[BackgroundDoesMoreThanSetup](https://github.com/BillyRuffian/chutney/blob/master/features/background_does_more_than_setup.feature)
|
25
|
-
: Background in feature files should only do setup activity and so they should only contain `Given` steps.
|
20
|
+
[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.
|
26
21
|
|
27
|
-
[BackgroundRequiresMultipleScenarios](https://github.com/BillyRuffian/chutney/blob/master/features/background_requires_multiple_scenarios.feature)
|
28
|
-
: If you only have one scenario, don't bother having a Background section.
|
22
|
+
[BackgroundRequiresMultipleScenarios](https://github.com/BillyRuffian/chutney/blob/master/features/background_requires_multiple_scenarios.feature): If you only have one scenario, don't bother having a Background section.
|
29
23
|
|
30
|
-
[BadScenarioName](https://github.com/BillyRuffian/chutney/blob/master/features/bad_scenario_name.feature)
|
31
|
-
: You should avoid using words like 'test' or 'check' in your scenario names, instead you should define the behaviour of your system.
|
24
|
+
[BadScenarioName](https://github.com/BillyRuffian/chutney/blob/master/features/bad_scenario_name.feature): You should avoid using words like 'test' or 'check' in your scenario names, instead you should define the behaviour of your system.
|
32
25
|
|
33
|
-
[EmptyFeatureFile](https://github.com/BillyRuffian/chutney/blob/master/features/empty_feature_file.feature)
|
34
|
-
: The feature should have content and should avoid committing empty features to repositories.
|
26
|
+
[EmptyFeatureFile](https://github.com/BillyRuffian/chutney/blob/master/features/empty_feature_file.feature): The feature should have content and should avoid committing empty features to repositories.
|
35
27
|
|
36
|
-
[FileNameDiffersFeatureName](https://github.com/BillyRuffian/chutney/blob/master/features/file_name_differs_feature_name.feature)
|
37
|
-
: The feature should have a name that follows the file name.
|
28
|
+
[FileNameDiffersFeatureName](https://github.com/BillyRuffian/chutney/blob/master/features/file_name_differs_feature_name.feature): The feature should have a name that follows the file name.
|
38
29
|
|
39
|
-
[GivensAfterBackground](https://github.com/BillyRuffian/chutney/blob/master/features/givens_after_background.feature)
|
40
|
-
: If you have a Background section and your scenario needs more preconditions then it should start immediately with an `And` step and not another `Given`.
|
30
|
+
[GivensAfterBackground](https://github.com/BillyRuffian/chutney/blob/master/features/givens_after_background.feature): If you have a Background section and your scenario needs more preconditions then it should start immediately with an `And` step and not another `Given`.
|
41
31
|
|
42
|
-
[InvalidFileName](https://github.com/BillyRuffian/chutney/blob/master/features/invalid_file_name.feature)
|
43
|
-
: Make sure your file name is in snake case, not mixed case or with spaces.
|
32
|
+
[InvalidFileName](https://github.com/BillyRuffian/chutney/blob/master/features/invalid_file_name.feature): Make sure your file name is in snake case, not mixed case or with spaces.
|
44
33
|
|
45
|
-
[InvalidStepFlow](https://github.com/BillyRuffian/chutney/blob/master/features/invalid_step_flow.feature)
|
46
|
-
: Your scenarios should follow Given → When → Then, in that order.
|
34
|
+
[InvalidStepFlow](https://github.com/BillyRuffian/chutney/blob/master/features/invalid_step_flow.feature): Your scenarios should follow Given → When → Then, in that order.
|
47
35
|
|
48
|
-
[MissingExampleName](https://github.com/BillyRuffian/chutney/blob/master/features/missing_example_name.feature)
|
49
|
-
: If you have more than one example table in your scenario, they should each be given unique names.
|
36
|
+
[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.
|
50
37
|
|
51
|
-
[MissingFeatureDescription](https://github.com/BillyRuffian/chutney/blob/master/features/missing_feature_description.feature)
|
52
|
-
: Your feature should have a value statement. These are usually in the form 'As a... I want.. So that...'.
|
38
|
+
[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...'.
|
53
39
|
|
54
|
-
[MissingFeatureName](https://github.com/BillyRuffian/chutney/blob/master/features/missing_feature_name.feature)
|
55
|
-
: You should give your features a descriptive name.
|
40
|
+
[MissingFeatureName](https://github.com/BillyRuffian/chutney/blob/master/features/missing_feature_name.feature): You should give your features a descriptive name.
|
56
41
|
|
57
|
-
[MissingScenarioName](https://github.com/BillyRuffian/chutney/blob/master/features/missing_scenario_name.feature)
|
58
|
-
: You should name your scenarios and scenario outlines.
|
42
|
+
[MissingScenarioName](https://github.com/BillyRuffian/chutney/blob/master/features/missing_scenario_name.feature): You should name your scenarios and scenario outlines.
|
59
43
|
|
60
|
-
[MissingTestAction](https://github.com/BillyRuffian/chutney/blob/master/features/missing_test_action.feature)
|
61
|
-
: You don't have an action (a `When` step) in your scenario.
|
44
|
+
[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.
|
62
45
|
|
63
|
-
[MissingVerification](https://github.com/BillyRuffian/chutney/blob/master/features/missing_verification.feature)
|
64
|
-
: You don't have a verification step (a `Then` step) in your scenario.
|
46
|
+
[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.
|
65
47
|
|
66
|
-
[RequiredTagsStartWith](https://github.com/BillyRuffian/chutney/blob/master/features/required_tags_starts_with.feature)
|
67
|
-
: Chutney can enforce a configurable naming prefix for your tags.
|
48
|
+
[RequiredTagsStartWith](https://github.com/BillyRuffian/chutney/blob/master/features/required_tags_starts_with.feature): Chutney can enforce a configurable naming prefix for your tags.
|
68
49
|
|
69
|
-
[
|
70
|
-
: You have the same tag for all you scenarios; move the tag to the feature level instead.
|
50
|
+
[SameTagForDifferentCase](https://github.com/BillyRuffian/chutney/blob/master/features/same_tag_different_case.feature): Don't mix the case of tags which have already appeared. Cucumber tags are case sensitive. *Since 3.1.0*
|
71
51
|
|
72
|
-
[
|
73
|
-
: Chutney can enforce a naming convention for your scenario names.
|
52
|
+
[SameTagForAllScenarios](https://github.com/BillyRuffian/chutney/blob/master/features/same_tag_for_all_scenarios.feature): You have the same tag for all you scenarios; move the tag to the feature level instead.
|
74
53
|
|
75
|
-
[
|
76
|
-
: Chutney can warn if you have used a tag a lot with a feature.
|
54
|
+
[ScenarioNamesMatch](https://github.com/BillyRuffian/chutney/blob/master/features/scenario_names_match.feature): Chutney can enforce a naming convention for your scenario names.
|
77
55
|
|
78
|
-
[
|
79
|
-
: This is a very long scenario. Consider writing it more concisely.
|
56
|
+
[TagUsedMultipleTimes](https://github.com/BillyRuffian/chutney/blob/master/features/tag_used_multiple_times.feature): Chutney can warn if you have used a tag a lot with a feature.
|
80
57
|
|
81
|
-
[
|
82
|
-
: This is a very long step. Consider writing it more concisely.
|
58
|
+
[TooClumsy](https://github.com/BillyRuffian/chutney/blob/master/features/too_clumsy.feature): This is a very long scenario. Consider writing it more concisely.
|
83
59
|
|
84
|
-
[
|
85
|
-
: This feature has a lot of different tags.
|
60
|
+
[TooLongStep](https://github.com/BillyRuffian/chutney/blob/master/features/too_long_step.feature): This is a very long step. Consider writing it more concisely.
|
86
61
|
|
87
|
-
[
|
88
|
-
: This feature has a lot of steps. Consider writing it more concisely.
|
62
|
+
[TooManyDifferentTags](https://github.com/BillyRuffian/chutney/blob/master/features/too_many_different_tags.feature): This feature has a lot of different tags.
|
89
63
|
|
90
|
-
[
|
91
|
-
: There are a lot of tags in this feature.
|
64
|
+
[TooManySteps](https://github.com/BillyRuffian/chutney/blob/master/features/too_many_steps.feature): This feature has a lot of steps. Consider writing it more concisely.
|
92
65
|
|
93
|
-
[
|
94
|
-
: You have duplicated a scenario name when they should be unique.
|
66
|
+
[TooManyTags](https://github.com/BillyRuffian/chutney/blob/master/features/too_many_tags.feature): There are a lot of tags in this feature.
|
95
67
|
|
96
|
-
[
|
97
|
-
: You are referencing a variable which doesn't appear to be defined. This is a source of subtle errors.
|
68
|
+
[UniqueScenarioNames](https://github.com/BillyRuffian/chutney/blob/master/features/unique_scenario_names.feature): You have duplicated a scenario name when they should be unique.
|
98
69
|
|
99
|
-
[
|
100
|
-
: You have a variable which you are not using.
|
70
|
+
[UnknownVariable](https://github.com/BillyRuffian/chutney/blob/master/features/unknown_variable.feature): You are referencing a variable which doesn't appear to be defined. This is a source of subtle errors.
|
101
71
|
|
102
|
-
[
|
103
|
-
: You have a setup setup used in all of your scenarios. Move it to a Background section.
|
72
|
+
[UnusedVariable](https://github.com/BillyRuffian/chutney/blob/master/features/unused_variable.feature): You have a variable which you are not using.
|
104
73
|
|
105
|
-
[
|
106
|
-
|
74
|
+
[UseBackground](https://github.com/BillyRuffian/chutney/blob/master/features/use_background.feature): You have a setup setup used in all of your scenarios. Move it to a Background section.
|
75
|
+
|
76
|
+
[UseOutline](https://github.com/BillyRuffian/chutney/blob/master/features/use_outline.feature): You have very similar scenarios. You should consider if they should be combined into a Scenario Outline.
|
data/exe/chutney
CHANGED
@@ -1,4 +1,6 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
2
4
|
require 'chutney'
|
3
5
|
require 'chutney/formatter'
|
4
6
|
require 'chutney/formatter/json_formatter'
|
@@ -10,19 +12,37 @@ formatters = Set.new
|
|
10
12
|
|
11
13
|
OptionParser.new do |opts|
|
12
14
|
opts.banner = 'Usage: chutney [files]'
|
13
|
-
opts.on('-f',
|
14
|
-
'--format [formatter]',
|
15
|
+
opts.on('-f',
|
16
|
+
'--format [formatter]',
|
15
17
|
'One of JSONFormatter, PieFormatter or RainbowFormatter (default).') do |formatter|
|
16
18
|
raise 'No Such Formatter' unless %w[JSONFormatter PieFormatter RainbowFormatter].include? formatter
|
17
19
|
|
18
20
|
formatters << formatter
|
19
21
|
end
|
22
|
+
|
23
|
+
opts.on('-l',
|
24
|
+
'--linters',
|
25
|
+
'List the linter status by this configuration and exit') do
|
26
|
+
pastel = Pastel.new
|
27
|
+
chutney_config = Chutney::ChutneyLint.new.configuration
|
28
|
+
max_name_length = chutney_config.keys.map(&:length).max + 1
|
29
|
+
chutney_config.each do |linter, value|
|
30
|
+
print pastel.cyan(linter.ljust(max_name_length))
|
31
|
+
|
32
|
+
if value['Enabled']
|
33
|
+
puts pastel.green('enabled')
|
34
|
+
else
|
35
|
+
puts pastel.red('disabled')
|
36
|
+
end
|
37
|
+
end
|
38
|
+
exit
|
39
|
+
end
|
20
40
|
end.parse!
|
21
41
|
|
22
42
|
formatters << 'RainbowFormatter' if formatters.empty?
|
23
43
|
|
24
44
|
files = ARGV.map { |pattern| Dir.glob(pattern) }.flatten
|
25
|
-
files = Dir.glob('features/**/*.feature') if ARGV.empty?
|
45
|
+
files = Dir.glob('features/**/*.feature') if ARGV.empty?
|
26
46
|
|
27
47
|
linter = Chutney::ChutneyLint.new(*files)
|
28
48
|
report = linter.analyse
|
data/lib/chutney.rb
CHANGED
@@ -1,4 +1,7 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'amatch'
|
4
|
+
|
2
5
|
require 'chutney/configuration'
|
3
6
|
require 'chutney/linter'
|
4
7
|
require 'chutney/linter/avoid_full_stop'
|
@@ -20,6 +23,7 @@ require 'chutney/linter/missing_scenario_name'
|
|
20
23
|
require 'chutney/linter/missing_test_action'
|
21
24
|
require 'chutney/linter/missing_verification'
|
22
25
|
require 'chutney/linter/required_tags_starts_with'
|
26
|
+
require 'chutney/linter/same_tag_different_case'
|
23
27
|
require 'chutney/linter/same_tag_for_all_scenarios'
|
24
28
|
require 'chutney/linter/scenario_names_match'
|
25
29
|
require 'chutney/linter/tag_used_multiple_times'
|
@@ -33,9 +37,12 @@ require 'chutney/linter/unknown_variable'
|
|
33
37
|
require 'chutney/linter/unused_variable'
|
34
38
|
require 'chutney/linter/use_background'
|
35
39
|
require 'chutney/linter/use_outline'
|
40
|
+
require 'chutney/version'
|
41
|
+
|
42
|
+
require 'cuke_modeler'
|
36
43
|
require 'forwardable'
|
37
|
-
require 'gherkin/dialect'
|
38
|
-
require 'gherkin/parser'
|
44
|
+
# require 'gherkin/dialect'
|
45
|
+
# require 'gherkin/parser'
|
39
46
|
require 'i18n'
|
40
47
|
require 'set'
|
41
48
|
require 'yaml'
|
@@ -45,8 +52,7 @@ module Chutney
|
|
45
52
|
class ChutneyLint
|
46
53
|
extend Forwardable
|
47
54
|
attr_accessor :verbose
|
48
|
-
attr_reader :files
|
49
|
-
attr_reader :results
|
55
|
+
attr_reader :files, :results
|
50
56
|
|
51
57
|
def_delegators :@files, :<<, :clear, :delete, :include?
|
52
58
|
|
@@ -54,14 +60,18 @@ module Chutney
|
|
54
60
|
@files = files
|
55
61
|
@results = Hash.new { |h, k| h[k] = [] }
|
56
62
|
i18n_paths = Dir[File.expand_path(File.join(__dir__, 'config/locales')) + '/*.yml']
|
57
|
-
return if I18n.load_path.include?(i18n_paths)
|
58
63
|
|
59
|
-
|
64
|
+
i18n_paths.each do |path|
|
65
|
+
next if I18n.load_path.include?(path)
|
66
|
+
|
67
|
+
I18n.load_path << path
|
68
|
+
I18n.backend.reload!
|
69
|
+
end
|
60
70
|
end
|
61
71
|
|
62
72
|
def configuration
|
63
73
|
unless @config
|
64
|
-
default_file = [File.expand_path('..', __dir__), '**/config', '
|
74
|
+
default_file = [File.expand_path('..', __dir__), '**/config', 'chutney_defaults.yml']
|
65
75
|
config_file = Dir.glob(File.join(default_file)).first.freeze
|
66
76
|
@config = Configuration.new(config_file)
|
67
77
|
end
|
@@ -92,14 +102,8 @@ module Chutney
|
|
92
102
|
|
93
103
|
private
|
94
104
|
|
95
|
-
def parse(text)
|
96
|
-
@parser ||= Gherkin::Parser.new
|
97
|
-
scanner = Gherkin::TokenScanner.new(text)
|
98
|
-
@parser.parse(scanner)
|
99
|
-
end
|
100
|
-
|
101
105
|
def lint(file)
|
102
|
-
parsed =
|
106
|
+
parsed = CukeModeler::FeatureFile.new(file)
|
103
107
|
linters.each do |linter_class|
|
104
108
|
linter = linter_class.new(file, parsed, configuration[linter_class.linter_name])
|
105
109
|
linter.lint
|