class CukeLinter::FeatureWithTooManyDifferentTagsLinter
A linter that detects features that contain too many different tags
Public Instance Methods
configure(options)
click to toggle source
Changes the linting settings on the linter using the provided configuration
# File lib/cuke_linter/linters/feature_with_too_many_different_tags_linter.rb, line 8 def configure(options) @tag_threshold = options['TagCountThreshold'] end
message()
click to toggle source
The message used to describe the problem that has been found
# File lib/cuke_linter/linters/feature_with_too_many_different_tags_linter.rb, line 31 def message "Feature contains too many different tags. #{@linted_tag_count} tags found (max #{@linted_tag_threshold})." end
rule(model)
click to toggle source
The rule used to determine if a model has a problem
# File lib/cuke_linter/linters/feature_with_too_many_different_tags_linter.rb, line 13 def rule(model) return false unless model.is_a?(CukeModeler::Feature) tags = model.tags model.each_descendant do |descendant_model| tags.concat(descendant_model.tags) if descendant_model.respond_to?(:tags) end tags = tags.collect(&:name).uniq @linted_tag_threshold = @tag_threshold || 10 @linted_tag_count = tags.count @linted_tag_count > @linted_tag_threshold end