Sha256: dd2cd9a0303e0e2fe21bce7ff7fddd7137bd2955e98cdaf3a9e7ad47cc61277f

Contents?: true

Size: 589 Bytes

Versions: 2

Compression:

Stored size: 589 Bytes

Contents

module Chutney
  # service class to lint for too many different tags
  class TooManyDifferentTags < Linter
    def lint
      tags = all_tags
      return if tags.length <= maxcount
      
      add_issue(
        I18n.t('linters.too_many_different_tags', count: tags.length, max: maxcount), 
        feature
      )
    end
    
    def maxcount 
      configuration['MaxCount']&.to_i || 3
    end
    
    def all_tags
      return [] unless feature&.include?(:children)
      
      tags_for(feature) + feature[:children].map { |scenario| tags_for(scenario) }.flatten
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
chutney-2.2.1 lib/chutney/linter/too_many_different_tags.rb
chutney-2.1.1 lib/chutney/linter/too_many_different_tags.rb