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,35 +1,35 @@
1
- module CukeLinter
2
-
3
- # A linter that detects backgrounds that have non-setup steps
4
- class BackgroundDoesMoreThanSetupLinter < Linter
5
-
6
- # Changes the linting settings on the linter using the provided configuration
7
- def configure(options)
8
- @when_keywords = options['When']
9
- @then_keywords = options['Then']
10
- end
11
-
12
- # The rule used to determine if a model has a problem
13
- def rule(model)
14
- return false unless model.is_a?(CukeModeler::Background)
15
-
16
- model.steps.map(&:keyword).any? { |keyword| when_keywords.include?(keyword) || then_keywords.include?(keyword) }
17
- end
18
-
19
- # The message used to describe the problem that has been found
20
- def message
21
- 'Background has non-setup steps'
22
- end
23
-
24
- private
25
-
26
- def when_keywords
27
- @when_keywords || [DEFAULT_WHEN_KEYWORD]
28
- end
29
-
30
- def then_keywords
31
- @then_keywords || [DEFAULT_THEN_KEYWORD]
32
- end
33
-
34
- end
35
- end
1
+ module CukeLinter
2
+
3
+ # A linter that detects backgrounds that have non-setup steps
4
+ class BackgroundDoesMoreThanSetupLinter < Linter
5
+
6
+ # Changes the linting settings on the linter using the provided configuration
7
+ def configure(options)
8
+ @when_keywords = options['When']
9
+ @then_keywords = options['Then']
10
+ end
11
+
12
+ # The rule used to determine if a model has a problem
13
+ def rule(model)
14
+ return false unless model.is_a?(CukeModeler::Background)
15
+
16
+ model.steps.map(&:keyword).any? { |keyword| when_keywords.include?(keyword) || then_keywords.include?(keyword) }
17
+ end
18
+
19
+ # The message used to describe the problem that has been found
20
+ def message
21
+ 'Background has non-setup steps'
22
+ end
23
+
24
+ private
25
+
26
+ def when_keywords
27
+ @when_keywords || [DEFAULT_WHEN_KEYWORD]
28
+ end
29
+
30
+ def then_keywords
31
+ @then_keywords || [DEFAULT_THEN_KEYWORD]
32
+ end
33
+
34
+ end
35
+ end
@@ -1,49 +1,49 @@
1
- module CukeLinter
2
-
3
- # A linter that detects Gherkin elements that have the same tag on all of their taggable child elements
4
- class ElementWithCommonTagsLinter < Linter
5
-
6
- # The rule used to determine if a model has a problem
7
- def rule(model)
8
- return false unless relevant_model?(model)
9
-
10
- @linted_model_class = model.class
11
- child_models = model.send(child_accessor_method(model)) || []
12
-
13
- tag_sets = child_models.collect { |child_model| child_model.tags || [] }
14
- tag_name_sets = tag_sets.collect { |tags| tags.map(&:name) }
15
-
16
- return false if tag_name_sets.count < 2
17
-
18
- !find_common_tag(tag_name_sets).nil?
19
- end
20
-
21
- # The message used to describe the problem that has been found
22
- def message
23
- class_name = @linted_model_class.name.split('::').last
24
-
25
- if class_name == 'Feature'
26
- "All tests in Feature have tag '#{@common_tag}'. Move tag to #{class_name} level."
27
- else
28
- "All Examples in Outline have tag '#{@common_tag}'. Move tag to #{class_name} level."
29
- end
30
- end
31
-
32
-
33
- private
34
-
35
-
36
- def relevant_model?(model)
37
- model.is_a?(CukeModeler::Feature) || model.is_a?(CukeModeler::Outline)
38
- end
39
-
40
- def child_accessor_method(model)
41
- model.is_a?(CukeModeler::Feature) ? :tests : :examples
42
- end
43
-
44
- def find_common_tag(tag_name_sets)
45
- @common_tag = tag_name_sets.reduce(:&).first
46
- end
47
-
48
- end
49
- end
1
+ module CukeLinter
2
+
3
+ # A linter that detects Gherkin elements that have the same tag on all of their taggable child elements
4
+ class ElementWithCommonTagsLinter < Linter
5
+
6
+ # The rule used to determine if a model has a problem
7
+ def rule(model) # rubocop:disable Metrics/CyclomaticComplexity -- Rules can be tightened up later
8
+ return false unless relevant_model?(model)
9
+
10
+ @linted_model_class = model.class
11
+ child_models = model.send(child_accessor_method(model)) || []
12
+
13
+ tag_sets = child_models.collect { |child_model| child_model.tags || [] }
14
+ tag_name_sets = tag_sets.collect { |tags| tags.map(&:name) }
15
+
16
+ return false if tag_name_sets.count < 2
17
+
18
+ !find_common_tag(tag_name_sets).nil?
19
+ end
20
+
21
+ # The message used to describe the problem that has been found
22
+ def message
23
+ class_name = @linted_model_class.name.split('::').last
24
+
25
+ if class_name == 'Feature'
26
+ "All tests in Feature have tag '#{@common_tag}'. Move tag to #{class_name} level."
27
+ else
28
+ "All Examples in Outline have tag '#{@common_tag}'. Move tag to #{class_name} level."
29
+ end
30
+ end
31
+
32
+
33
+ private
34
+
35
+
36
+ def relevant_model?(model)
37
+ model.is_a?(CukeModeler::Feature) || model.is_a?(CukeModeler::Outline)
38
+ end
39
+
40
+ def child_accessor_method(model)
41
+ model.is_a?(CukeModeler::Feature) ? :tests : :examples
42
+ end
43
+
44
+ def find_common_tag(tag_name_sets)
45
+ @common_tag = tag_name_sets.reduce(:&).first
46
+ end
47
+
48
+ end
49
+ end
@@ -1,48 +1,48 @@
1
- module CukeLinter
2
-
3
- # A linter that detects taggable Gherkin elements that have duplicate tags
4
- class ElementWithDuplicateTagsLinter < Linter
5
-
6
- # Changes the linting settings on the linter using the provided configuration
7
- def configure(options)
8
- @tag_inheritance = options['IncludeInheritedTags']
9
- end
10
-
11
- # The rule used to determine if a model has a problem
12
- def rule(model)
13
- return false unless relevant_model?(model)
14
-
15
- @linted_model_class = model.class
16
-
17
- relevant_tags = if @tag_inheritance
18
- model.all_tags
19
- else
20
- model.tags || []
21
- end
22
- tag_names = relevant_tags.map(&:name)
23
-
24
- @duplicate_tag = tag_names.find { |tag| tag_names.count(tag) > 1 }
25
-
26
- !@duplicate_tag.nil?
27
- end
28
-
29
- # The message used to describe the problem that has been found
30
- def message
31
- class_name = @linted_model_class.name.split('::').last
32
-
33
- "#{class_name} has duplicate tag '#{@duplicate_tag}'."
34
- end
35
-
36
-
37
- private
38
-
39
-
40
- def relevant_model?(model)
41
- model.is_a?(CukeModeler::Feature) ||
42
- model.is_a?(CukeModeler::Scenario) ||
43
- model.is_a?(CukeModeler::Outline) ||
44
- model.is_a?(CukeModeler::Example)
45
- end
46
-
47
- end
48
- end
1
+ module CukeLinter
2
+
3
+ # A linter that detects taggable Gherkin elements that have duplicate tags
4
+ class ElementWithDuplicateTagsLinter < Linter
5
+
6
+ # Changes the linting settings on the linter using the provided configuration
7
+ def configure(options)
8
+ @tag_inheritance = options['IncludeInheritedTags']
9
+ end
10
+
11
+ # The rule used to determine if a model has a problem
12
+ def rule(model)
13
+ return false unless relevant_model?(model)
14
+
15
+ @linted_model_class = model.class
16
+
17
+ relevant_tags = if @tag_inheritance
18
+ model.all_tags
19
+ else
20
+ model.tags || []
21
+ end
22
+ tag_names = relevant_tags.map(&:name)
23
+
24
+ @duplicate_tag = tag_names.find { |tag| tag_names.count(tag) > 1 }
25
+
26
+ !@duplicate_tag.nil?
27
+ end
28
+
29
+ # The message used to describe the problem that has been found
30
+ def message
31
+ class_name = @linted_model_class.name.split('::').last
32
+
33
+ "#{class_name} has duplicate tag '#{@duplicate_tag}'."
34
+ end
35
+
36
+
37
+ private
38
+
39
+
40
+ def relevant_model?(model)
41
+ model.is_a?(CukeModeler::Feature) ||
42
+ model.is_a?(CukeModeler::Scenario) ||
43
+ model.is_a?(CukeModeler::Outline) ||
44
+ model.is_a?(CukeModeler::Example)
45
+ end
46
+
47
+ end
48
+ end
@@ -1,46 +1,46 @@
1
- module CukeLinter
2
-
3
- # A linter that detects taggable Gherkin elements that have too many tags
4
- class ElementWithTooManyTagsLinter < Linter
5
-
6
- # Changes the linting settings on the linter using the provided configuration
7
- def configure(options)
8
- @tag_threshold = options['TagCountThreshold']
9
- @tag_inheritance = options['CountInheritedTags']
10
- end
11
-
12
- # The rule used to determine if a model has a problem
13
- def rule(model)
14
- return false unless relevant_model?(model)
15
-
16
- @linted_model_class = model.class
17
- @linted_tag_threshold = @tag_threshold || 5
18
- @linted_tag_count = if @tag_inheritance
19
- model.all_tags.count
20
- else
21
- model.tags.nil? ? 0 : model.tags.count
22
- end
23
-
24
- @linted_tag_count > @linted_tag_threshold
25
- end
26
-
27
- # The message used to describe the problem that has been found
28
- def message
29
- class_name = @linted_model_class.name.split('::').last
30
-
31
- "#{class_name} has too many tags. #{@linted_tag_count} tags found (max #{@linted_tag_threshold})."
32
- end
33
-
34
-
35
- private
36
-
37
-
38
- def relevant_model?(model)
39
- model.is_a?(CukeModeler::Feature) ||
40
- model.is_a?(CukeModeler::Scenario) ||
41
- model.is_a?(CukeModeler::Outline) ||
42
- model.is_a?(CukeModeler::Example)
43
- end
44
-
45
- end
46
- end
1
+ module CukeLinter
2
+
3
+ # A linter that detects taggable Gherkin elements that have too many tags
4
+ class ElementWithTooManyTagsLinter < Linter
5
+
6
+ # Changes the linting settings on the linter using the provided configuration
7
+ def configure(options)
8
+ @tag_threshold = options['TagCountThreshold']
9
+ @tag_inheritance = options['CountInheritedTags']
10
+ end
11
+
12
+ # The rule used to determine if a model has a problem
13
+ def rule(model)
14
+ return false unless relevant_model?(model)
15
+
16
+ @linted_model_class = model.class
17
+ @linted_tag_threshold = @tag_threshold || 5
18
+ @linted_tag_count = if @tag_inheritance
19
+ model.all_tags.count
20
+ else
21
+ model.tags.nil? ? 0 : model.tags.count
22
+ end
23
+
24
+ @linted_tag_count > @linted_tag_threshold
25
+ end
26
+
27
+ # The message used to describe the problem that has been found
28
+ def message
29
+ class_name = @linted_model_class.name.split('::').last
30
+
31
+ "#{class_name} has too many tags. #{@linted_tag_count} tags found (max #{@linted_tag_threshold})."
32
+ end
33
+
34
+
35
+ private
36
+
37
+
38
+ def relevant_model?(model)
39
+ model.is_a?(CukeModeler::Feature) ||
40
+ model.is_a?(CukeModeler::Scenario) ||
41
+ model.is_a?(CukeModeler::Outline) ||
42
+ model.is_a?(CukeModeler::Example)
43
+ end
44
+
45
+ end
46
+ end
@@ -1,19 +1,19 @@
1
- module CukeLinter
2
-
3
- # A linter that detects unnamed example groups
4
- class ExampleWithoutNameLinter < Linter
5
-
6
- # The rule used to determine if a model has a problem
7
- def rule(model)
8
- return false unless model.is_a?(CukeModeler::Example)
9
-
10
- model.name.nil? || model.name.empty?
11
- end
12
-
13
- # The message used to describe the problem that has been found
14
- def message
15
- 'Example grouping has no name'
16
- end
17
-
18
- end
19
- end
1
+ module CukeLinter
2
+
3
+ # A linter that detects unnamed example groups
4
+ class ExampleWithoutNameLinter < Linter
5
+
6
+ # The rule used to determine if a model has a problem
7
+ def rule(model)
8
+ return false unless model.is_a?(CukeModeler::Example)
9
+
10
+ model.name.nil? || model.name.empty?
11
+ end
12
+
13
+ # The message used to describe the problem that has been found
14
+ def message
15
+ 'Example grouping has no name'
16
+ end
17
+
18
+ end
19
+ end
@@ -1,20 +1,20 @@
1
- module CukeLinter
2
-
3
- # A linter that detects invalid feature file names
4
- class FeatureFileWithInvalidNameLinter < Linter
5
-
6
- # The rule used to determine if a model has a problem
7
- def rule(model)
8
- return false unless model.is_a?(CukeModeler::FeatureFile)
9
-
10
- base = File.basename model.path
11
- base =~ /[A-Z -]/
12
- end
13
-
14
- # The message used to describe the problem that has been found
15
- def message
16
- 'Feature files should be snake_cased.'
17
- end
18
-
19
- end
20
- end
1
+ module CukeLinter
2
+
3
+ # A linter that detects invalid feature file names
4
+ class FeatureFileWithInvalidNameLinter < Linter
5
+
6
+ # The rule used to determine if a model has a problem
7
+ def rule(model)
8
+ return false unless model.is_a?(CukeModeler::FeatureFile)
9
+
10
+ base = File.basename model.path
11
+ base =~ /[A-Z -]/
12
+ end
13
+
14
+ # The message used to describe the problem that has been found
15
+ def message
16
+ 'Feature files should be snake_cased.'
17
+ end
18
+
19
+ end
20
+ end
@@ -1,25 +1,25 @@
1
- module CukeLinter
2
-
3
- # A linter that detects mismatched feature file names
4
- class FeatureFileWithMismatchedNameLinter < Linter
5
-
6
- # The rule used to determine if a model has a problem
7
- def rule(model)
8
- return false unless model.is_a?(CukeModeler::FeatureFile)
9
-
10
- file_name = File.basename(model.path, '.feature')
11
- feature_name = model.feature.name
12
-
13
- normalized_file_name = file_name.downcase.delete('_ -')
14
- normalized_feature_name = feature_name.downcase.delete('_ -')
15
-
16
- normalized_file_name != normalized_feature_name
17
- end
18
-
19
- # The message used to describe the problem that has been found
20
- def message
21
- 'Feature file name does not match feature name.'
22
- end
23
-
24
- end
25
- end
1
+ module CukeLinter
2
+
3
+ # A linter that detects mismatched feature file names
4
+ class FeatureFileWithMismatchedNameLinter < Linter
5
+
6
+ # The rule used to determine if a model has a problem
7
+ def rule(model)
8
+ return false unless model.is_a?(CukeModeler::FeatureFile)
9
+
10
+ file_name = File.basename(model.path, '.feature')
11
+ feature_name = model.feature.name
12
+
13
+ normalized_file_name = file_name.downcase.delete('_ -')
14
+ normalized_feature_name = feature_name.downcase.delete('_ -')
15
+
16
+ normalized_file_name != normalized_feature_name
17
+ end
18
+
19
+ # The message used to describe the problem that has been found
20
+ def message
21
+ 'Feature file name does not match feature name.'
22
+ end
23
+
24
+ end
25
+ end
@@ -1,35 +1,35 @@
1
- module CukeLinter
2
-
3
- # A linter that detects features that contain too many different tags
4
- class FeatureWithTooManyDifferentTagsLinter < Linter
5
-
6
- # Changes the linting settings on the linter using the provided configuration
7
- def configure(options)
8
- @tag_threshold = options['TagCountThreshold']
9
- end
10
-
11
- # The rule used to determine if a model has a problem
12
- def rule(model)
13
- return false unless model.is_a?(CukeModeler::Feature)
14
-
15
- tags = model.tags
16
-
17
- model.each_descendant do |descendant_model|
18
- tags.concat(descendant_model.tags) if descendant_model.respond_to?(:tags)
19
- end
20
-
21
- tags = tags.collect(&:name).uniq
22
-
23
- @linted_tag_threshold = @tag_threshold || 10
24
- @linted_tag_count = tags.count
25
-
26
- @linted_tag_count > @linted_tag_threshold
27
- end
28
-
29
- # The message used to describe the problem that has been found
30
- def message
31
- "Feature contains too many different tags. #{@linted_tag_count} tags found (max #{@linted_tag_threshold})."
32
- end
33
-
34
- end
35
- end
1
+ module CukeLinter
2
+
3
+ # A linter that detects features that contain too many different tags
4
+ class FeatureWithTooManyDifferentTagsLinter < Linter
5
+
6
+ # Changes the linting settings on the linter using the provided configuration
7
+ def configure(options)
8
+ @tag_threshold = options['TagCountThreshold']
9
+ end
10
+
11
+ # The rule used to determine if a model has a problem
12
+ def rule(model)
13
+ return false unless model.is_a?(CukeModeler::Feature)
14
+
15
+ tags = model.tags
16
+
17
+ model.each_descendant do |descendant_model|
18
+ tags.concat(descendant_model.tags) if descendant_model.respond_to?(:tags)
19
+ end
20
+
21
+ tags = tags.collect(&:name).uniq
22
+
23
+ @linted_tag_threshold = @tag_threshold || 10
24
+ @linted_tag_count = tags.count
25
+
26
+ @linted_tag_count > @linted_tag_threshold
27
+ end
28
+
29
+ # The message used to describe the problem that has been found
30
+ def message
31
+ "Feature contains too many different tags. #{@linted_tag_count} tags found (max #{@linted_tag_threshold})."
32
+ end
33
+
34
+ end
35
+ end
@@ -1,19 +1,19 @@
1
- module CukeLinter
2
-
3
- # A linter that detects features that don't have a description
4
- class FeatureWithoutDescriptionLinter < Linter
5
-
6
- # The rule used to determine if a model has a problem
7
- def rule(model)
8
- return false unless model.is_a?(CukeModeler::Feature)
9
-
10
- model.description.nil? || model.description.empty?
11
- end
12
-
13
- # The message used to describe the problem that has been found
14
- def message
15
- 'Feature has no description'
16
- end
17
-
18
- end
19
- end
1
+ module CukeLinter
2
+
3
+ # A linter that detects features that don't have a description
4
+ class FeatureWithoutDescriptionLinter < Linter
5
+
6
+ # The rule used to determine if a model has a problem
7
+ def rule(model)
8
+ return false unless model.is_a?(CukeModeler::Feature)
9
+
10
+ model.description.nil? || model.description.empty?
11
+ end
12
+
13
+ # The message used to describe the problem that has been found
14
+ def message
15
+ 'Feature has no description'
16
+ end
17
+
18
+ end
19
+ end
@@ -1,19 +1,19 @@
1
- module CukeLinter
2
-
3
- # A linter that detects features that don't have a name
4
- class FeatureWithoutNameLinter < Linter
5
-
6
- # The rule used to determine if a model has a problem
7
- def rule(model)
8
- return false unless model.is_a?(CukeModeler::Feature)
9
-
10
- model.name.nil? || model.name.empty?
11
- end
12
-
13
- # The message used to describe the problem that has been found
14
- def message
15
- 'Feature does not have a name.'
16
- end
17
-
18
- end
19
- end
1
+ module CukeLinter
2
+
3
+ # A linter that detects features that don't have a name
4
+ class FeatureWithoutNameLinter < Linter
5
+
6
+ # The rule used to determine if a model has a problem
7
+ def rule(model)
8
+ return false unless model.is_a?(CukeModeler::Feature)
9
+
10
+ model.name.nil? || model.name.empty?
11
+ end
12
+
13
+ # The message used to describe the problem that has been found
14
+ def message
15
+ 'Feature does not have a name.'
16
+ end
17
+
18
+ end
19
+ end