Class: Chutney::RequiredTagsStartsWith
- Defined in:
- lib/chutney/linter/required_tags_starts_with.rb
Overview
service class to lint for tags used multiple times
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
#lint ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/chutney/linter/required_tags_starts_with.rb', line 6 def lint return unless pattern scenarios do |feature, scenario| next if match_pattern? (feature) next if match_pattern? (scenario) add_issue( I18n.t('linters.required_tags_starts_with', allowed: pattern.join(', ')), feature, scenario ) end end |
#match_pattern?(target) ⇒ Boolean
25 26 27 28 29 30 |
# File 'lib/chutney/linter/required_tags_starts_with.rb', line 25 def match_pattern?(target) target.each do |t| return true if t.start_with?(*pattern) end false end |
#pattern ⇒ Object
21 22 23 |
# File 'lib/chutney/linter/required_tags_starts_with.rb', line 21 def pattern configuration['Matcher'] || nil end |