Class: SLOCCountScanner::SystemSLOCCount

Inherits:
Object
  • Object
show all
Includes:
Singleton
Defined in:
lib/pluginscan/reports/sloccount_report/sloccount_scanner.rb

Overview

Responsible for isolating the system calls to run SLOCCount

Constant Summary collapse

COMMAND_NAME =
"sloccount".freeze

Instance Method Summary collapse

Instance Method Details

#available?Boolean

Returns:

  • (Boolean)


53
54
55
56
# File 'lib/pluginscan/reports/sloccount_report/sloccount_scanner.rb', line 53

def available?
  _result, status = system_which_sloccount
  status.success?
end

#call(directory) ⇒ Object



58
59
60
61
62
63
64
65
66
67
# File 'lib/pluginscan/reports/sloccount_report/sloccount_scanner.rb', line 58

def call(directory)
  # DANGER!!! calling system command
  # also: danger! not covered by specs

  # Should be safe from injection because of the `Dir.exist?` check.
  Open3.capture2("#{COMMAND_NAME} #{directory} 2> #{error_log_name}")

ensure
  delete_empty_error_log
end