Sha256: 15a5ff58eac36acb9a38a132c8e683bcbc0ffd02fea4f9e111c18abecca6fa41

Contents?: true

Size: 1.04 KB

Versions: 1

Compression:

Stored size: 1.04 KB

Contents

require 'pluginscan/reports/sloccount_report/sloccount'
require 'pluginscan/reports/sloccount_report/sloccount_scanner'
require 'pluginscan/reports/sloccount_report/sloccount_printer'
require 'pluginscan/error_printer'

module Pluginscan
  module Reports
    module SLOCCountReport
      def self.print(plugin_directory, printer, error_printer)
        sloccount = SLOCCountScanner.new.scan(plugin_directory)
        printer.print(sloccount)

      rescue SLOCCountScanner::Unavailable
        error_printer.print("The 'sloccount' command is unavailable. Is it installed and in your path?")
      rescue SLOCCountScanner::Exception => e
        error_printer.print("An error occurred while calculating the SLOCCount:\n          #{e.message}")
      rescue StandardError => e
        # We don't want an error with CLOC to interrupt the rest of pluginscan
        # TODO: not sure this is sensible
        error_printer.print("An error occurred while calculating the SLOCCount:\n          #{e.message}")
      else
        return true
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
pluginscan-0.9.0 lib/pluginscan/reports/sloccount_report.rb