Class: GherkinLint::SameTagForAllScenarios
- Defined in:
- lib/gherkin_lint.rb
Overview
service class to lint for using same tag on all scenarios
Instance Attribute Summary
Attributes inherited from Linter
Instance Method Summary collapse
Methods inherited from Linter
#add_issue, #backgrounds, #features, #files, #filled_scenarios, #gather_tags, #initialize, #line, #lint_files, #name, #reference, #render_step, #scenarios, #steps
Constructor Details
This class inherits a constructor from GherkinLint::Linter
Instance Method Details
#gather_same_tags(feature) ⇒ Object
539 540 541 542 543 544 545 546 547 548 549 550 |
# File 'lib/gherkin_lint.rb', line 539 def (feature) result = nil return result unless feature.include? 'elements' feature['elements'].each do |scenario| next if scenario['keyword'] == 'Background' return nil unless scenario.include? 'tags' = scenario['tags'].map { |tag| tag['name'] } result = if result.nil? result &= end result end |
#lint ⇒ Object
526 527 528 529 530 531 532 533 534 535 536 537 |
# File 'lib/gherkin_lint.rb', line 526 def lint features do |file, feature| = feature next if .nil? next if .length < 1 next unless feature['elements'].length > 1 references = [reference(file, feature)] .each do |tag| add_issue(references, "Tag '#{tag}' should be used at Feature level") end end end |