Class: CukeLinter::FeatureWithTooManyDifferentTagsLinter
- Defined in:
- lib/cuke_linter/linters/feature_with_too_many_different_tags_linter.rb
Overview
A linter that detects features that contain too many different tags
Instance Attribute Summary
Attributes inherited from Linter
Instance Method Summary collapse
-
#configure(options) ⇒ Object
Changes the linting settings on the linter using the provided configuration.
-
#message ⇒ Object
The message used to describe the problem that has been found.
-
#rule(model) ⇒ Object
The rule used to determine if a model has a problem.
Methods inherited from Linter
Constructor Details
This class inherits a constructor from CukeLinter::Linter
Instance Method Details
#configure(options) ⇒ Object
Changes the linting settings on the linter using the provided configuration
7 8 9 |
# File 'lib/cuke_linter/linters/feature_with_too_many_different_tags_linter.rb', line 7 def configure() @tag_threshold = ['TagCountThreshold'] end |
#message ⇒ Object
The message used to describe the problem that has been found
30 31 32 |
# File 'lib/cuke_linter/linters/feature_with_too_many_different_tags_linter.rb', line 30 def "Feature contains too many different tags. #{@linted_tag_count} tags found (max #{@linted_tag_threshold})." end |
#rule(model) ⇒ Object
The rule used to determine if a model has a problem
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/cuke_linter/linters/feature_with_too_many_different_tags_linter.rb', line 12 def rule(model) return false unless model.is_a?(CukeModeler::Feature) = model. model.each_descendant do |descendant_model| .concat(descendant_model.) if descendant_model.respond_to?(:tags) end = .collect(&:name).uniq @linted_tag_threshold = @tag_threshold || 10 @linted_tag_count = .count @linted_tag_count > @linted_tag_threshold end |