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,41 +1,41 @@
|
|
|
1
|
-
Feature: Using a configuration
|
|
2
|
-
|
|
3
|
-
Configuration can be done during a script or through a configuration file. This file can be explicitly
|
|
4
|
-
provided or a default configuration file will be used.
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
Scenario: Providing a configuration directly
|
|
8
|
-
Given a linter registered as "SomeLinter"
|
|
9
|
-
When the following code is used:
|
|
10
|
-
"""
|
|
11
|
-
CukeLinter.load_configuration(config: { 'SomeLinter' => { 'Enabled' => false } })
|
|
12
|
-
"""
|
|
13
|
-
Then the linter "SomeLinter" is no longer registered
|
|
14
|
-
|
|
15
|
-
Scenario: Loading a configuration from a file
|
|
16
|
-
Given a linter registered as "SomeLinter"
|
|
17
|
-
And the following configuration file "my_config.file":
|
|
18
|
-
"""
|
|
19
|
-
SomeLinter:
|
|
20
|
-
Enabled: false
|
|
21
|
-
"""
|
|
22
|
-
When the following code is used:
|
|
23
|
-
"""
|
|
24
|
-
CukeLinter.load_configuration(config_file_path: '<path_to>/my_config.file')
|
|
25
|
-
"""
|
|
26
|
-
Then the linter "SomeLinter" is no longer registered
|
|
27
|
-
|
|
28
|
-
Scenario: Using the default configuration file
|
|
29
|
-
Given a directory "test_directory"
|
|
30
|
-
And the following configuration file "test_directory/.cuke_linter":
|
|
31
|
-
"""
|
|
32
|
-
SomeLinter:
|
|
33
|
-
Enabled: false
|
|
34
|
-
"""
|
|
35
|
-
And a linter registered as "SomeLinter"
|
|
36
|
-
When "test_directory" is the current directory
|
|
37
|
-
And the following code is used:
|
|
38
|
-
"""
|
|
39
|
-
CukeLinter.load_configuration
|
|
40
|
-
"""
|
|
41
|
-
Then the linter "SomeLinter" is no longer registered
|
|
1
|
+
Feature: Using a configuration
|
|
2
|
+
|
|
3
|
+
Configuration can be done during a script or through a configuration file. This file can be explicitly
|
|
4
|
+
provided or a default configuration file will be used.
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
Scenario: Providing a configuration directly
|
|
8
|
+
Given a linter registered as "SomeLinter"
|
|
9
|
+
When the following code is used:
|
|
10
|
+
"""
|
|
11
|
+
CukeLinter.load_configuration(config: { 'SomeLinter' => { 'Enabled' => false } })
|
|
12
|
+
"""
|
|
13
|
+
Then the linter "SomeLinter" is no longer registered
|
|
14
|
+
|
|
15
|
+
Scenario: Loading a configuration from a file
|
|
16
|
+
Given a linter registered as "SomeLinter"
|
|
17
|
+
And the following configuration file "my_config.file":
|
|
18
|
+
"""
|
|
19
|
+
SomeLinter:
|
|
20
|
+
Enabled: false
|
|
21
|
+
"""
|
|
22
|
+
When the following code is used:
|
|
23
|
+
"""
|
|
24
|
+
CukeLinter.load_configuration(config_file_path: '<path_to>/my_config.file')
|
|
25
|
+
"""
|
|
26
|
+
Then the linter "SomeLinter" is no longer registered
|
|
27
|
+
|
|
28
|
+
Scenario: Using the default configuration file
|
|
29
|
+
Given a directory "test_directory"
|
|
30
|
+
And the following configuration file "test_directory/.cuke_linter":
|
|
31
|
+
"""
|
|
32
|
+
SomeLinter:
|
|
33
|
+
Enabled: false
|
|
34
|
+
"""
|
|
35
|
+
And a linter registered as "SomeLinter"
|
|
36
|
+
When "test_directory" is the current directory
|
|
37
|
+
And the following code is used:
|
|
38
|
+
"""
|
|
39
|
+
CukeLinter.load_configuration
|
|
40
|
+
"""
|
|
41
|
+
Then the linter "SomeLinter" is no longer registered
|
|
@@ -1,56 +1,56 @@
|
|
|
1
|
-
Feature: Custom linters
|
|
2
|
-
|
|
3
|
-
In addition to the linters provided by CukeLinter, custom linters can be used. A linter is
|
|
4
|
-
essentially any object that provides a few needed methods. In order to simplify the creation
|
|
5
|
-
of custom linters, a base linter class is available that provides these needed methods.
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
Scenario: Creating a custom linter object
|
|
9
|
-
Given the following custom linter object:
|
|
10
|
-
"""
|
|
11
|
-
custom_name = 'MyCustomLinter'
|
|
12
|
-
custom_message = 'My custom message'
|
|
13
|
-
custom_rule = lambda do |model|
|
|
14
|
-
# Your logic here, return true for a problem and false for not problem
|
|
15
|
-
true
|
|
16
|
-
end
|
|
17
|
-
|
|
18
|
-
@linter = CukeLinter::Linter.new(name: custom_name,
|
|
19
|
-
message: custom_message,
|
|
20
|
-
rule: custom_rule)
|
|
21
|
-
"""
|
|
22
|
-
And a model to lint
|
|
23
|
-
When the model is linted
|
|
24
|
-
Then an error is reported:
|
|
25
|
-
| linter | problem | location |
|
|
26
|
-
| MyCustomLinter | My custom message | <path_to_file>:<model_line_number> |
|
|
27
|
-
|
|
28
|
-
Scenario: Creating a custom linter class
|
|
29
|
-
Given the following custom linter class:
|
|
30
|
-
"""
|
|
31
|
-
class MyCustomLinter < CukeLinter::Linter
|
|
32
|
-
|
|
33
|
-
def name
|
|
34
|
-
'MyCustomLinter'
|
|
35
|
-
end
|
|
36
|
-
|
|
37
|
-
def message
|
|
38
|
-
'My custom message'
|
|
39
|
-
end
|
|
40
|
-
|
|
41
|
-
def rule(model)
|
|
42
|
-
# Your logic here, return true for a problem and false for not problem
|
|
43
|
-
true
|
|
44
|
-
end
|
|
45
|
-
|
|
46
|
-
end
|
|
47
|
-
"""
|
|
48
|
-
And the following code is used:
|
|
49
|
-
"""
|
|
50
|
-
@linter = MyCustomLinter.new
|
|
51
|
-
"""
|
|
52
|
-
And a model to lint
|
|
53
|
-
When the model is linted
|
|
54
|
-
Then an error is reported:
|
|
55
|
-
| linter | problem | location |
|
|
56
|
-
| MyCustomLinter | My custom message | <path_to_file>:<model_line_number> |
|
|
1
|
+
Feature: Custom linters
|
|
2
|
+
|
|
3
|
+
In addition to the linters provided by CukeLinter, custom linters can be used. A linter is
|
|
4
|
+
essentially any object that provides a few needed methods. In order to simplify the creation
|
|
5
|
+
of custom linters, a base linter class is available that provides these needed methods.
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
Scenario: Creating a custom linter object
|
|
9
|
+
Given the following custom linter object:
|
|
10
|
+
"""
|
|
11
|
+
custom_name = 'MyCustomLinter'
|
|
12
|
+
custom_message = 'My custom message'
|
|
13
|
+
custom_rule = lambda do |model|
|
|
14
|
+
# Your logic here, return true for a problem and false for not problem
|
|
15
|
+
true
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
@linter = CukeLinter::Linter.new(name: custom_name,
|
|
19
|
+
message: custom_message,
|
|
20
|
+
rule: custom_rule)
|
|
21
|
+
"""
|
|
22
|
+
And a model to lint
|
|
23
|
+
When the model is linted
|
|
24
|
+
Then an error is reported:
|
|
25
|
+
| linter | problem | location |
|
|
26
|
+
| MyCustomLinter | My custom message | <path_to_file>:<model_line_number> |
|
|
27
|
+
|
|
28
|
+
Scenario: Creating a custom linter class
|
|
29
|
+
Given the following custom linter class:
|
|
30
|
+
"""
|
|
31
|
+
class MyCustomLinter < CukeLinter::Linter
|
|
32
|
+
|
|
33
|
+
def name
|
|
34
|
+
'MyCustomLinter'
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
def message
|
|
38
|
+
'My custom message'
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
def rule(model)
|
|
42
|
+
# Your logic here, return true for a problem and false for not problem
|
|
43
|
+
true
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
end
|
|
47
|
+
"""
|
|
48
|
+
And the following code is used:
|
|
49
|
+
"""
|
|
50
|
+
@linter = MyCustomLinter.new
|
|
51
|
+
"""
|
|
52
|
+
And a model to lint
|
|
53
|
+
When the model is linted
|
|
54
|
+
Then an error is reported:
|
|
55
|
+
| linter | problem | location |
|
|
56
|
+
| MyCustomLinter | My custom message | <path_to_file>:<model_line_number> |
|
|
@@ -1,57 +1,57 @@
|
|
|
1
|
-
Feature: Default Linters
|
|
2
|
-
|
|
3
|
-
As a user of cuke_linter
|
|
4
|
-
I want a default set of linters to be used
|
|
5
|
-
So that I don't have to specifically include every linter
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
Scenario: Using the default linters
|
|
9
|
-
Given no other linters have been registered or unregistered
|
|
10
|
-
Then the following linters are registered by default
|
|
11
|
-
| BackgroundDoesMoreThanSetupLinter |
|
|
12
|
-
| ElementWithCommonTagsLinter |
|
|
13
|
-
| ElementWithDuplicateTagsLinter |
|
|
14
|
-
| ElementWithTooManyTagsLinter |
|
|
15
|
-
| ExampleWithoutNameLinter |
|
|
16
|
-
| FeatureFileWithInvalidNameLinter |
|
|
17
|
-
| FeatureFileWithMismatchedNameLinter |
|
|
18
|
-
| FeatureWithTooManyDifferentTagsLinter |
|
|
19
|
-
| FeatureWithoutDescriptionLinter |
|
|
20
|
-
| FeatureWithoutNameLinter |
|
|
21
|
-
| FeatureWithoutScenariosLinter |
|
|
22
|
-
| OutlineWithSingleExampleRowLinter |
|
|
23
|
-
| SingleTestBackgroundLinter |
|
|
24
|
-
| StepWithEndPeriodLinter |
|
|
25
|
-
| StepWithTooManyCharactersLinter |
|
|
26
|
-
| TestShouldUseBackgroundLinter |
|
|
27
|
-
| TestWithActionStepAsFinalStepLinter |
|
|
28
|
-
| TestWithBadNameLinter |
|
|
29
|
-
| TestWithNoActionStepLinter |
|
|
30
|
-
| TestWithNoNameLinter |
|
|
31
|
-
| TestWithNoVerificationStepLinter |
|
|
32
|
-
| TestWithSetupStepAfterActionStepLinter |
|
|
33
|
-
| TestWithSetupStepAfterVerificationStepLinter |
|
|
34
|
-
| TestWithSetupStepAsFinalStepLinter |
|
|
35
|
-
| TestWithTooManyStepsLinter |
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
Scenario: Registering new linters
|
|
39
|
-
Given no linters are currently registered
|
|
40
|
-
When the following code is used:
|
|
41
|
-
"""
|
|
42
|
-
linter_object = <code_to_generate_a_new_linter_instance>
|
|
43
|
-
|
|
44
|
-
CukeLinter.register_linter(linter: linter_object, name: 'MyNewLinter')
|
|
45
|
-
"""
|
|
46
|
-
Then the following linters are registered
|
|
47
|
-
| MyNewLinter |
|
|
48
|
-
|
|
49
|
-
Scenario: Unregistering existing linters
|
|
50
|
-
Given a linter registered as "SomeLinter"
|
|
51
|
-
When the following code is used:
|
|
52
|
-
"""
|
|
53
|
-
linter_object = <code_to_generate_a_new_linter_instance>
|
|
54
|
-
|
|
55
|
-
CukeLinter.unregister_linter('SomeLinter')
|
|
56
|
-
"""
|
|
57
|
-
Then the linter "SomeLinter" is no longer registered
|
|
1
|
+
Feature: Default Linters
|
|
2
|
+
|
|
3
|
+
As a user of cuke_linter
|
|
4
|
+
I want a default set of linters to be used
|
|
5
|
+
So that I don't have to specifically include every linter
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
Scenario: Using the default linters
|
|
9
|
+
Given no other linters have been registered or unregistered
|
|
10
|
+
Then the following linters are registered by default
|
|
11
|
+
| BackgroundDoesMoreThanSetupLinter |
|
|
12
|
+
| ElementWithCommonTagsLinter |
|
|
13
|
+
| ElementWithDuplicateTagsLinter |
|
|
14
|
+
| ElementWithTooManyTagsLinter |
|
|
15
|
+
| ExampleWithoutNameLinter |
|
|
16
|
+
| FeatureFileWithInvalidNameLinter |
|
|
17
|
+
| FeatureFileWithMismatchedNameLinter |
|
|
18
|
+
| FeatureWithTooManyDifferentTagsLinter |
|
|
19
|
+
| FeatureWithoutDescriptionLinter |
|
|
20
|
+
| FeatureWithoutNameLinter |
|
|
21
|
+
| FeatureWithoutScenariosLinter |
|
|
22
|
+
| OutlineWithSingleExampleRowLinter |
|
|
23
|
+
| SingleTestBackgroundLinter |
|
|
24
|
+
| StepWithEndPeriodLinter |
|
|
25
|
+
| StepWithTooManyCharactersLinter |
|
|
26
|
+
| TestShouldUseBackgroundLinter |
|
|
27
|
+
| TestWithActionStepAsFinalStepLinter |
|
|
28
|
+
| TestWithBadNameLinter |
|
|
29
|
+
| TestWithNoActionStepLinter |
|
|
30
|
+
| TestWithNoNameLinter |
|
|
31
|
+
| TestWithNoVerificationStepLinter |
|
|
32
|
+
| TestWithSetupStepAfterActionStepLinter |
|
|
33
|
+
| TestWithSetupStepAfterVerificationStepLinter |
|
|
34
|
+
| TestWithSetupStepAsFinalStepLinter |
|
|
35
|
+
| TestWithTooManyStepsLinter |
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
Scenario: Registering new linters
|
|
39
|
+
Given no linters are currently registered
|
|
40
|
+
When the following code is used:
|
|
41
|
+
"""
|
|
42
|
+
linter_object = <code_to_generate_a_new_linter_instance>
|
|
43
|
+
|
|
44
|
+
CukeLinter.register_linter(linter: linter_object, name: 'MyNewLinter')
|
|
45
|
+
"""
|
|
46
|
+
Then the following linters are registered
|
|
47
|
+
| MyNewLinter |
|
|
48
|
+
|
|
49
|
+
Scenario: Unregistering existing linters
|
|
50
|
+
Given a linter registered as "SomeLinter"
|
|
51
|
+
When the following code is used:
|
|
52
|
+
"""
|
|
53
|
+
linter_object = <code_to_generate_a_new_linter_instance>
|
|
54
|
+
|
|
55
|
+
CukeLinter.unregister_linter('SomeLinter')
|
|
56
|
+
"""
|
|
57
|
+
Then the linter "SomeLinter" is no longer registered
|
|
@@ -1,26 +1,26 @@
|
|
|
1
|
-
Feature: Pretty formatter
|
|
2
|
-
|
|
3
|
-
The 'pretty' formatter is a basic text formatter that organizes problems into something simple and human readable.
|
|
4
|
-
|
|
5
|
-
Scenario: Formatting linter data
|
|
6
|
-
Given the following linter data:
|
|
7
|
-
| linter name | problem | location |
|
|
8
|
-
| SomeLinter | Some problem | path/to/the_file:1 |
|
|
9
|
-
| SomeOtherLinter | Some other problem | path/to/the_file:33 |
|
|
10
|
-
| SomeOtherLinter | Some other problem | path/to/the_file:101 |
|
|
11
|
-
| SomeOtherLinter | Yet another problem | path/to/the_file:55 |
|
|
12
|
-
When it is formatted by the "pretty" formatter
|
|
13
|
-
Then the resulting output is the following:
|
|
14
|
-
"""
|
|
15
|
-
SomeLinter
|
|
16
|
-
Some problem
|
|
17
|
-
path/to/the_file:1
|
|
18
|
-
SomeOtherLinter
|
|
19
|
-
Some other problem
|
|
20
|
-
path/to/the_file:33
|
|
21
|
-
path/to/the_file:101
|
|
22
|
-
Yet another problem
|
|
23
|
-
path/to/the_file:55
|
|
24
|
-
|
|
25
|
-
4 issues found
|
|
26
|
-
"""
|
|
1
|
+
Feature: Pretty formatter
|
|
2
|
+
|
|
3
|
+
The 'pretty' formatter is a basic text formatter that organizes problems into something simple and human readable.
|
|
4
|
+
|
|
5
|
+
Scenario: Formatting linter data
|
|
6
|
+
Given the following linter data:
|
|
7
|
+
| linter name | problem | location |
|
|
8
|
+
| SomeLinter | Some problem | path/to/the_file:1 |
|
|
9
|
+
| SomeOtherLinter | Some other problem | path/to/the_file:33 |
|
|
10
|
+
| SomeOtherLinter | Some other problem | path/to/the_file:101 |
|
|
11
|
+
| SomeOtherLinter | Yet another problem | path/to/the_file:55 |
|
|
12
|
+
When it is formatted by the "pretty" formatter
|
|
13
|
+
Then the resulting output is the following:
|
|
14
|
+
"""
|
|
15
|
+
SomeLinter
|
|
16
|
+
Some problem
|
|
17
|
+
path/to/the_file:1
|
|
18
|
+
SomeOtherLinter
|
|
19
|
+
Some other problem
|
|
20
|
+
path/to/the_file:33
|
|
21
|
+
path/to/the_file:101
|
|
22
|
+
Yet another problem
|
|
23
|
+
path/to/the_file:55
|
|
24
|
+
|
|
25
|
+
4 issues found
|
|
26
|
+
"""
|
|
@@ -1,84 +1,84 @@
|
|
|
1
|
-
Feature: Background does more than setup linter
|
|
2
|
-
|
|
3
|
-
As a reader of documentation
|
|
4
|
-
I want to backgrounds to not contain actions or verifications
|
|
5
|
-
So that what is being demonstrated in individual use cases is clear
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
Scenario: Linting backgrounds with action steps
|
|
9
|
-
Given a linter for backgrounds that do more than setup
|
|
10
|
-
And the following feature:
|
|
11
|
-
"""
|
|
12
|
-
Feature:
|
|
13
|
-
|
|
14
|
-
Background:
|
|
15
|
-
Given some setup
|
|
16
|
-
When some action
|
|
17
|
-
"""
|
|
18
|
-
When it is linted
|
|
19
|
-
Then an error is reported:
|
|
20
|
-
| linter | problem | location |
|
|
21
|
-
| BackgroundDoesMoreThanSetupLinter | Background has non-setup steps | <path_to_file>:3 |
|
|
22
|
-
|
|
23
|
-
Scenario: Linting backgrounds with verification steps
|
|
24
|
-
Given a linter for backgrounds that do more than setup
|
|
25
|
-
And the following feature:
|
|
26
|
-
"""
|
|
27
|
-
Feature:
|
|
28
|
-
|
|
29
|
-
Background:
|
|
30
|
-
Given some setup
|
|
31
|
-
Then some verification
|
|
32
|
-
"""
|
|
33
|
-
When it is linted
|
|
34
|
-
Then an error is reported:
|
|
35
|
-
| linter | problem | location |
|
|
36
|
-
| BackgroundDoesMoreThanSetupLinter | Background has non-setup steps | <path_to_file>:3 |
|
|
37
|
-
|
|
38
|
-
Scenario: Linting backgrounds with only setup steps
|
|
39
|
-
Given a linter for backgrounds that do more than setup
|
|
40
|
-
And the following feature:
|
|
41
|
-
"""
|
|
42
|
-
Feature:
|
|
43
|
-
|
|
44
|
-
Background:
|
|
45
|
-
Given some setup
|
|
46
|
-
And some more setup
|
|
47
|
-
* this is also setup
|
|
48
|
-
"""
|
|
49
|
-
When it is linted
|
|
50
|
-
Then no error is reported
|
|
51
|
-
|
|
52
|
-
Scenario Outline: Configuration of keywords for different dialect
|
|
53
|
-
Given a linter for backgrounds that do more than setup has been registered
|
|
54
|
-
And the following configuration file:
|
|
55
|
-
"""
|
|
56
|
-
BackgroundDoesMoreThanSetupLinter:
|
|
57
|
-
Given:
|
|
58
|
-
- Dado
|
|
59
|
-
When:
|
|
60
|
-
- Quando
|
|
61
|
-
Then:
|
|
62
|
-
- Então
|
|
63
|
-
- Entao
|
|
64
|
-
"""
|
|
65
|
-
And the following feature:
|
|
66
|
-
"""
|
|
67
|
-
# language:pt
|
|
68
|
-
Funcionalidade: Feature name
|
|
69
|
-
|
|
70
|
-
Contexto: A Background in pt dialect
|
|
71
|
-
Dado some setup in pt dialect
|
|
72
|
-
<step>
|
|
73
|
-
"""
|
|
74
|
-
When the configuration file is loaded
|
|
75
|
-
And it is linted
|
|
76
|
-
Then an error is reported:
|
|
77
|
-
| linter | problem | location |
|
|
78
|
-
| BackgroundDoesMoreThanSetupLinter | Background has non-setup steps | <path_to_file>:4 |
|
|
79
|
-
|
|
80
|
-
Examples:
|
|
81
|
-
| step |
|
|
82
|
-
| Quando this is an action in pt dialect |
|
|
83
|
-
| Então this is a validation in pt dialect |
|
|
84
|
-
| Entao this is also a validation in pt dialect |
|
|
1
|
+
Feature: Background does more than setup linter
|
|
2
|
+
|
|
3
|
+
As a reader of documentation
|
|
4
|
+
I want to backgrounds to not contain actions or verifications
|
|
5
|
+
So that what is being demonstrated in individual use cases is clear
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
Scenario: Linting backgrounds with action steps
|
|
9
|
+
Given a linter for backgrounds that do more than setup
|
|
10
|
+
And the following feature:
|
|
11
|
+
"""
|
|
12
|
+
Feature:
|
|
13
|
+
|
|
14
|
+
Background:
|
|
15
|
+
Given some setup
|
|
16
|
+
When some action
|
|
17
|
+
"""
|
|
18
|
+
When it is linted
|
|
19
|
+
Then an error is reported:
|
|
20
|
+
| linter | problem | location |
|
|
21
|
+
| BackgroundDoesMoreThanSetupLinter | Background has non-setup steps | <path_to_file>:3 |
|
|
22
|
+
|
|
23
|
+
Scenario: Linting backgrounds with verification steps
|
|
24
|
+
Given a linter for backgrounds that do more than setup
|
|
25
|
+
And the following feature:
|
|
26
|
+
"""
|
|
27
|
+
Feature:
|
|
28
|
+
|
|
29
|
+
Background:
|
|
30
|
+
Given some setup
|
|
31
|
+
Then some verification
|
|
32
|
+
"""
|
|
33
|
+
When it is linted
|
|
34
|
+
Then an error is reported:
|
|
35
|
+
| linter | problem | location |
|
|
36
|
+
| BackgroundDoesMoreThanSetupLinter | Background has non-setup steps | <path_to_file>:3 |
|
|
37
|
+
|
|
38
|
+
Scenario: Linting backgrounds with only setup steps
|
|
39
|
+
Given a linter for backgrounds that do more than setup
|
|
40
|
+
And the following feature:
|
|
41
|
+
"""
|
|
42
|
+
Feature:
|
|
43
|
+
|
|
44
|
+
Background:
|
|
45
|
+
Given some setup
|
|
46
|
+
And some more setup
|
|
47
|
+
* this is also setup
|
|
48
|
+
"""
|
|
49
|
+
When it is linted
|
|
50
|
+
Then no error is reported
|
|
51
|
+
|
|
52
|
+
Scenario Outline: Configuration of keywords for different dialect
|
|
53
|
+
Given a linter for backgrounds that do more than setup has been registered
|
|
54
|
+
And the following configuration file:
|
|
55
|
+
"""
|
|
56
|
+
BackgroundDoesMoreThanSetupLinter:
|
|
57
|
+
Given:
|
|
58
|
+
- Dado
|
|
59
|
+
When:
|
|
60
|
+
- Quando
|
|
61
|
+
Then:
|
|
62
|
+
- Então
|
|
63
|
+
- Entao
|
|
64
|
+
"""
|
|
65
|
+
And the following feature:
|
|
66
|
+
"""
|
|
67
|
+
# language:pt
|
|
68
|
+
Funcionalidade: Feature name
|
|
69
|
+
|
|
70
|
+
Contexto: A Background in pt dialect
|
|
71
|
+
Dado some setup in pt dialect
|
|
72
|
+
<step>
|
|
73
|
+
"""
|
|
74
|
+
When the configuration file is loaded
|
|
75
|
+
And it is linted
|
|
76
|
+
Then an error is reported:
|
|
77
|
+
| linter | problem | location |
|
|
78
|
+
| BackgroundDoesMoreThanSetupLinter | Background has non-setup steps | <path_to_file>:4 |
|
|
79
|
+
|
|
80
|
+
Examples:
|
|
81
|
+
| step |
|
|
82
|
+
| Quando this is an action in pt dialect |
|
|
83
|
+
| Então this is a validation in pt dialect |
|
|
84
|
+
| Entao this is also a validation in pt dialect |
|
|
@@ -1,28 +1,28 @@
|
|
|
1
|
-
Feature: Element with common tags linter
|
|
2
|
-
|
|
3
|
-
As a writer of documentation
|
|
4
|
-
I want taggable elements to not needlessly have the same tags
|
|
5
|
-
So that redundancy is minimized
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
Scenario: Linting
|
|
9
|
-
|
|
10
|
-
Note: Also works on outlines that have common tags on their examples
|
|
11
|
-
|
|
12
|
-
Given a linter for elements with common tags
|
|
13
|
-
And the following feature:
|
|
14
|
-
"""
|
|
15
|
-
Feature:
|
|
16
|
-
|
|
17
|
-
@same_tag
|
|
18
|
-
Scenario:
|
|
19
|
-
* a step
|
|
20
|
-
|
|
21
|
-
@same_tag
|
|
22
|
-
Scenario:
|
|
23
|
-
* a step
|
|
24
|
-
"""
|
|
25
|
-
When it is linted
|
|
26
|
-
Then an error is reported:
|
|
27
|
-
| linter | problem | location |
|
|
28
|
-
| ElementWithCommonTagsLinter | All tests in Feature have tag '@same_tag'. Move tag to Feature level. | <path_to_file>:1 |
|
|
1
|
+
Feature: Element with common tags linter
|
|
2
|
+
|
|
3
|
+
As a writer of documentation
|
|
4
|
+
I want taggable elements to not needlessly have the same tags
|
|
5
|
+
So that redundancy is minimized
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
Scenario: Linting
|
|
9
|
+
|
|
10
|
+
Note: Also works on outlines that have common tags on their examples
|
|
11
|
+
|
|
12
|
+
Given a linter for elements with common tags
|
|
13
|
+
And the following feature:
|
|
14
|
+
"""
|
|
15
|
+
Feature:
|
|
16
|
+
|
|
17
|
+
@same_tag
|
|
18
|
+
Scenario:
|
|
19
|
+
* a step
|
|
20
|
+
|
|
21
|
+
@same_tag
|
|
22
|
+
Scenario:
|
|
23
|
+
* a step
|
|
24
|
+
"""
|
|
25
|
+
When it is linted
|
|
26
|
+
Then an error is reported:
|
|
27
|
+
| linter | problem | location |
|
|
28
|
+
| ElementWithCommonTagsLinter | All tests in Feature have tag '@same_tag'. Move tag to Feature level. | <path_to_file>:1 |
|