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