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.12 lib/cc/analyzer/engine_output_filter.rb
codeclimate-0.85.11 lib/cc/analyzer/engine_output_filter.rb
codeclimate-0.85.10 lib/cc/analyzer/engine_output_filter.rb
codeclimate-0.85.9 lib/cc/analyzer/engine_output_filter.rb
codeclimate-0.85.8 lib/cc/analyzer/engine_output_filter.rb
codeclimate-0.85.7 lib/cc/analyzer/engine_output_filter.rb
codeclimate-0.85.6 lib/cc/analyzer/engine_output_filter.rb
codeclimate-0.85.5 lib/cc/analyzer/engine_output_filter.rb
codeclimate-0.85.4 lib/cc/analyzer/engine_output_filter.rb
codeclimate-0.85.3 lib/cc/analyzer/engine_output_filter.rb
codeclimate-0.85.2 lib/cc/analyzer/engine_output_filter.rb
codeclimate-0.85.1 lib/cc/analyzer/engine_output_filter.rb
codeclimate-0.85.0 lib/cc/analyzer/engine_output_filter.rb
codeclimate-0.84.0 lib/cc/analyzer/engine_output_filter.rb
codeclimate-0.83.0 lib/cc/analyzer/engine_output_filter.rb
codeclimate-0.82.0 lib/cc/analyzer/engine_output_filter.rb
codeclimate-0.81.0 lib/cc/analyzer/engine_output_filter.rb
codeclimate-0.80.0 lib/cc/analyzer/engine_output_filter.rb
codeclimate-0.79.0 lib/cc/analyzer/engine_output_filter.rb
codeclimate-0.78.1 lib/cc/analyzer/engine_output_filter.rb