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,202 +1,202 @@
1
- Feature: Using cuke_linter on the command line
2
-
3
- Linting functionality can be used directly from the command line.
4
-
5
-
6
- Scenario: Linting features
7
-
8
- Note: By default, linting will be done in the current directory using all linters and 'pretty' formatter.
9
-
10
- Given the cuke_linter executable is available
11
- When the following command is executed:
12
- """
13
- cuke_linter
14
- """
15
- Then a linting report will be made for all features
16
-
17
- Scenario: Accessing command line help
18
- Given the cuke_linter executable is available
19
- When the following command is executed:
20
- """
21
- cuke_linter -h
22
- """
23
- Then the following help is displayed:
24
- """
25
- Usage: cuke_linter [options]
26
- -p, --path PATH The file path that should be linted. Can be a file or directory.
27
- This option can be specified multiple times in order to lint
28
- multiple, unconnected locations.
29
- -f, --formatter FORMATTER The formatter used for generating linting output. This option
30
- can be specified multiple times in order to use more than one
31
- formatter. Formatters must be specified using their fully
32
- qualified class name (e.g CukeLinter::PrettyFormatter). Uses
33
- the default formatter if none are specified.
34
- -o, --out OUT The file path to which linting results are output. Can be specified
35
- multiple times. Specified files are matched to formatters in the
36
- same order that the formatters are specified. Any formatter without
37
- a corresponding file path will output to STDOUT instead.
38
- -r, --require FILEPATH A file that will be required before further processing. Likely
39
- needed when using custom linters or formatters in order to ensure
40
- that the specified classes have been read into memory. This option
41
- can be specified multiple times in order to load more than one file.
42
- -c, --config FILEPATH The configuration file that will be used. Will use the default
43
- configuration file (if present) if this option is not specified.
44
- -h, --help Display the help that you are reading now.
45
- -v, --version Display the version of the gem being used.
46
- """
47
-
48
- Scenario: Checking the version of CukeLinter
49
- Given the cuke_linter executable is available
50
- When the following command is executed:
51
- """
52
- cuke_linter -v
53
- """
54
- Then the version of the tool is displayed:
55
- """
56
- <major>.<minor>.<patch>
57
- """
58
-
59
- Scenario: Specifying directories and files to lint
60
- Given the following feature file "some_feature.feature":
61
- """
62
- Feature: Some feature
63
- Scenario: A scenario
64
- When a step
65
- Then a step
66
- """
67
- And the following feature file "a_directory/with/some_feature.feature":
68
- """
69
- Feature: Some feature
70
- Scenario: A scenario
71
- When a step
72
- Then a step
73
- """
74
- When the following command is executed:
75
- """
76
- cuke_linter -p <path_to>/some_feature.feature -p <path_to>/a_directory
77
- """
78
- Then the resulting output is the following:
79
- """
80
- FeatureWithoutDescriptionLinter
81
- Feature has no description
82
- <path_to>/a_directory/with/some_feature.feature:1
83
- <path_to>/some_feature.feature:1
84
-
85
- 2 issues found
86
- """
87
-
88
- Scenario: Loading additional files
89
- Given the following file "some_important_file.rb":
90
- """
91
- puts 'I got loaded!'
92
- """
93
- When the following command is executed:
94
- """
95
- cuke_linter -r <path_to>/some_important_file.rb
96
- """
97
- Then the resulting output will include the following:
98
- """
99
- I got loaded!
100
- """
101
-
102
- Scenario: Specifying a formatter to use
103
-
104
- Note: The file containing the formatter class will have to be explicitly loaded if not using one
105
- of the built in formatters
106
-
107
- Given the following feature file "some.feature":
108
- """
109
- Feature: This feature will have linted problems
110
- """
111
- And the following file "my_custom_formatter.rb":
112
- """
113
- class MyCustomFormatter
114
- def format(data)
115
- puts "Formatting done by #{self.class}"
116
- end
117
- end
118
- """
119
- When the following command is executed:
120
- """
121
- cuke_linter -p <path_to>/some.feature -f MyCustomFormatter -r <path_to>/my_custom_formatter.rb
122
- """
123
- Then the resulting output is the following:
124
- """
125
- Formatting done by MyCustomFormatter
126
- """
127
-
128
- Scenario: Redirecting output
129
- Given the cuke_linter executable is available
130
- When the following command is executed:
131
- """
132
- cuke_linter -o <path_to>/my_report.txt
133
- """
134
- Then the linting report will be output to "<path_to>/my_report.txt"
135
-
136
- Scenario: Redirecting output for specific formatters
137
-
138
- Note: Formatters match to output locations in the same order that they are specified. Formatters
139
- that do not have their output location specified will output to STDOUT. Output locations
140
- that are not matched to a formatter will use the default formatter.
141
-
142
- Given the following feature file "some.feature":
143
- """
144
- Feature: This feature will have linted problems
145
- """
146
- And the following file "my_custom_formatters.rb":
147
- """
148
- class MyCustomFormatter
149
- def format(data)
150
- "Formatting done by #{self.class}"
151
- end
152
- end
153
-
154
- class MyOtherCustomFormatter
155
- def format(data)
156
- "Formatting done by #{self.class}"
157
- end
158
- end
159
- """
160
- When the following command is executed:
161
- """
162
- cuke_linter -p <path_to>/some.feature -f MyCustomFormatter -f MyOtherCustomFormatter -o <path_to>/my_report.txt -r <path_to>/my_custom_formatters.rb
163
- """
164
- Then the resulting output is the following:
165
- """
166
- Formatting done by MyOtherCustomFormatter
167
- """
168
- And the file "<path_to>/my_report.txt" contains:
169
- """
170
- Formatting done by MyCustomFormatter
171
- """
172
-
173
- Scenario: Specifying a configuration file
174
-
175
- Note: If not specified, the default configuration file, if present, will be used
176
-
177
- Given the following feature file "has_no_scenarios.feature":
178
- """
179
- Feature: Has no scenarios
180
- Not a single one
181
- """
182
- And the following configuration file "my_config.file":
183
- """
184
- FeatureWithoutScenariosLinter:
185
- Enabled: false
186
- """
187
- When the following command is executed:
188
- """
189
- cuke_linter -p <path_to>/has_no_scenarios.feature -c <path_to>/my_config.file
190
- """
191
- Then the resulting output is the following:
192
- """
193
- 0 issues found
194
- """
195
-
196
- Scenario: Interpreting exit codes
197
- When the executable finds no linting problems
198
- Then the exit code is "0"
199
- When the executable finds linting problems
200
- Then the exit code is "1"
201
- When the executable has a problem
202
- Then the exit code is "2"
1
+ Feature: Using cuke_linter on the command line
2
+
3
+ Linting functionality can be used directly from the command line.
4
+
5
+
6
+ Scenario: Linting features
7
+
8
+ Note: By default, linting will be done in the current directory using all linters and 'pretty' formatter.
9
+
10
+ Given the cuke_linter executable is available
11
+ When the following command is executed:
12
+ """
13
+ cuke_linter
14
+ """
15
+ Then a linting report will be made for all features
16
+
17
+ Scenario: Accessing command line help
18
+ Given the cuke_linter executable is available
19
+ When the following command is executed:
20
+ """
21
+ cuke_linter -h
22
+ """
23
+ Then the following help is displayed:
24
+ """
25
+ Usage: cuke_linter [options]
26
+ -p, --path PATH The file path that should be linted. Can be a file or directory.
27
+ This option can be specified multiple times in order to lint
28
+ multiple, unconnected locations.
29
+ -f, --formatter FORMATTER The formatter used for generating linting output. This option
30
+ can be specified multiple times in order to use more than one
31
+ formatter. Formatters must be specified using their fully
32
+ qualified class name (e.g CukeLinter::PrettyFormatter). Uses
33
+ the default formatter if none are specified.
34
+ -o, --out OUT The file path to which linting results are output. Can be specified
35
+ multiple times. Specified files are matched to formatters in the
36
+ same order that the formatters are specified. Any formatter without
37
+ a corresponding file path will output to STDOUT instead.
38
+ -r, --require FILEPATH A file that will be required before further processing. Likely
39
+ needed when using custom linters or formatters in order to ensure
40
+ that the specified classes have been read into memory. This option
41
+ can be specified multiple times in order to load more than one file.
42
+ -c, --config FILEPATH The configuration file that will be used. Will use the default
43
+ configuration file (if present) if this option is not specified.
44
+ -h, --help Display the help that you are reading now.
45
+ -v, --version Display the version of the gem being used.
46
+ """
47
+
48
+ Scenario: Checking the version of CukeLinter
49
+ Given the cuke_linter executable is available
50
+ When the following command is executed:
51
+ """
52
+ cuke_linter -v
53
+ """
54
+ Then the version of the tool is displayed:
55
+ """
56
+ <major>.<minor>.<patch>
57
+ """
58
+
59
+ Scenario: Specifying directories and files to lint
60
+ Given the following feature file "some_feature.feature":
61
+ """
62
+ Feature: Some feature
63
+ Scenario: A scenario
64
+ When a step
65
+ Then a step
66
+ """
67
+ And the following feature file "a_directory/with/some_feature.feature":
68
+ """
69
+ Feature: Some feature
70
+ Scenario: A scenario
71
+ When a step
72
+ Then a step
73
+ """
74
+ When the following command is executed:
75
+ """
76
+ cuke_linter -p <path_to>/some_feature.feature -p <path_to>/a_directory
77
+ """
78
+ Then the resulting output is the following:
79
+ """
80
+ FeatureWithoutDescriptionLinter
81
+ Feature has no description
82
+ <path_to>/a_directory/with/some_feature.feature:1
83
+ <path_to>/some_feature.feature:1
84
+
85
+ 2 issues found
86
+ """
87
+
88
+ Scenario: Loading additional files
89
+ Given the following file "some_important_file.rb":
90
+ """
91
+ puts 'I got loaded!'
92
+ """
93
+ When the following command is executed:
94
+ """
95
+ cuke_linter -r <path_to>/some_important_file.rb
96
+ """
97
+ Then the resulting output will include the following:
98
+ """
99
+ I got loaded!
100
+ """
101
+
102
+ Scenario: Specifying a formatter to use
103
+
104
+ Note: The file containing the formatter class will have to be explicitly loaded if not using one
105
+ of the built in formatters
106
+
107
+ Given the following feature file "some.feature":
108
+ """
109
+ Feature: This feature will have linted problems
110
+ """
111
+ And the following file "my_custom_formatter.rb":
112
+ """
113
+ class MyCustomFormatter
114
+ def format(data)
115
+ puts "Formatting done by #{self.class}"
116
+ end
117
+ end
118
+ """
119
+ When the following command is executed:
120
+ """
121
+ cuke_linter -p <path_to>/some.feature -f MyCustomFormatter -r <path_to>/my_custom_formatter.rb
122
+ """
123
+ Then the resulting output is the following:
124
+ """
125
+ Formatting done by MyCustomFormatter
126
+ """
127
+
128
+ Scenario: Redirecting output
129
+ Given the cuke_linter executable is available
130
+ When the following command is executed:
131
+ """
132
+ cuke_linter -o <path_to>/my_report.txt
133
+ """
134
+ Then the linting report will be output to "<path_to>/my_report.txt"
135
+
136
+ Scenario: Redirecting output for specific formatters
137
+
138
+ Note: Formatters match to output locations in the same order that they are specified. Formatters
139
+ that do not have their output location specified will output to STDOUT. Output locations
140
+ that are not matched to a formatter will use the default formatter.
141
+
142
+ Given the following feature file "some.feature":
143
+ """
144
+ Feature: This feature will have linted problems
145
+ """
146
+ And the following file "my_custom_formatters.rb":
147
+ """
148
+ class MyCustomFormatter
149
+ def format(data)
150
+ "Formatting done by #{self.class}"
151
+ end
152
+ end
153
+
154
+ class MyOtherCustomFormatter
155
+ def format(data)
156
+ "Formatting done by #{self.class}"
157
+ end
158
+ end
159
+ """
160
+ When the following command is executed:
161
+ """
162
+ cuke_linter -p <path_to>/some.feature -f MyCustomFormatter -f MyOtherCustomFormatter -o <path_to>/my_report.txt -r <path_to>/my_custom_formatters.rb
163
+ """
164
+ Then the resulting output is the following:
165
+ """
166
+ Formatting done by MyOtherCustomFormatter
167
+ """
168
+ And the file "<path_to>/my_report.txt" contains:
169
+ """
170
+ Formatting done by MyCustomFormatter
171
+ """
172
+
173
+ Scenario: Specifying a configuration file
174
+
175
+ Note: If not specified, the default configuration file, if present, will be used
176
+
177
+ Given the following feature file "has_no_scenarios.feature":
178
+ """
179
+ Feature: Has no scenarios
180
+ Not a single one
181
+ """
182
+ And the following configuration file "my_config.file":
183
+ """
184
+ FeatureWithoutScenariosLinter:
185
+ Enabled: false
186
+ """
187
+ When the following command is executed:
188
+ """
189
+ cuke_linter -p <path_to>/has_no_scenarios.feature -c <path_to>/my_config.file
190
+ """
191
+ Then the resulting output is the following:
192
+ """
193
+ 0 issues found
194
+ """
195
+
196
+ Scenario: Interpreting exit codes
197
+ When the executable finds no linting problems
198
+ Then the exit code is "0"
199
+ When the executable finds linting problems
200
+ Then the exit code is "1"
201
+ When the executable has a problem
202
+ Then the exit code is "2"
@@ -1,58 +1,58 @@
1
- Feature: Configuration of linters
2
-
3
- Instead of having to modify the linting object directly in a script at runtime, a configuration file can
4
- be used so that specific linters can be configured in a more convenient, static manner. Some configurable
5
- properties are available across all linters while some are linter specific.
6
-
7
-
8
- Scenario: Disabling a linter
9
- Given a linter registered as "AlwaysFindsAProblem"
10
- And the following configuration file:
11
- """
12
- AlwaysFindsAProblem:
13
- Enabled: false
14
- """
15
- And the following feature:
16
- """
17
- Feature: Something in which a problem could exist
18
- """
19
- When the configuration file is used
20
- And the feature is linted
21
- Then no error is reported
22
-
23
- Scenario: Setting a common configuration for all linters
24
-
25
- Note: Any property could be set for all linters, but disabling them (and then re-enabling a select few) is
26
- one of the few things that you are likely to want to do to all linters.
27
-
28
- Given a linter registered as "AlwaysFindsAProblem"
29
- And the following configuration file:
30
- """
31
- AllLinters:
32
- Enabled: false
33
- """
34
- And the following feature:
35
- """
36
- Feature: Something in which a problem could exist
37
- """
38
- When the configuration file is used
39
- And the feature is linted
40
- Then no error is reported
41
-
42
- Scenario: Overriding a common configuration
43
- Given a linter registered as "AlwaysFindsAProblem"
44
- And the following configuration file:
45
- """
46
- AllLinters:
47
- Enabled: false
48
-
49
- AlwaysFindsAProblem:
50
- Enabled: true
51
- """
52
- And the following feature:
53
- """
54
- Feature: Something in which a problem could exist
55
- """
56
- When the configuration file is used
57
- And the feature is linted
58
- Then an error is reported
1
+ Feature: Configuration of linters
2
+
3
+ Instead of having to modify the linting object directly in a script at runtime, a configuration file can
4
+ be used so that specific linters can be configured in a more convenient, static manner. Some configurable
5
+ properties are available across all linters while some are linter specific.
6
+
7
+
8
+ Scenario: Disabling a linter
9
+ Given a linter registered as "AlwaysFindsAProblem"
10
+ And the following configuration file:
11
+ """
12
+ AlwaysFindsAProblem:
13
+ Enabled: false
14
+ """
15
+ And the following feature:
16
+ """
17
+ Feature: Something in which a problem could exist
18
+ """
19
+ When the configuration file is used
20
+ And the feature is linted
21
+ Then no error is reported
22
+
23
+ Scenario: Setting a common configuration for all linters
24
+
25
+ Note: Any property could be set for all linters, but disabling them (and then re-enabling a select few) is
26
+ one of the few things that you are likely to want to do to all linters.
27
+
28
+ Given a linter registered as "AlwaysFindsAProblem"
29
+ And the following configuration file:
30
+ """
31
+ AllLinters:
32
+ Enabled: false
33
+ """
34
+ And the following feature:
35
+ """
36
+ Feature: Something in which a problem could exist
37
+ """
38
+ When the configuration file is used
39
+ And the feature is linted
40
+ Then no error is reported
41
+
42
+ Scenario: Overriding a common configuration
43
+ Given a linter registered as "AlwaysFindsAProblem"
44
+ And the following configuration file:
45
+ """
46
+ AllLinters:
47
+ Enabled: false
48
+
49
+ AlwaysFindsAProblem:
50
+ Enabled: true
51
+ """
52
+ And the following feature:
53
+ """
54
+ Feature: Something in which a problem could exist
55
+ """
56
+ When the configuration file is used
57
+ And the feature is linted
58
+ Then an error is reported
@@ -1,55 +1,55 @@
1
- Feature: Locally scoping linters
2
-
3
- As a writer of documentation
4
- I want to be able to limit the scope of linters for certain portions of the documentation
5
- So that exceptions to rules can be made
6
-
7
- In addition to using configurations to change whether or not a given linter is used when linting, linters
8
- can be enabled/disabled for specific portions of a `.feature` file. To enable/disable one (or more) linters,
9
- add a comment line before the portion of the file where the change should apply. Add a comment with the
10
- opposite change at the point in the file when the default behavior should resume. Unless so countermanded,
11
- changes remain in effect for the remainder of the feature file.
12
-
13
-
14
- Scenario: Enabling/disabling a linter within a feature file
15
-
16
- Note: This example disables linters that are enabled by default but enabling a linter that is disabled by
17
- default works in the same manner
18
-
19
- Given the default linters are being used
20
- And a feature file model based on the following text:
21
- """
22
- # The comma is optional when listing linters. The following two lines are equivalent (although the second line is redundant in this case).
23
- # cuke_linter:disable CukeLinter::TestWithNoNameLinter, CukeLinter::FeatureWithoutDescriptionLinter
24
- # cuke_linter:disable CukeLinter::TestWithNoNameLinter CukeLinter::FeatureWithoutDescriptionLinter
25
-
26
- Feature: Feature with no description
27
-
28
- # cuke_linter:disable CukeLinter::ElementWithTooManyTagsLinter
29
- @tag_1 @tag_2 @tag_3 @tag_4 @tag_5 @tag_one_too_many
30
- Scenario:
31
- This scenario has no name and too many tags
32
-
33
- Given a step
34
- When a step
35
- Then a step
36
- # cuke_linter:enable CukeLinter::ElementWithTooManyTagsLinter
37
-
38
- @tag_1 @tag_2 @tag_3 @tag_4 @tag_5 @tag_one_too_many
39
- Scenario:
40
- This scenario also has no name and too many tags
41
-
42
- Given a step
43
- When a step
44
- Then a step
45
- """
46
- When the feature is linted
47
- Then the following problems are reported:
48
- | linter | problem | location |
49
- | ElementWithTooManyTagsLinter | Scenario has too many tags. 6 tags found (max 5). | <path_to_file>:18 |
50
- And the following problems are not reported:
51
- | linter | problem | location |
52
- | FeatureWithoutDescriptionLinter | Feature has no description | <path_to_file>:5 |
53
- | TestWithNoNameLinter | Test does not have a name. | <path_to_file>:9 |
54
- | TestWithNoNameLinter | Test does not have a name. | <path_to_file>:18 |
55
- | ElementWithTooManyTagsLinter | Scenario has too many tags. 6 tags found (max 5). | <path_to_file>:9 |
1
+ Feature: Locally scoping linters
2
+
3
+ As a writer of documentation
4
+ I want to be able to limit the scope of linters for certain portions of the documentation
5
+ So that exceptions to rules can be made
6
+
7
+ In addition to using configurations to change whether or not a given linter is used when linting, linters
8
+ can be enabled/disabled for specific portions of a `.feature` file. To enable/disable one (or more) linters,
9
+ add a comment line before the portion of the file where the change should apply. Add a comment with the
10
+ opposite change at the point in the file when the default behavior should resume. Unless so countermanded,
11
+ changes remain in effect for the remainder of the feature file.
12
+
13
+
14
+ Scenario: Enabling/disabling a linter within a feature file
15
+
16
+ Note: This example disables linters that are enabled by default but enabling a linter that is disabled by
17
+ default works in the same manner
18
+
19
+ Given the default linters are being used
20
+ And a feature file model based on the following text:
21
+ """
22
+ # The comma is optional when listing linters. The following two lines are equivalent (although the second line is redundant in this case).
23
+ # cuke_linter:disable CukeLinter::TestWithNoNameLinter, CukeLinter::FeatureWithoutDescriptionLinter
24
+ # cuke_linter:disable CukeLinter::TestWithNoNameLinter CukeLinter::FeatureWithoutDescriptionLinter
25
+
26
+ Feature: Feature with no description
27
+
28
+ # cuke_linter:disable CukeLinter::ElementWithTooManyTagsLinter
29
+ @tag_1 @tag_2 @tag_3 @tag_4 @tag_5 @tag_one_too_many
30
+ Scenario:
31
+ This scenario has no name and too many tags
32
+
33
+ Given a step
34
+ When a step
35
+ Then a step
36
+ # cuke_linter:enable CukeLinter::ElementWithTooManyTagsLinter
37
+
38
+ @tag_1 @tag_2 @tag_3 @tag_4 @tag_5 @tag_one_too_many
39
+ Scenario:
40
+ This scenario also has no name and too many tags
41
+
42
+ Given a step
43
+ When a step
44
+ Then a step
45
+ """
46
+ When the feature is linted
47
+ Then the following problems are reported:
48
+ | linter | problem | location |
49
+ | ElementWithTooManyTagsLinter | Scenario has too many tags. 6 tags found (max 5). | <path_to_file>:18 |
50
+ And the following problems are not reported:
51
+ | linter | problem | location |
52
+ | FeatureWithoutDescriptionLinter | Feature has no description | <path_to_file>:5 |
53
+ | TestWithNoNameLinter | Test does not have a name. | <path_to_file>:9 |
54
+ | TestWithNoNameLinter | Test does not have a name. | <path_to_file>:18 |
55
+ | ElementWithTooManyTagsLinter | Scenario has too many tags. 6 tags found (max 5). | <path_to_file>:9 |