Class: GherkinLint::TagUsedMultipleTimes
- Defined in:
- lib/gherkin_lint/linter/tag_used_multiple_times.rb
Overview
service class to lint for tags used multiple times
Instance Attribute Summary
Attributes inherited from Linter
Instance Method Summary collapse
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
#lint ⇒ Object
6 7 8 9 10 11 12 13 14 |
# File 'lib/gherkin_lint/linter/tag_used_multiple_times.rb', line 6 def lint scenarios do |file, feature, scenario| references = [reference(file, feature, scenario)] = (feature) + (scenario) = .find_all { |a| .count(a) > 1 }.uniq! next if .nil? add_error(references, "Tag #{.join(' and ')} used multiple times") end end |
#tags(element) ⇒ Object
16 17 18 19 |
# File 'lib/gherkin_lint/linter/tag_used_multiple_times.rb', line 16 def (element) return [] unless element.include? :tags element[:tags].map { |a| a[:name] } end |