Class: Chutney::SameTagDifferentCase
- Defined in:
- lib/chutney/linter/same_tag_different_case.rb
Overview
service class to lint for missing verifications
Instance Attribute Summary
Attributes inherited from Linter
#configuration, #filename, #issues
Instance Method Summary collapse
Methods inherited from Linter
#add_issue, #and_word?, #background, #background_word?, #but_word?, descendants, #dialect, #dialect_word, #elements, #examples_word?, #feature, #feature_word?, #filled_scenarios, #given_word?, #initialize, linter_name, #linter_name, #location, #off_switch?, #render_step, #render_step_argument, #scenario_outline_word?, #scenarios, #steps, #tags_for, #then_word?, #type, #when_word?
Constructor Details
This class inherits a constructor from Chutney::Linter
Instance Method Details
#all_known_tags ⇒ Object
8 9 10 11 12 |
# File 'lib/chutney/linter/same_tag_different_case.rb', line 8 def # rubocop:disable Style/ClassVars @@all_known_tags ||= [] # rubocop:enable Style/ClassVars end |
#case_collision(tag) ⇒ Object
31 32 33 34 35 |
# File 'lib/chutney/linter/same_tag_different_case.rb', line 31 def case_collision(tag) return nil if .include?(tag) .select { |t| t.casecmp(tag).zero? }.first end |
#lint ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/chutney/linter/same_tag_different_case.rb', line 14 def lint scenarios do |feature, scenario| = (feature) + (scenario) .each do |tag| collision_with = case_collision(tag) if collision_with add_issue(I18n.t('linters.same_tag_different_case', existing_tag: collision_with, tag:), feature, scenario) else @@all_known_tags << tag end end end end |