Sha256: b8dcd7a141cc89cf8adb10a02d7598b240328e378370607d7a134eab20fb85bb

Contents?: true

Size: 588 Bytes

Versions: 7

Compression:

Stored size: 588 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

7 entries across 7 versions & 1 rubygems

Version Path
chutney-2.1.0 lib/chutney/linter/too_many_different_tags.rb
chutney-2.0.3.1 lib/chutney/linter/too_many_different_tags.rb
chutney-2.0.3 lib/chutney/linter/too_many_different_tags.rb
chutney-2.0.2 lib/chutney/linter/too_many_different_tags.rb
chutney-2.0.1 lib/chutney/linter/too_many_different_tags.rb
chutney-2.0.0 lib/chutney/linter/too_many_different_tags.rb
chutney-2.0.0.rc1 lib/chutney/linter/too_many_different_tags.rb