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.
Files changed (75) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +217 -211
  3. data/LICENSE.txt +21 -21
  4. data/README.md +160 -160
  5. data/cuke_linter.gemspec +59 -58
  6. data/exe/cuke_linter +112 -112
  7. data/lib/cuke_linter/configuration.rb +45 -45
  8. data/lib/cuke_linter/default_linters.rb +32 -32
  9. data/lib/cuke_linter/formatters/pretty_formatter.rb +84 -84
  10. data/lib/cuke_linter/gherkin.rb +10 -10
  11. data/lib/cuke_linter/linter_registration.rb +32 -32
  12. data/lib/cuke_linter/linters/background_does_more_than_setup_linter.rb +35 -35
  13. data/lib/cuke_linter/linters/element_with_common_tags_linter.rb +49 -49
  14. data/lib/cuke_linter/linters/element_with_duplicate_tags_linter.rb +48 -48
  15. data/lib/cuke_linter/linters/element_with_too_many_tags_linter.rb +46 -46
  16. data/lib/cuke_linter/linters/example_without_name_linter.rb +19 -19
  17. data/lib/cuke_linter/linters/feature_file_with_invalid_name_linter.rb +20 -20
  18. data/lib/cuke_linter/linters/feature_file_with_mismatched_name_linter.rb +25 -25
  19. data/lib/cuke_linter/linters/feature_with_too_many_different_tags_linter.rb +35 -35
  20. data/lib/cuke_linter/linters/feature_without_description_linter.rb +19 -19
  21. data/lib/cuke_linter/linters/feature_without_name_linter.rb +19 -19
  22. data/lib/cuke_linter/linters/feature_without_scenarios_linter.rb +23 -23
  23. data/lib/cuke_linter/linters/linter.rb +42 -42
  24. data/lib/cuke_linter/linters/outline_with_single_example_row_linter.rb +22 -22
  25. data/lib/cuke_linter/linters/single_test_background_linter.rb +19 -19
  26. data/lib/cuke_linter/linters/step_with_end_period_linter.rb +19 -19
  27. data/lib/cuke_linter/linters/step_with_too_many_characters_linter.rb +38 -38
  28. data/lib/cuke_linter/linters/test_name_with_too_many_characters_linter.rb +38 -38
  29. data/lib/cuke_linter/linters/test_should_use_background_linter.rb +80 -80
  30. data/lib/cuke_linter/linters/test_with_action_step_as_final_step_linter.rb +33 -33
  31. data/lib/cuke_linter/linters/test_with_bad_name_linter.rb +23 -23
  32. data/lib/cuke_linter/linters/test_with_no_action_step_linter.rb +33 -33
  33. data/lib/cuke_linter/linters/test_with_no_name_linter.rb +19 -19
  34. data/lib/cuke_linter/linters/test_with_no_verification_step_linter.rb +33 -33
  35. data/lib/cuke_linter/linters/test_with_setup_step_after_action_step_linter.rb +46 -46
  36. data/lib/cuke_linter/linters/test_with_setup_step_after_verification_step_linter.rb +46 -46
  37. data/lib/cuke_linter/linters/test_with_setup_step_as_final_step_linter.rb +33 -33
  38. data/lib/cuke_linter/linters/test_with_too_many_steps_linter.rb +27 -27
  39. data/lib/cuke_linter/version.rb +4 -4
  40. data/lib/cuke_linter.rb +196 -196
  41. data/testing/cucumber/features/command_line.feature +202 -202
  42. data/testing/cucumber/features/configuration/configuring_linters.feature +58 -58
  43. data/testing/cucumber/features/configuration/locally_scoping_linters.feature +55 -55
  44. data/testing/cucumber/features/configuration/using_configurations.feature +41 -41
  45. data/testing/cucumber/features/custom_linters.feature +56 -56
  46. data/testing/cucumber/features/default_linters.feature +57 -57
  47. data/testing/cucumber/features/formatters/pretty_formatter.feature +26 -26
  48. data/testing/cucumber/features/linters/background_does_more_than_setup.feature +84 -84
  49. data/testing/cucumber/features/linters/element_with_common_tags.feature +28 -28
  50. data/testing/cucumber/features/linters/element_with_duplicate_tags.feature +71 -71
  51. data/testing/cucumber/features/linters/element_with_too_many_tags.feature +70 -70
  52. data/testing/cucumber/features/linters/example_without_name.feature +34 -34
  53. data/testing/cucumber/features/linters/feature_file_with_invalid_name.feature +20 -20
  54. data/testing/cucumber/features/linters/feature_file_with_mismatched_name.feature +32 -32
  55. data/testing/cucumber/features/linters/feature_with_too_many_different_tags.feature +56 -56
  56. data/testing/cucumber/features/linters/feature_without_description.feature +17 -17
  57. data/testing/cucumber/features/linters/feature_without_name.feature +18 -18
  58. data/testing/cucumber/features/linters/feature_without_scenarios.feature +39 -39
  59. data/testing/cucumber/features/linters/outline_with_single_example_row.feature +23 -23
  60. data/testing/cucumber/features/linters/single_test_background.feature +24 -24
  61. data/testing/cucumber/features/linters/step_too_long.feature +43 -43
  62. data/testing/cucumber/features/linters/step_with_end_period.feature +21 -21
  63. data/testing/cucumber/features/linters/test_name_too_long.feature +41 -41
  64. data/testing/cucumber/features/linters/test_should_use_background.feature +29 -29
  65. data/testing/cucumber/features/linters/test_with_action_as_final_step.feature +50 -50
  66. data/testing/cucumber/features/linters/test_with_bad_name.feature +29 -29
  67. data/testing/cucumber/features/linters/test_with_no_action_step.feature +56 -56
  68. data/testing/cucumber/features/linters/test_with_no_name.feature +23 -23
  69. data/testing/cucumber/features/linters/test_with_no_verification_step.feature +58 -58
  70. data/testing/cucumber/features/linters/test_with_setup_step_after_action_step.feature +57 -57
  71. data/testing/cucumber/features/linters/test_with_setup_step_after_verification_step.feature +57 -57
  72. data/testing/cucumber/features/linters/test_with_setup_step_as_final_step.feature +50 -50
  73. data/testing/cucumber/features/linters/test_with_too_many_steps.feature +61 -61
  74. metadata +21 -25
  75. data/testing/cucumber/features/linters/rule_without_name.feature +0 -18
@@ -1,56 +1,56 @@
1
- Feature: Test with no action step linter
2
-
3
- As a tester
4
- I want tests to have at least one action step
5
- So that I know what is triggering the behavior that is being checked
6
-
7
-
8
- Scenario: Linting
9
-
10
- Note: Also works on outlines. Also includes steps inherited from backgrounds.
11
-
12
- Given a linter for tests with no action step
13
- And the following feature:
14
- """
15
- Feature:
16
-
17
- Scenario:
18
- Given some setup step
19
- Then that's the end of the test
20
- """
21
- When it is linted
22
- Then an error is reported:
23
- | linter | problem | location |
24
- | TestWithNoActionStepLinter | Test does not have a 'When' step. | <path_to_file>:3 |
25
-
26
- Scenario: Configuration of keywords for different dialect
27
- Given a linter for tests with no action step has been registered
28
- And the following configuration file:
29
- """
30
- TestWithNoActionStepLinter:
31
- Given:
32
- - Dado
33
- When:
34
- - Quando
35
- Then:
36
- - Então
37
- """
38
- And the following feature:
39
- """
40
- # language:pt
41
- Funcionalidade: Feature name
42
-
43
- Cenário: scenario name
44
- Dado some setup in pt dialect
45
- Então this is an validation in pt dialect
46
- """
47
- When the configuration file is loaded
48
- And it is linted
49
- Then an error is reported:
50
- | linter | problem | location |
51
- | TestWithNoActionStepLinter | Test does not have a 'When' step. | <path_to_file>:4 |
52
-
53
- @wip
54
- Scenario: Configuration
55
-
56
- Ideas: Configure whether or not the linter triggers on tests with no steps at all?
1
+ Feature: Test with no action step linter
2
+
3
+ As a tester
4
+ I want tests to have at least one action step
5
+ So that I know what is triggering the behavior that is being checked
6
+
7
+
8
+ Scenario: Linting
9
+
10
+ Note: Also works on outlines. Also includes steps inherited from backgrounds.
11
+
12
+ Given a linter for tests with no action step
13
+ And the following feature:
14
+ """
15
+ Feature:
16
+
17
+ Scenario:
18
+ Given some setup step
19
+ Then that's the end of the test
20
+ """
21
+ When it is linted
22
+ Then an error is reported:
23
+ | linter | problem | location |
24
+ | TestWithNoActionStepLinter | Test does not have a 'When' step. | <path_to_file>:3 |
25
+
26
+ Scenario: Configuration of keywords for different dialect
27
+ Given a linter for tests with no action step has been registered
28
+ And the following configuration file:
29
+ """
30
+ TestWithNoActionStepLinter:
31
+ Given:
32
+ - Dado
33
+ When:
34
+ - Quando
35
+ Then:
36
+ - Então
37
+ """
38
+ And the following feature:
39
+ """
40
+ # language:pt
41
+ Funcionalidade: Feature name
42
+
43
+ Cenário: scenario name
44
+ Dado some setup in pt dialect
45
+ Então this is an validation in pt dialect
46
+ """
47
+ When the configuration file is loaded
48
+ And it is linted
49
+ Then an error is reported:
50
+ | linter | problem | location |
51
+ | TestWithNoActionStepLinter | Test does not have a 'When' step. | <path_to_file>:4 |
52
+
53
+ @wip
54
+ Scenario: Configuration
55
+
56
+ Ideas: Configure whether or not the linter triggers on tests with no steps at all?
@@ -1,23 +1,23 @@
1
- Feature: Test with no name linter
2
-
3
- As a reader of documentation
4
- I want every scenario to have a name
5
- So that I can understand the significance of the use case
6
-
7
-
8
- Scenario: Linting
9
-
10
- Note: Also works on outlines.
11
-
12
- Given a linter for tests with no name
13
- And the following feature:
14
- """
15
- Feature:
16
-
17
- Scenario:
18
- This scenario has no name
19
- """
20
- When it is linted
21
- Then an error is reported:
22
- | linter | problem | location |
23
- | TestWithNoNameLinter | Test does not have a name. | <path_to_file>:3 |
1
+ Feature: Test with no name linter
2
+
3
+ As a reader of documentation
4
+ I want every scenario to have a name
5
+ So that I can understand the significance of the use case
6
+
7
+
8
+ Scenario: Linting
9
+
10
+ Note: Also works on outlines.
11
+
12
+ Given a linter for tests with no name
13
+ And the following feature:
14
+ """
15
+ Feature:
16
+
17
+ Scenario:
18
+ This scenario has no name
19
+ """
20
+ When it is linted
21
+ Then an error is reported:
22
+ | linter | problem | location |
23
+ | TestWithNoNameLinter | Test does not have a name. | <path_to_file>:3 |
@@ -1,58 +1,58 @@
1
- Feature: Test with no verification step linter
2
-
3
- As a tester
4
- I want tests to have at least one verification step
5
- So that I know that something is being checked
6
-
7
-
8
- Scenario: Linting
9
-
10
- Note: Also works on outlines. Also includes steps inherited from backgrounds.
11
-
12
- Given a linter for tests with no verification step
13
- And the following feature:
14
- """
15
- Feature:
16
-
17
- Scenario:
18
- Given some setup step
19
- When an action is taken
20
- And that's the end of the test
21
- """
22
- When it is linted
23
- Then an error is reported:
24
- | linter | problem | location |
25
- | TestWithNoVerificationStepLinter | Test does not have a 'Then' step. | <path_to_file>:3 |
26
-
27
- Scenario: Configuration of keywords for different dialect
28
- Given a linter for tests with no verification step has been registered
29
- And the following configuration file:
30
- """
31
- TestWithNoVerificationStepLinter:
32
- Given:
33
- - Dado
34
- When:
35
- - Quando
36
- Then:
37
- - Então
38
- """
39
- And the following feature:
40
- """
41
- # language:pt
42
- Funcionalidade: Feature name
43
-
44
- Cenário: scenario name
45
- Dado some setup in pt dialect
46
- Quando this is an action in pt dialect
47
- E this is and AND in pt dialect
48
- """
49
- When the configuration file is loaded
50
- And it is linted
51
- Then an error is reported:
52
- | linter | problem | location |
53
- | TestWithNoVerificationStepLinter | Test does not have a 'Then' step. | <path_to_file>:4 |
54
-
55
- @wip
56
- Scenario: Configuration
57
-
58
- Ideas: Configure whether or not the linter triggers on tests with no steps at all?
1
+ Feature: Test with no verification step linter
2
+
3
+ As a tester
4
+ I want tests to have at least one verification step
5
+ So that I know that something is being checked
6
+
7
+
8
+ Scenario: Linting
9
+
10
+ Note: Also works on outlines. Also includes steps inherited from backgrounds.
11
+
12
+ Given a linter for tests with no verification step
13
+ And the following feature:
14
+ """
15
+ Feature:
16
+
17
+ Scenario:
18
+ Given some setup step
19
+ When an action is taken
20
+ And that's the end of the test
21
+ """
22
+ When it is linted
23
+ Then an error is reported:
24
+ | linter | problem | location |
25
+ | TestWithNoVerificationStepLinter | Test does not have a 'Then' step. | <path_to_file>:3 |
26
+
27
+ Scenario: Configuration of keywords for different dialect
28
+ Given a linter for tests with no verification step has been registered
29
+ And the following configuration file:
30
+ """
31
+ TestWithNoVerificationStepLinter:
32
+ Given:
33
+ - Dado
34
+ When:
35
+ - Quando
36
+ Then:
37
+ - Então
38
+ """
39
+ And the following feature:
40
+ """
41
+ # language:pt
42
+ Funcionalidade: Feature name
43
+
44
+ Cenário: scenario name
45
+ Dado some setup in pt dialect
46
+ Quando this is an action in pt dialect
47
+ E this is and AND in pt dialect
48
+ """
49
+ When the configuration file is loaded
50
+ And it is linted
51
+ Then an error is reported:
52
+ | linter | problem | location |
53
+ | TestWithNoVerificationStepLinter | Test does not have a 'Then' step. | <path_to_file>:4 |
54
+
55
+ @wip
56
+ Scenario: Configuration
57
+
58
+ Ideas: Configure whether or not the linter triggers on tests with no steps at all?
@@ -1,57 +1,57 @@
1
- Feature: Test with setup step after action step linter
2
-
3
- As a tester
4
- I want to be warned about abnormal step flows
5
- So that the tests make sense
6
-
7
-
8
- Scenario: Linting
9
-
10
- Note: Also works on outlines. Does not include steps inherited from backgrounds.
11
-
12
- Given a linter for tests with a setup step after an action step
13
- And the following feature:
14
- """
15
- Feature:
16
-
17
- Scenario:
18
- When action step
19
- Given an out of place setup step
20
- """
21
- When it is linted
22
- Then an error is reported:
23
- | linter | problem | location |
24
- | TestWithSetupStepAfterActionStepLinter | Test has 'Given' step after 'When' step. | <path_to_file>:3 |
25
-
26
- Scenario: Configuration of keywords for different dialect
27
- Given a linter for tests with a setup step after an action step has been registered
28
- And the following configuration file:
29
- """
30
- TestWithSetupStepAfterActionStepLinter:
31
- Given:
32
- - Dado
33
- - Dadas
34
- When:
35
- - Quando
36
- Then:
37
- - Então
38
- """
39
- And the following feature:
40
- """
41
- # language:pt
42
- Funcionalidade: Feature name
43
-
44
- Cenário: scenario name
45
- Quando this is an action in pt dialect
46
- Dado some setup in pt dialect
47
- """
48
- When the configuration file is loaded
49
- And it is linted
50
- Then an error is reported:
51
- | linter | problem | location |
52
- | TestWithSetupStepAfterActionStepLinter | Test has 'Given' step after 'When' step. | <path_to_file>:4 |
53
-
54
- @wip
55
- Scenario: Configuration
56
-
57
- Configure whether or not to include background steps?
1
+ Feature: Test with setup step after action step linter
2
+
3
+ As a tester
4
+ I want to be warned about abnormal step flows
5
+ So that the tests make sense
6
+
7
+
8
+ Scenario: Linting
9
+
10
+ Note: Also works on outlines. Does not include steps inherited from backgrounds.
11
+
12
+ Given a linter for tests with a setup step after an action step
13
+ And the following feature:
14
+ """
15
+ Feature:
16
+
17
+ Scenario:
18
+ When action step
19
+ Given an out of place setup step
20
+ """
21
+ When it is linted
22
+ Then an error is reported:
23
+ | linter | problem | location |
24
+ | TestWithSetupStepAfterActionStepLinter | Test has 'Given' step after 'When' step. | <path_to_file>:3 |
25
+
26
+ Scenario: Configuration of keywords for different dialect
27
+ Given a linter for tests with a setup step after an action step has been registered
28
+ And the following configuration file:
29
+ """
30
+ TestWithSetupStepAfterActionStepLinter:
31
+ Given:
32
+ - Dado
33
+ - Dadas
34
+ When:
35
+ - Quando
36
+ Then:
37
+ - Então
38
+ """
39
+ And the following feature:
40
+ """
41
+ # language:pt
42
+ Funcionalidade: Feature name
43
+
44
+ Cenário: scenario name
45
+ Quando this is an action in pt dialect
46
+ Dado some setup in pt dialect
47
+ """
48
+ When the configuration file is loaded
49
+ And it is linted
50
+ Then an error is reported:
51
+ | linter | problem | location |
52
+ | TestWithSetupStepAfterActionStepLinter | Test has 'Given' step after 'When' step. | <path_to_file>:4 |
53
+
54
+ @wip
55
+ Scenario: Configuration
56
+
57
+ Configure whether or not to include background steps?
@@ -1,57 +1,57 @@
1
- Feature: Test with setup step after verification step linter
2
-
3
- As a tester
4
- I want to be warned about abnormal step flows
5
- So that the tests make sense
6
-
7
-
8
- Scenario: Linting
9
-
10
- Note: Also works on outlines. Does not include steps inherited from backgrounds.
11
-
12
- Given a linter for tests with a setup step after a verification step
13
- And the following feature:
14
- """
15
- Feature:
16
-
17
- Scenario:
18
- Then verification step
19
- Given an out of place setup step
20
- """
21
- When it is linted
22
- Then an error is reported:
23
- | linter | problem | location |
24
- | TestWithSetupStepAfterVerificationStepLinter | Test has 'Given' step after 'Then' step. | <path_to_file>:3 |
25
-
26
- Scenario: Configuration of keywords for different dialect
27
- Given a linter for tests with a setup step after a verification step has been registered
28
- And the following configuration file:
29
- """
30
- TestWithSetupStepAfterVerificationStepLinter:
31
- Given:
32
- - Dado
33
- - Dadas
34
- When:
35
- - Quando
36
- Then:
37
- - Então
38
- """
39
- And the following feature:
40
- """
41
- # language:pt
42
- Funcionalidade: Feature name
43
-
44
- Cenário: scenario name
45
- Então this is an validation in pt dialect
46
- Dado some setup in pt dialect
47
- """
48
- When the configuration file is loaded
49
- And it is linted
50
- Then an error is reported:
51
- | linter | problem | location |
52
- | TestWithSetupStepAfterVerificationStepLinter | Test has 'Given' step after 'Then' step. | <path_to_file>:4 |
53
-
54
- @wip
55
- Scenario: Configuration
56
-
57
- Configure whether or not to include background steps?
1
+ Feature: Test with setup step after verification step linter
2
+
3
+ As a tester
4
+ I want to be warned about abnormal step flows
5
+ So that the tests make sense
6
+
7
+
8
+ Scenario: Linting
9
+
10
+ Note: Also works on outlines. Does not include steps inherited from backgrounds.
11
+
12
+ Given a linter for tests with a setup step after a verification step
13
+ And the following feature:
14
+ """
15
+ Feature:
16
+
17
+ Scenario:
18
+ Then verification step
19
+ Given an out of place setup step
20
+ """
21
+ When it is linted
22
+ Then an error is reported:
23
+ | linter | problem | location |
24
+ | TestWithSetupStepAfterVerificationStepLinter | Test has 'Given' step after 'Then' step. | <path_to_file>:3 |
25
+
26
+ Scenario: Configuration of keywords for different dialect
27
+ Given a linter for tests with a setup step after a verification step has been registered
28
+ And the following configuration file:
29
+ """
30
+ TestWithSetupStepAfterVerificationStepLinter:
31
+ Given:
32
+ - Dado
33
+ - Dadas
34
+ When:
35
+ - Quando
36
+ Then:
37
+ - Então
38
+ """
39
+ And the following feature:
40
+ """
41
+ # language:pt
42
+ Funcionalidade: Feature name
43
+
44
+ Cenário: scenario name
45
+ Então this is an validation in pt dialect
46
+ Dado some setup in pt dialect
47
+ """
48
+ When the configuration file is loaded
49
+ And it is linted
50
+ Then an error is reported:
51
+ | linter | problem | location |
52
+ | TestWithSetupStepAfterVerificationStepLinter | Test has 'Given' step after 'Then' step. | <path_to_file>:4 |
53
+
54
+ @wip
55
+ Scenario: Configuration
56
+
57
+ Configure whether or not to include background steps?
@@ -1,50 +1,50 @@
1
- Feature: Test with setup step as final step linter
2
-
3
- As a tester
4
- I want to be warned about abnormal step flows
5
- So that the tests make sense
6
-
7
-
8
- Scenario: Linting
9
-
10
- Note: Also works on outlines.
11
-
12
- Given a linter for tests with a setup step as the final step
13
- And the following feature:
14
- """
15
- Feature:
16
-
17
- Scenario:
18
- Given the last step
19
- """
20
- When it is linted
21
- Then an error is reported:
22
- | linter | problem | location |
23
- | TestWithSetupStepAsFinalStepLinter | Test has 'Given' as the final step. | <path_to_file>:3 |
24
-
25
- Scenario: Configuration of keywords for different dialect
26
- Given a linter for tests with a setup step as the final step has been registered
27
- And the following configuration file:
28
- """
29
- TestWithSetupStepAsFinalStepLinter:
30
- Given:
31
- - Dado
32
- - Dadas
33
- When:
34
- - Quando
35
- Then:
36
- - Então
37
- """
38
- And the following feature:
39
- """
40
- # language:pt
41
- Funcionalidade: Feature name
42
-
43
- Cenário: scenario name
44
- Dado some setup in pt dialect
45
- """
46
- When the configuration file is loaded
47
- And it is linted
48
- Then an error is reported:
49
- | linter | problem | location |
50
- | TestWithSetupStepAsFinalStepLinter | Test has 'Given' as the final step. | <path_to_file>:4 |
1
+ Feature: Test with setup step as final step linter
2
+
3
+ As a tester
4
+ I want to be warned about abnormal step flows
5
+ So that the tests make sense
6
+
7
+
8
+ Scenario: Linting
9
+
10
+ Note: Also works on outlines.
11
+
12
+ Given a linter for tests with a setup step as the final step
13
+ And the following feature:
14
+ """
15
+ Feature:
16
+
17
+ Scenario:
18
+ Given the last step
19
+ """
20
+ When it is linted
21
+ Then an error is reported:
22
+ | linter | problem | location |
23
+ | TestWithSetupStepAsFinalStepLinter | Test has 'Given' as the final step. | <path_to_file>:3 |
24
+
25
+ Scenario: Configuration of keywords for different dialect
26
+ Given a linter for tests with a setup step as the final step has been registered
27
+ And the following configuration file:
28
+ """
29
+ TestWithSetupStepAsFinalStepLinter:
30
+ Given:
31
+ - Dado
32
+ - Dadas
33
+ When:
34
+ - Quando
35
+ Then:
36
+ - Então
37
+ """
38
+ And the following feature:
39
+ """
40
+ # language:pt
41
+ Funcionalidade: Feature name
42
+
43
+ Cenário: scenario name
44
+ Dado some setup in pt dialect
45
+ """
46
+ When the configuration file is loaded
47
+ And it is linted
48
+ Then an error is reported:
49
+ | linter | problem | location |
50
+ | TestWithSetupStepAsFinalStepLinter | Test has 'Given' as the final step. | <path_to_file>:4 |