Class: GherkinLint::TooManyTags

Inherits:
Linter
  • Object
show all
Includes:
TagCollector
Defined in:
lib/gherkin_lint/linter/too_many_tags.rb

Overview

service class to lint for too many tags

Instance Attribute Summary

Attributes inherited from Linter

#issues

Instance Method Summary collapse

Methods included from TagCollector

#gather_tags

Methods inherited from Linter

#add_error, #add_warning, #backgrounds, descendants, #elements, #features, #files, #filled_scenarios, #filter_tag, #initialize, #line, #lint_files, #name, #reference, #render_step, #render_step_argument, #scenarios, #steps, #suppress, #suppress_tags, #tag?

Constructor Details

This class inherits a constructor from GherkinLint::Linter

Instance Method Details

#lintObject



9
10
11
12
13
14
15
16
# File 'lib/gherkin_lint/linter/too_many_tags.rb', line 9

def lint
  scenarios do |file, feature, scenario|
    tags = gather_tags(feature) + gather_tags(scenario)
    next unless tags.length >= 3
    references = [reference(file, feature, scenario)]
    add_error(references, "Used #{tags.length} Tags")
  end
end