Sha256: ab0488fada76dc078124d6bcc0a64565c6e07e6b3ec7a6c8f5ce4807bbce8739

Contents?: true

Size: 834 Bytes

Versions: 105

Compression:

Stored size: 834 Bytes

Contents

module CC
  module Analyzer
    class EngineOutputFilter
      ISSUE_TYPE = "issue".freeze

      def initialize(config = {})
        @config = config
      end

      def filter?(output)
        output.blank? || (output.issue? && ignore_issue?(output.as_issue))
      end

      private

      def ignore_issue?(issue)
        check_disabled?(issue) || ignore_fingerprint?(issue)
      end

      def check_disabled?(issue)
        !check_config(issue.check_name).fetch("enabled", true)
      end

      def ignore_fingerprint?(issue)
        @config.fetch("exclude_fingerprints", []).include?(issue.fingerprint)
      rescue SourceExtractor::InvalidLocation
        false
      end

      def check_config(check_name)
        @checks ||= @config.fetch("checks", {})
        @checks.fetch(check_name, {})
      end
    end
  end
end

Version data entries

105 entries across 105 versions & 2 rubygems

Version Path
codeclimate-fede-0.85.38 lib/cc/analyzer/engine_output_filter.rb
codeclimate-fede-0.85.37 lib/cc/analyzer/engine_output_filter.rb
codeclimate-fede-0.85.36 lib/cc/analyzer/engine_output_filter.rb
codeclimate-fede-0.85.35 lib/cc/analyzer/engine_output_filter.rb
codeclimate-fede-0.85.33 lib/cc/analyzer/engine_output_filter.rb
codeclimate-fede-0.85.32 lib/cc/analyzer/engine_output_filter.rb
codeclimate-fede-0.85.31 lib/cc/analyzer/engine_output_filter.rb
codeclimate-fede-0.85.30 lib/cc/analyzer/engine_output_filter.rb
codeclimate-fede-0.85.21 lib/cc/analyzer/engine_output_filter.rb
codeclimate-fede-0.85.24 lib/cc/analyzer/engine_output_filter.rb
codeclimate-fede-0.85.23 lib/cc/analyzer/engine_output_filter.rb
codeclimate-0.85.23 lib/cc/analyzer/engine_output_filter.rb
codeclimate-0.85.22 lib/cc/analyzer/engine_output_filter.rb
codeclimate-0.85.21 lib/cc/analyzer/engine_output_filter.rb
codeclimate-0.85.19 lib/cc/analyzer/engine_output_filter.rb
codeclimate-0.85.18 lib/cc/analyzer/engine_output_filter.rb
codeclimate-0.85.17 lib/cc/analyzer/engine_output_filter.rb
codeclimate-0.85.15 lib/cc/analyzer/engine_output_filter.rb
codeclimate-0.85.14 lib/cc/analyzer/engine_output_filter.rb
codeclimate-0.85.13 lib/cc/analyzer/engine_output_filter.rb