class CukeLinter::ElementWithTooManyTagsLinter
A linter that detects taggable Gherkin elements that have too many 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/element_with_too_many_tags_linter.rb, line 8 def configure(options) @tag_threshold = options['TagCountThreshold'] @tag_inheritance = options['CountInheritedTags'] end
message()
click to toggle source
The message used to describe the problem that has been found
# File lib/cuke_linter/linters/element_with_too_many_tags_linter.rb, line 29 def message class_name = @linted_model_class.name.split('::').last "#{class_name} has too many 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/element_with_too_many_tags_linter.rb, line 14 def rule(model) return false unless relevant_model?(model) @linted_model_class = model.class @linted_tag_threshold = @tag_threshold || 5 @linted_tag_count = if @tag_inheritance model.all_tags.count else model.tags.nil? ? 0 : model.tags.count end @linted_tag_count > @linted_tag_threshold end
Private Instance Methods
relevant_model?(model)
click to toggle source
# File lib/cuke_linter/linters/element_with_too_many_tags_linter.rb, line 39 def relevant_model?(model) model.is_a?(CukeModeler::Feature) || model.is_a?(CukeModeler::Scenario) || model.is_a?(CukeModeler::Outline) || model.is_a?(CukeModeler::Example) end