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.85.27 lib/cc/analyzer/engine_output_filter.rb
codeclimate-0.85.26 lib/cc/analyzer/engine_output_filter.rb
codeclimate-0.85.25 lib/cc/analyzer/engine_output_filter.rb
codeclimate-0.85.24 lib/cc/analyzer/engine_output_filter.rb
codeclimate-fede-0.85.54 lib/cc/analyzer/engine_output_filter.rb
codeclimate-fede-0.85.53 lib/cc/analyzer/engine_output_filter.rb
codeclimate-fede-0.85.52 lib/cc/analyzer/engine_output_filter.rb
codeclimate-fede-0.85.51 lib/cc/analyzer/engine_output_filter.rb
codeclimate-fede-0.85.50 lib/cc/analyzer/engine_output_filter.rb
codeclimate-fede-0.85.49 lib/cc/analyzer/engine_output_filter.rb
codeclimate-fede-0.85.48 lib/cc/analyzer/engine_output_filter.rb
codeclimate-fede-0.85.47 lib/cc/analyzer/engine_output_filter.rb
codeclimate-fede-0.85.46 lib/cc/analyzer/engine_output_filter.rb
codeclimate-fede-0.85.45 lib/cc/analyzer/engine_output_filter.rb
codeclimate-fede-0.85.44 lib/cc/analyzer/engine_output_filter.rb
codeclimate-fede-0.85.43 lib/cc/analyzer/engine_output_filter.rb
codeclimate-fede-0.85.42 lib/cc/analyzer/engine_output_filter.rb
codeclimate-fede-0.85.41 lib/cc/analyzer/engine_output_filter.rb
codeclimate-fede-0.85.40 lib/cc/analyzer/engine_output_filter.rb
codeclimate-fede-0.85.39 lib/cc/analyzer/engine_output_filter.rb