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-0.96.0 lib/cc/analyzer/engine_output_filter.rb
codeclimate-0.95.0 lib/cc/analyzer/engine_output_filter.rb
codeclimate-0.94.1 lib/cc/analyzer/engine_output_filter.rb
codeclimate-0.94.0 lib/cc/analyzer/engine_output_filter.rb
codeclimate-0.93.0 lib/cc/analyzer/engine_output_filter.rb
codeclimate-0.92.1 lib/cc/analyzer/engine_output_filter.rb
codeclimate-0.92.0 lib/cc/analyzer/engine_output_filter.rb
codeclimate-0.91.0 lib/cc/analyzer/engine_output_filter.rb
codeclimate-0.90.0 lib/cc/analyzer/engine_output_filter.rb
codeclimate-0.89.0 lib/cc/analyzer/engine_output_filter.rb
codeclimate-0.88.0 lib/cc/analyzer/engine_output_filter.rb
codeclimate-0.87.5 lib/cc/analyzer/engine_output_filter.rb
codeclimate-0.87.4 lib/cc/analyzer/engine_output_filter.rb
codeclimate-0.87.3 lib/cc/analyzer/engine_output_filter.rb
codeclimate-0.87.2 lib/cc/analyzer/engine_output_filter.rb
codeclimate-0.87.1 lib/cc/analyzer/engine_output_filter.rb
codeclimate-0.87.0 lib/cc/analyzer/engine_output_filter.rb
codeclimate-0.86.0 lib/cc/analyzer/engine_output_filter.rb
codeclimate-0.85.29 lib/cc/analyzer/engine_output_filter.rb
codeclimate-0.85.28 lib/cc/analyzer/engine_output_filter.rb