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.78.0 lib/cc/analyzer/engine_output_filter.rb
codeclimate-0.77.0 lib/cc/analyzer/engine_output_filter.rb
codeclimate-0.76.0 lib/cc/analyzer/engine_output_filter.rb
codeclimate-0.75.0 lib/cc/analyzer/engine_output_filter.rb
codeclimate-0.74.0 lib/cc/analyzer/engine_output_filter.rb
codeclimate-0.73.0 lib/cc/analyzer/engine_output_filter.rb
codeclimate-0.72.0 lib/cc/analyzer/engine_output_filter.rb
codeclimate-0.71.2 lib/cc/analyzer/engine_output_filter.rb
codeclimate-0.71.1 lib/cc/analyzer/engine_output_filter.rb
codeclimate-0.71.0 lib/cc/analyzer/engine_output_filter.rb
codeclimate-0.70.6 lib/cc/analyzer/engine_output_filter.rb
codeclimate-0.70.5 lib/cc/analyzer/engine_output_filter.rb
codeclimate-0.70.4 lib/cc/analyzer/engine_output_filter.rb
codeclimate-0.70.3 lib/cc/analyzer/engine_output_filter.rb
codeclimate-0.70.2 lib/cc/analyzer/engine_output_filter.rb
codeclimate-0.70.1 lib/cc/analyzer/engine_output_filter.rb
codeclimate-0.70.0 lib/cc/analyzer/engine_output_filter.rb
codeclimate-0.69.0 lib/cc/analyzer/engine_output_filter.rb
codeclimate-0.68.0 lib/cc/analyzer/engine_output_filter.rb
codeclimate-0.67.0 lib/cc/analyzer/engine_output_filter.rb