cuke_linter 1.3.0 → 1.4.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/CHANGELOG.md +217 -211
- data/LICENSE.txt +21 -21
- data/README.md +160 -160
- data/cuke_linter.gemspec +59 -58
- data/exe/cuke_linter +112 -112
- data/lib/cuke_linter/configuration.rb +45 -45
- data/lib/cuke_linter/default_linters.rb +32 -32
- data/lib/cuke_linter/formatters/pretty_formatter.rb +84 -84
- data/lib/cuke_linter/gherkin.rb +10 -10
- data/lib/cuke_linter/linter_registration.rb +32 -32
- data/lib/cuke_linter/linters/background_does_more_than_setup_linter.rb +35 -35
- data/lib/cuke_linter/linters/element_with_common_tags_linter.rb +49 -49
- data/lib/cuke_linter/linters/element_with_duplicate_tags_linter.rb +48 -48
- data/lib/cuke_linter/linters/element_with_too_many_tags_linter.rb +46 -46
- data/lib/cuke_linter/linters/example_without_name_linter.rb +19 -19
- data/lib/cuke_linter/linters/feature_file_with_invalid_name_linter.rb +20 -20
- data/lib/cuke_linter/linters/feature_file_with_mismatched_name_linter.rb +25 -25
- data/lib/cuke_linter/linters/feature_with_too_many_different_tags_linter.rb +35 -35
- data/lib/cuke_linter/linters/feature_without_description_linter.rb +19 -19
- data/lib/cuke_linter/linters/feature_without_name_linter.rb +19 -19
- data/lib/cuke_linter/linters/feature_without_scenarios_linter.rb +23 -23
- data/lib/cuke_linter/linters/linter.rb +42 -42
- data/lib/cuke_linter/linters/outline_with_single_example_row_linter.rb +22 -22
- data/lib/cuke_linter/linters/single_test_background_linter.rb +19 -19
- data/lib/cuke_linter/linters/step_with_end_period_linter.rb +19 -19
- data/lib/cuke_linter/linters/step_with_too_many_characters_linter.rb +38 -38
- data/lib/cuke_linter/linters/test_name_with_too_many_characters_linter.rb +38 -38
- data/lib/cuke_linter/linters/test_should_use_background_linter.rb +80 -80
- data/lib/cuke_linter/linters/test_with_action_step_as_final_step_linter.rb +33 -33
- data/lib/cuke_linter/linters/test_with_bad_name_linter.rb +23 -23
- data/lib/cuke_linter/linters/test_with_no_action_step_linter.rb +33 -33
- data/lib/cuke_linter/linters/test_with_no_name_linter.rb +19 -19
- data/lib/cuke_linter/linters/test_with_no_verification_step_linter.rb +33 -33
- data/lib/cuke_linter/linters/test_with_setup_step_after_action_step_linter.rb +46 -46
- data/lib/cuke_linter/linters/test_with_setup_step_after_verification_step_linter.rb +46 -46
- data/lib/cuke_linter/linters/test_with_setup_step_as_final_step_linter.rb +33 -33
- data/lib/cuke_linter/linters/test_with_too_many_steps_linter.rb +27 -27
- data/lib/cuke_linter/version.rb +4 -4
- data/lib/cuke_linter.rb +196 -196
- data/testing/cucumber/features/command_line.feature +202 -202
- data/testing/cucumber/features/configuration/configuring_linters.feature +58 -58
- data/testing/cucumber/features/configuration/locally_scoping_linters.feature +55 -55
- data/testing/cucumber/features/configuration/using_configurations.feature +41 -41
- data/testing/cucumber/features/custom_linters.feature +56 -56
- data/testing/cucumber/features/default_linters.feature +57 -57
- data/testing/cucumber/features/formatters/pretty_formatter.feature +26 -26
- data/testing/cucumber/features/linters/background_does_more_than_setup.feature +84 -84
- data/testing/cucumber/features/linters/element_with_common_tags.feature +28 -28
- data/testing/cucumber/features/linters/element_with_duplicate_tags.feature +71 -71
- data/testing/cucumber/features/linters/element_with_too_many_tags.feature +70 -70
- data/testing/cucumber/features/linters/example_without_name.feature +34 -34
- data/testing/cucumber/features/linters/feature_file_with_invalid_name.feature +20 -20
- data/testing/cucumber/features/linters/feature_file_with_mismatched_name.feature +32 -32
- data/testing/cucumber/features/linters/feature_with_too_many_different_tags.feature +56 -56
- data/testing/cucumber/features/linters/feature_without_description.feature +17 -17
- data/testing/cucumber/features/linters/feature_without_name.feature +18 -18
- data/testing/cucumber/features/linters/feature_without_scenarios.feature +39 -39
- data/testing/cucumber/features/linters/outline_with_single_example_row.feature +23 -23
- data/testing/cucumber/features/linters/single_test_background.feature +24 -24
- data/testing/cucumber/features/linters/step_too_long.feature +43 -43
- data/testing/cucumber/features/linters/step_with_end_period.feature +21 -21
- data/testing/cucumber/features/linters/test_name_too_long.feature +41 -41
- data/testing/cucumber/features/linters/test_should_use_background.feature +29 -29
- data/testing/cucumber/features/linters/test_with_action_as_final_step.feature +50 -50
- data/testing/cucumber/features/linters/test_with_bad_name.feature +29 -29
- data/testing/cucumber/features/linters/test_with_no_action_step.feature +56 -56
- data/testing/cucumber/features/linters/test_with_no_name.feature +23 -23
- data/testing/cucumber/features/linters/test_with_no_verification_step.feature +58 -58
- data/testing/cucumber/features/linters/test_with_setup_step_after_action_step.feature +57 -57
- data/testing/cucumber/features/linters/test_with_setup_step_after_verification_step.feature +57 -57
- data/testing/cucumber/features/linters/test_with_setup_step_as_final_step.feature +50 -50
- data/testing/cucumber/features/linters/test_with_too_many_steps.feature +61 -61
- metadata +21 -25
- data/testing/cucumber/features/linters/rule_without_name.feature +0 -18
|
@@ -1,71 +1,71 @@
|
|
|
1
|
-
Feature: Element with duplicate tags linter
|
|
2
|
-
|
|
3
|
-
As a writer of documentation
|
|
4
|
-
I want taggable elements to not have duplicate of tags
|
|
5
|
-
So that redundancy is minimized
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
Scenario: Linting
|
|
9
|
-
|
|
10
|
-
Note: Also works on outlines, features, and examples
|
|
11
|
-
|
|
12
|
-
Given a linter for elements with duplicate tags
|
|
13
|
-
And the following feature:
|
|
14
|
-
"""
|
|
15
|
-
Feature:
|
|
16
|
-
|
|
17
|
-
@same_tag @a_different_tag @same_tag
|
|
18
|
-
Scenario:
|
|
19
|
-
* a step
|
|
20
|
-
"""
|
|
21
|
-
When it is linted
|
|
22
|
-
Then an error is reported:
|
|
23
|
-
| linter | problem | location |
|
|
24
|
-
| ElementWithDuplicateTagsLinter | Scenario has duplicate tag '@same_tag'. | <path_to_file>:4 |
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
Scenario: Configuration of indirect tag inclusion (turned off)
|
|
28
|
-
|
|
29
|
-
Note: Tags inherited from other elements are not included by default
|
|
30
|
-
|
|
31
|
-
Given a linter for elements with duplicate tags has been registered
|
|
32
|
-
And the following configuration file:
|
|
33
|
-
"""
|
|
34
|
-
ElementWithDuplicateTagsLinter:
|
|
35
|
-
IncludeInheritedTags: false
|
|
36
|
-
"""
|
|
37
|
-
And the following feature:
|
|
38
|
-
"""
|
|
39
|
-
@same_tag
|
|
40
|
-
Feature:
|
|
41
|
-
|
|
42
|
-
@same_tag
|
|
43
|
-
Scenario:
|
|
44
|
-
* a step
|
|
45
|
-
"""
|
|
46
|
-
When the configuration file is loaded
|
|
47
|
-
And it is linted
|
|
48
|
-
Then no error is reported
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
Scenario: Configuration of indirect tag inclusion (turned on)
|
|
52
|
-
Given a linter for elements with duplicate tags has been registered
|
|
53
|
-
And the following configuration file:
|
|
54
|
-
"""
|
|
55
|
-
ElementWithDuplicateTagsLinter:
|
|
56
|
-
IncludeInheritedTags: true
|
|
57
|
-
"""
|
|
58
|
-
And the following feature:
|
|
59
|
-
"""
|
|
60
|
-
@same_tag
|
|
61
|
-
Feature:
|
|
62
|
-
|
|
63
|
-
@same_tag
|
|
64
|
-
Scenario:
|
|
65
|
-
* a step
|
|
66
|
-
"""
|
|
67
|
-
When the configuration file is loaded
|
|
68
|
-
And it is linted
|
|
69
|
-
Then an error is reported:
|
|
70
|
-
| linter | problem | location |
|
|
71
|
-
| ElementWithDuplicateTagsLinter | Scenario has duplicate tag '@same_tag'. | <path_to_file>:5 |
|
|
1
|
+
Feature: Element with duplicate tags linter
|
|
2
|
+
|
|
3
|
+
As a writer of documentation
|
|
4
|
+
I want taggable elements to not have duplicate of tags
|
|
5
|
+
So that redundancy is minimized
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
Scenario: Linting
|
|
9
|
+
|
|
10
|
+
Note: Also works on outlines, features, and examples
|
|
11
|
+
|
|
12
|
+
Given a linter for elements with duplicate tags
|
|
13
|
+
And the following feature:
|
|
14
|
+
"""
|
|
15
|
+
Feature:
|
|
16
|
+
|
|
17
|
+
@same_tag @a_different_tag @same_tag
|
|
18
|
+
Scenario:
|
|
19
|
+
* a step
|
|
20
|
+
"""
|
|
21
|
+
When it is linted
|
|
22
|
+
Then an error is reported:
|
|
23
|
+
| linter | problem | location |
|
|
24
|
+
| ElementWithDuplicateTagsLinter | Scenario has duplicate tag '@same_tag'. | <path_to_file>:4 |
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
Scenario: Configuration of indirect tag inclusion (turned off)
|
|
28
|
+
|
|
29
|
+
Note: Tags inherited from other elements are not included by default
|
|
30
|
+
|
|
31
|
+
Given a linter for elements with duplicate tags has been registered
|
|
32
|
+
And the following configuration file:
|
|
33
|
+
"""
|
|
34
|
+
ElementWithDuplicateTagsLinter:
|
|
35
|
+
IncludeInheritedTags: false
|
|
36
|
+
"""
|
|
37
|
+
And the following feature:
|
|
38
|
+
"""
|
|
39
|
+
@same_tag
|
|
40
|
+
Feature:
|
|
41
|
+
|
|
42
|
+
@same_tag
|
|
43
|
+
Scenario:
|
|
44
|
+
* a step
|
|
45
|
+
"""
|
|
46
|
+
When the configuration file is loaded
|
|
47
|
+
And it is linted
|
|
48
|
+
Then no error is reported
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
Scenario: Configuration of indirect tag inclusion (turned on)
|
|
52
|
+
Given a linter for elements with duplicate tags has been registered
|
|
53
|
+
And the following configuration file:
|
|
54
|
+
"""
|
|
55
|
+
ElementWithDuplicateTagsLinter:
|
|
56
|
+
IncludeInheritedTags: true
|
|
57
|
+
"""
|
|
58
|
+
And the following feature:
|
|
59
|
+
"""
|
|
60
|
+
@same_tag
|
|
61
|
+
Feature:
|
|
62
|
+
|
|
63
|
+
@same_tag
|
|
64
|
+
Scenario:
|
|
65
|
+
* a step
|
|
66
|
+
"""
|
|
67
|
+
When the configuration file is loaded
|
|
68
|
+
And it is linted
|
|
69
|
+
Then an error is reported:
|
|
70
|
+
| linter | problem | location |
|
|
71
|
+
| ElementWithDuplicateTagsLinter | Scenario has duplicate tag '@same_tag'. | <path_to_file>:5 |
|
|
@@ -1,70 +1,70 @@
|
|
|
1
|
-
Feature: Element with too many tags linter
|
|
2
|
-
|
|
3
|
-
As a reader of documentation
|
|
4
|
-
I want taggable elements to not have an overabundance of tags
|
|
5
|
-
So that I can concentrate on the content of the scenario
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
Scenario: Linting
|
|
9
|
-
|
|
10
|
-
Note: Also works on outlines, features, and examples
|
|
11
|
-
Note: Tags inherited from other elements are not counted by default (see configuration options below)
|
|
12
|
-
|
|
13
|
-
Given a linter for elements with too many tags
|
|
14
|
-
And the following feature:
|
|
15
|
-
"""
|
|
16
|
-
@this_tag_not_counted
|
|
17
|
-
Feature:
|
|
18
|
-
|
|
19
|
-
@tag_1 @tag_2 @tag_3 @tag_4 @tag_5 @tag_one_too_many
|
|
20
|
-
Scenario:
|
|
21
|
-
* a step
|
|
22
|
-
"""
|
|
23
|
-
When it is linted
|
|
24
|
-
Then an error is reported:
|
|
25
|
-
| linter | problem | location |
|
|
26
|
-
| ElementWithTooManyTagsLinter | Scenario has too many tags. 6 tags found (max 5). | <path_to_file>:5 |
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
Scenario: Configuration of tag count threshold
|
|
30
|
-
Given a linter for elements with too many tags has been registered
|
|
31
|
-
And the following configuration file:
|
|
32
|
-
"""
|
|
33
|
-
ElementWithTooManyTagsLinter:
|
|
34
|
-
TagCountThreshold: 3
|
|
35
|
-
"""
|
|
36
|
-
And the following feature:
|
|
37
|
-
"""
|
|
38
|
-
Feature:
|
|
39
|
-
|
|
40
|
-
@tag_1 @tag_2 @tag_3 @tag_one_too_many
|
|
41
|
-
Scenario:
|
|
42
|
-
* a step
|
|
43
|
-
"""
|
|
44
|
-
When the configuration file is loaded
|
|
45
|
-
And it is linted
|
|
46
|
-
Then an error is reported:
|
|
47
|
-
| linter | problem | location |
|
|
48
|
-
| ElementWithTooManyTagsLinter | Scenario has too many tags. 4 tags found (max 3). | <path_to_file>:4 |
|
|
49
|
-
|
|
50
|
-
Scenario: Configuration of indirect tag count
|
|
51
|
-
Given a linter for elements with too many tags has been registered
|
|
52
|
-
And the following configuration file:
|
|
53
|
-
"""
|
|
54
|
-
ElementWithTooManyTagsLinter:
|
|
55
|
-
CountInheritedTags: true
|
|
56
|
-
"""
|
|
57
|
-
And the following feature:
|
|
58
|
-
"""
|
|
59
|
-
@this_tag_is_also_counted
|
|
60
|
-
Feature:
|
|
61
|
-
|
|
62
|
-
@tag_1 @tag_2 @tag_3 @tag_4 @tag_one_too_many
|
|
63
|
-
Scenario:
|
|
64
|
-
* a step
|
|
65
|
-
"""
|
|
66
|
-
When the configuration file is loaded
|
|
67
|
-
And it is linted
|
|
68
|
-
Then an error is reported:
|
|
69
|
-
| linter | problem | location |
|
|
70
|
-
| ElementWithTooManyTagsLinter | Scenario has too many tags. 6 tags found (max 5). | <path_to_file>:5 |
|
|
1
|
+
Feature: Element with too many tags linter
|
|
2
|
+
|
|
3
|
+
As a reader of documentation
|
|
4
|
+
I want taggable elements to not have an overabundance of tags
|
|
5
|
+
So that I can concentrate on the content of the scenario
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
Scenario: Linting
|
|
9
|
+
|
|
10
|
+
Note: Also works on outlines, features, and examples
|
|
11
|
+
Note: Tags inherited from other elements are not counted by default (see configuration options below)
|
|
12
|
+
|
|
13
|
+
Given a linter for elements with too many tags
|
|
14
|
+
And the following feature:
|
|
15
|
+
"""
|
|
16
|
+
@this_tag_not_counted
|
|
17
|
+
Feature:
|
|
18
|
+
|
|
19
|
+
@tag_1 @tag_2 @tag_3 @tag_4 @tag_5 @tag_one_too_many
|
|
20
|
+
Scenario:
|
|
21
|
+
* a step
|
|
22
|
+
"""
|
|
23
|
+
When it is linted
|
|
24
|
+
Then an error is reported:
|
|
25
|
+
| linter | problem | location |
|
|
26
|
+
| ElementWithTooManyTagsLinter | Scenario has too many tags. 6 tags found (max 5). | <path_to_file>:5 |
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
Scenario: Configuration of tag count threshold
|
|
30
|
+
Given a linter for elements with too many tags has been registered
|
|
31
|
+
And the following configuration file:
|
|
32
|
+
"""
|
|
33
|
+
ElementWithTooManyTagsLinter:
|
|
34
|
+
TagCountThreshold: 3
|
|
35
|
+
"""
|
|
36
|
+
And the following feature:
|
|
37
|
+
"""
|
|
38
|
+
Feature:
|
|
39
|
+
|
|
40
|
+
@tag_1 @tag_2 @tag_3 @tag_one_too_many
|
|
41
|
+
Scenario:
|
|
42
|
+
* a step
|
|
43
|
+
"""
|
|
44
|
+
When the configuration file is loaded
|
|
45
|
+
And it is linted
|
|
46
|
+
Then an error is reported:
|
|
47
|
+
| linter | problem | location |
|
|
48
|
+
| ElementWithTooManyTagsLinter | Scenario has too many tags. 4 tags found (max 3). | <path_to_file>:4 |
|
|
49
|
+
|
|
50
|
+
Scenario: Configuration of indirect tag count
|
|
51
|
+
Given a linter for elements with too many tags has been registered
|
|
52
|
+
And the following configuration file:
|
|
53
|
+
"""
|
|
54
|
+
ElementWithTooManyTagsLinter:
|
|
55
|
+
CountInheritedTags: true
|
|
56
|
+
"""
|
|
57
|
+
And the following feature:
|
|
58
|
+
"""
|
|
59
|
+
@this_tag_is_also_counted
|
|
60
|
+
Feature:
|
|
61
|
+
|
|
62
|
+
@tag_1 @tag_2 @tag_3 @tag_4 @tag_one_too_many
|
|
63
|
+
Scenario:
|
|
64
|
+
* a step
|
|
65
|
+
"""
|
|
66
|
+
When the configuration file is loaded
|
|
67
|
+
And it is linted
|
|
68
|
+
Then an error is reported:
|
|
69
|
+
| linter | problem | location |
|
|
70
|
+
| ElementWithTooManyTagsLinter | Scenario has too many tags. 6 tags found (max 5). | <path_to_file>:5 |
|
|
@@ -1,34 +1,34 @@
|
|
|
1
|
-
Feature: Example without name linter
|
|
2
|
-
|
|
3
|
-
As a reader of documentation
|
|
4
|
-
I want every example grouping to have a name
|
|
5
|
-
So that I can understand the significance of the example data
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
Scenario: Linting
|
|
9
|
-
Given a linter for examples without names
|
|
10
|
-
And the following feature:
|
|
11
|
-
"""
|
|
12
|
-
Feature:
|
|
13
|
-
|
|
14
|
-
Scenario Outline:
|
|
15
|
-
* a step
|
|
16
|
-
|
|
17
|
-
Examples: Happy paths!
|
|
18
|
-
| param |
|
|
19
|
-
| value |
|
|
20
|
-
|
|
21
|
-
# Unknown paths :(
|
|
22
|
-
Examples:
|
|
23
|
-
| param |
|
|
24
|
-
| value |
|
|
25
|
-
"""
|
|
26
|
-
When it is linted
|
|
27
|
-
Then an error is reported:
|
|
28
|
-
| linter | problem | location |
|
|
29
|
-
| ExampleWithoutNameLinter | Example grouping has no name | <path_to_file>:11 |
|
|
30
|
-
|
|
31
|
-
@wip
|
|
32
|
-
Scenario: Configuration
|
|
33
|
-
|
|
34
|
-
Ideas: Configure whether or not the linter triggers on outline with only one Example set?
|
|
1
|
+
Feature: Example without name linter
|
|
2
|
+
|
|
3
|
+
As a reader of documentation
|
|
4
|
+
I want every example grouping to have a name
|
|
5
|
+
So that I can understand the significance of the example data
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
Scenario: Linting
|
|
9
|
+
Given a linter for examples without names
|
|
10
|
+
And the following feature:
|
|
11
|
+
"""
|
|
12
|
+
Feature:
|
|
13
|
+
|
|
14
|
+
Scenario Outline:
|
|
15
|
+
* a step
|
|
16
|
+
|
|
17
|
+
Examples: Happy paths!
|
|
18
|
+
| param |
|
|
19
|
+
| value |
|
|
20
|
+
|
|
21
|
+
# Unknown paths :(
|
|
22
|
+
Examples:
|
|
23
|
+
| param |
|
|
24
|
+
| value |
|
|
25
|
+
"""
|
|
26
|
+
When it is linted
|
|
27
|
+
Then an error is reported:
|
|
28
|
+
| linter | problem | location |
|
|
29
|
+
| ExampleWithoutNameLinter | Example grouping has no name | <path_to_file>:11 |
|
|
30
|
+
|
|
31
|
+
@wip
|
|
32
|
+
Scenario: Configuration
|
|
33
|
+
|
|
34
|
+
Ideas: Configure whether or not the linter triggers on outline with only one Example set?
|
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
Feature: Feature file with invalid name linter
|
|
2
|
-
|
|
3
|
-
As a writer of documentation
|
|
4
|
-
I want to be warned about invalid file names
|
|
5
|
-
so that I name all features consistently
|
|
6
|
-
|
|
7
|
-
Scenario Outline: Linting
|
|
8
|
-
Given a feature file model named "<name>.feature"
|
|
9
|
-
And a linter for features with invalid file names
|
|
10
|
-
When it is linted
|
|
11
|
-
Then an error is reported:
|
|
12
|
-
| linter | problem | location |
|
|
13
|
-
| FeatureFileWithInvalidNameLinter | Feature files should be snake_cased. | <path_to_file> |
|
|
14
|
-
|
|
15
|
-
Examples: Invalid Names
|
|
16
|
-
| name |
|
|
17
|
-
| Lint |
|
|
18
|
-
| lintMe |
|
|
19
|
-
| lint me |
|
|
20
|
-
| lint-me |
|
|
1
|
+
Feature: Feature file with invalid name linter
|
|
2
|
+
|
|
3
|
+
As a writer of documentation
|
|
4
|
+
I want to be warned about invalid file names
|
|
5
|
+
so that I name all features consistently
|
|
6
|
+
|
|
7
|
+
Scenario Outline: Linting
|
|
8
|
+
Given a feature file model named "<name>.feature"
|
|
9
|
+
And a linter for features with invalid file names
|
|
10
|
+
When it is linted
|
|
11
|
+
Then an error is reported:
|
|
12
|
+
| linter | problem | location |
|
|
13
|
+
| FeatureFileWithInvalidNameLinter | Feature files should be snake_cased. | <path_to_file> |
|
|
14
|
+
|
|
15
|
+
Examples: Invalid Names
|
|
16
|
+
| name |
|
|
17
|
+
| Lint |
|
|
18
|
+
| lintMe |
|
|
19
|
+
| lint me |
|
|
20
|
+
| lint-me |
|
|
@@ -1,32 +1,32 @@
|
|
|
1
|
-
Feature: Feature file with mismatched name linter
|
|
2
|
-
|
|
3
|
-
As a reader of documentation
|
|
4
|
-
I want file names to match their features
|
|
5
|
-
so that I can tell what a file is about by reading the name
|
|
6
|
-
|
|
7
|
-
Scenario: Linting files with mismatched names
|
|
8
|
-
Given a feature file model based on the file "some_name" with the following text:
|
|
9
|
-
"""
|
|
10
|
-
Feature: Some different name
|
|
11
|
-
"""
|
|
12
|
-
And a linter for features with mismatched file names
|
|
13
|
-
When it is linted
|
|
14
|
-
Then an error is reported:
|
|
15
|
-
| linter | problem | location |
|
|
16
|
-
| FeatureFileWithMismatchedNameLinter | Feature file name does not match feature name. | <path_to_file> |
|
|
17
|
-
|
|
18
|
-
Scenario Outline: Linting files with matching names
|
|
19
|
-
Given a feature file model based on the file "<file name>" with the following text:
|
|
20
|
-
"""
|
|
21
|
-
Feature: <feature name>
|
|
22
|
-
"""
|
|
23
|
-
And a linter for features with mismatched file names
|
|
24
|
-
When it is linted
|
|
25
|
-
Then no error is reported
|
|
26
|
-
|
|
27
|
-
Examples:
|
|
28
|
-
| file name | feature name |
|
|
29
|
-
| name_with_underscores | Name with_underscores |
|
|
30
|
-
| name with spaces | Name with spaces |
|
|
31
|
-
| NameWithCaps | Name with Caps |
|
|
32
|
-
| name-with-hyphens | Name with-hyphens |
|
|
1
|
+
Feature: Feature file with mismatched name linter
|
|
2
|
+
|
|
3
|
+
As a reader of documentation
|
|
4
|
+
I want file names to match their features
|
|
5
|
+
so that I can tell what a file is about by reading the name
|
|
6
|
+
|
|
7
|
+
Scenario: Linting files with mismatched names
|
|
8
|
+
Given a feature file model based on the file "some_name" with the following text:
|
|
9
|
+
"""
|
|
10
|
+
Feature: Some different name
|
|
11
|
+
"""
|
|
12
|
+
And a linter for features with mismatched file names
|
|
13
|
+
When it is linted
|
|
14
|
+
Then an error is reported:
|
|
15
|
+
| linter | problem | location |
|
|
16
|
+
| FeatureFileWithMismatchedNameLinter | Feature file name does not match feature name. | <path_to_file> |
|
|
17
|
+
|
|
18
|
+
Scenario Outline: Linting files with matching names
|
|
19
|
+
Given a feature file model based on the file "<file name>" with the following text:
|
|
20
|
+
"""
|
|
21
|
+
Feature: <feature name>
|
|
22
|
+
"""
|
|
23
|
+
And a linter for features with mismatched file names
|
|
24
|
+
When it is linted
|
|
25
|
+
Then no error is reported
|
|
26
|
+
|
|
27
|
+
Examples:
|
|
28
|
+
| file name | feature name |
|
|
29
|
+
| name_with_underscores | Name with_underscores |
|
|
30
|
+
| name with spaces | Name with spaces |
|
|
31
|
+
| NameWithCaps | Name with Caps |
|
|
32
|
+
| name-with-hyphens | Name with-hyphens |
|
|
@@ -1,56 +1,56 @@
|
|
|
1
|
-
Feature: Feature with too many different tags linter
|
|
2
|
-
|
|
3
|
-
As a writer of documentation
|
|
4
|
-
I want features to not contain too many different tags
|
|
5
|
-
So that readers do not need to know too many different contexts
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
Scenario: Linting
|
|
9
|
-
Given a linter for features with too many different tags
|
|
10
|
-
And the following feature:
|
|
11
|
-
"""
|
|
12
|
-
# Total tag count doesn't matter. The count of unique tags is what matters.
|
|
13
|
-
@tag_A @tag_A @tag_A @tag_A
|
|
14
|
-
Feature:
|
|
15
|
-
|
|
16
|
-
@tag_B @tag_C
|
|
17
|
-
Scenario:
|
|
18
|
-
* a step
|
|
19
|
-
|
|
20
|
-
@tag_D @tag_E @tag_F @tag_G
|
|
21
|
-
Scenario:
|
|
22
|
-
* a step
|
|
23
|
-
|
|
24
|
-
@tag_H @tag_I @tag_J
|
|
25
|
-
Scenario:
|
|
26
|
-
* a step
|
|
27
|
-
|
|
28
|
-
@K
|
|
29
|
-
Scenario:
|
|
30
|
-
* a step
|
|
31
|
-
"""
|
|
32
|
-
When it is linted
|
|
33
|
-
Then an error is reported:
|
|
34
|
-
| linter | problem | location |
|
|
35
|
-
| FeatureWithTooManyDifferentTagsLinter | Feature contains too many different tags. 11 tags found (max 10). | <path_to_file>:3 |
|
|
36
|
-
|
|
37
|
-
Scenario: Configuration of tag count threshold
|
|
38
|
-
Given a linter for features with too many different tags has been registered
|
|
39
|
-
And the following configuration file:
|
|
40
|
-
"""
|
|
41
|
-
FeatureWithTooManyDifferentTagsLinter:
|
|
42
|
-
TagCountThreshold: 2
|
|
43
|
-
"""
|
|
44
|
-
And the following feature:
|
|
45
|
-
"""
|
|
46
|
-
@tag_A @tag_B @tag_C
|
|
47
|
-
Feature:
|
|
48
|
-
|
|
49
|
-
Scenario:
|
|
50
|
-
* a step
|
|
51
|
-
"""
|
|
52
|
-
When the configuration file is loaded
|
|
53
|
-
And it is linted
|
|
54
|
-
Then an error is reported:
|
|
55
|
-
| linter | problem | location |
|
|
56
|
-
| FeatureWithTooManyDifferentTagsLinter | Feature contains too many different tags. 3 tags found (max 2). | <path_to_file>:2 |
|
|
1
|
+
Feature: Feature with too many different tags linter
|
|
2
|
+
|
|
3
|
+
As a writer of documentation
|
|
4
|
+
I want features to not contain too many different tags
|
|
5
|
+
So that readers do not need to know too many different contexts
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
Scenario: Linting
|
|
9
|
+
Given a linter for features with too many different tags
|
|
10
|
+
And the following feature:
|
|
11
|
+
"""
|
|
12
|
+
# Total tag count doesn't matter. The count of unique tags is what matters.
|
|
13
|
+
@tag_A @tag_A @tag_A @tag_A
|
|
14
|
+
Feature:
|
|
15
|
+
|
|
16
|
+
@tag_B @tag_C
|
|
17
|
+
Scenario:
|
|
18
|
+
* a step
|
|
19
|
+
|
|
20
|
+
@tag_D @tag_E @tag_F @tag_G
|
|
21
|
+
Scenario:
|
|
22
|
+
* a step
|
|
23
|
+
|
|
24
|
+
@tag_H @tag_I @tag_J
|
|
25
|
+
Scenario:
|
|
26
|
+
* a step
|
|
27
|
+
|
|
28
|
+
@K
|
|
29
|
+
Scenario:
|
|
30
|
+
* a step
|
|
31
|
+
"""
|
|
32
|
+
When it is linted
|
|
33
|
+
Then an error is reported:
|
|
34
|
+
| linter | problem | location |
|
|
35
|
+
| FeatureWithTooManyDifferentTagsLinter | Feature contains too many different tags. 11 tags found (max 10). | <path_to_file>:3 |
|
|
36
|
+
|
|
37
|
+
Scenario: Configuration of tag count threshold
|
|
38
|
+
Given a linter for features with too many different tags has been registered
|
|
39
|
+
And the following configuration file:
|
|
40
|
+
"""
|
|
41
|
+
FeatureWithTooManyDifferentTagsLinter:
|
|
42
|
+
TagCountThreshold: 2
|
|
43
|
+
"""
|
|
44
|
+
And the following feature:
|
|
45
|
+
"""
|
|
46
|
+
@tag_A @tag_B @tag_C
|
|
47
|
+
Feature:
|
|
48
|
+
|
|
49
|
+
Scenario:
|
|
50
|
+
* a step
|
|
51
|
+
"""
|
|
52
|
+
When the configuration file is loaded
|
|
53
|
+
And it is linted
|
|
54
|
+
Then an error is reported:
|
|
55
|
+
| linter | problem | location |
|
|
56
|
+
| FeatureWithTooManyDifferentTagsLinter | Feature contains too many different tags. 3 tags found (max 2). | <path_to_file>:2 |
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
Feature: Feature without description linter
|
|
2
|
-
|
|
3
|
-
As a writer of documentation
|
|
4
|
-
I want features to have a description
|
|
5
|
-
So that I do not have incomplete documentation
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
Scenario: Linting
|
|
9
|
-
Given a linter for features without a description
|
|
10
|
-
And the following feature:
|
|
11
|
-
"""
|
|
12
|
-
Feature: Features must have a description
|
|
13
|
-
"""
|
|
14
|
-
When it is linted
|
|
15
|
-
Then an error is reported:
|
|
16
|
-
| linter | problem | location |
|
|
17
|
-
| FeatureWithoutDescriptionLinter | Feature has no description | <path_to_file>:1 |
|
|
1
|
+
Feature: Feature without description linter
|
|
2
|
+
|
|
3
|
+
As a writer of documentation
|
|
4
|
+
I want features to have a description
|
|
5
|
+
So that I do not have incomplete documentation
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
Scenario: Linting
|
|
9
|
+
Given a linter for features without a description
|
|
10
|
+
And the following feature:
|
|
11
|
+
"""
|
|
12
|
+
Feature: Features must have a description
|
|
13
|
+
"""
|
|
14
|
+
When it is linted
|
|
15
|
+
Then an error is reported:
|
|
16
|
+
| linter | problem | location |
|
|
17
|
+
| FeatureWithoutDescriptionLinter | Feature has no description | <path_to_file>:1 |
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
Feature: Feature without name linter
|
|
2
|
-
|
|
3
|
-
As a reader of documentation
|
|
4
|
-
I want every feature to have a name
|
|
5
|
-
So that I can get an idea of what the feature is about without having to read every use case
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
Scenario: Linting
|
|
9
|
-
Given a linter for features without a name
|
|
10
|
-
And the following feature:
|
|
11
|
-
"""
|
|
12
|
-
Feature:
|
|
13
|
-
This feature does not have a name
|
|
14
|
-
"""
|
|
15
|
-
When it is linted
|
|
16
|
-
Then an error is reported:
|
|
17
|
-
| linter | problem | location |
|
|
18
|
-
| FeatureWithoutNameLinter | Feature does not have a name. | <path_to_file>:1 |
|
|
1
|
+
Feature: Feature without name linter
|
|
2
|
+
|
|
3
|
+
As a reader of documentation
|
|
4
|
+
I want every feature to have a name
|
|
5
|
+
So that I can get an idea of what the feature is about without having to read every use case
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
Scenario: Linting
|
|
9
|
+
Given a linter for features without a name
|
|
10
|
+
And the following feature:
|
|
11
|
+
"""
|
|
12
|
+
Feature:
|
|
13
|
+
This feature does not have a name
|
|
14
|
+
"""
|
|
15
|
+
When it is linted
|
|
16
|
+
Then an error is reported:
|
|
17
|
+
| linter | problem | location |
|
|
18
|
+
| FeatureWithoutNameLinter | Feature does not have a name. | <path_to_file>:1 |
|