Sha256: 2c46611390646435d0f4b064a1ed3cc8d1b191e4f9ffdb9a16fd4debc863ac54

Contents?: true

Size: 676 Bytes

Versions: 1

Compression:

Stored size: 676 Bytes

Contents

module Pluginscan
  # Wraps a couple of helper methods around an array of issues
  class Issues
    include Enumerable

    def initialize(issues)
      @issues = issues
    end

    def each(&block)
      @issues.each(&block)
    end

    def scanned_files_count
      @issues.count
    end

    def found_problems_count
      found_problems.reduce(0){ |count, (_file, file_findings)| count + file_findings.map(&:count).reduce(:+) }
    end

    private def files
      @issues.keys
    end

    private def found_problems
      # Ignore files which didn't have any problems
      Issues.new(@issues.select { |_file, file_findings| !file_findings.empty? })
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
pluginscan-0.9.0 lib/pluginscan/reports/issues_report/issues_models/issues.rb