class Chutney::RequiredTagsStartsWith

service class to lint for tags used multiple times

Public Instance Methods

lint() click to toggle source
# File lib/chutney/linter/required_tags_starts_with.rb, line 6
def lint
  return unless pattern

  scenarios do |feature, scenario|
    next if match_pattern? tags_for(feature)
    next if match_pattern? tags_for(scenario)

    add_issue(
      I18n.t('linters.required_tags_starts_with',
             allowed: pattern.join(', ')),
      feature, scenario
    )
  end
end
match_pattern?(target) click to toggle source
# 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() click to toggle source
# File lib/chutney/linter/required_tags_starts_with.rb, line 21
def pattern
  configuration['Matcher'] || nil
end