6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
# File 'lib/pre-commit/checks/js.rb', line 6
def call(staged_files)
require 'execjs'
rescue RuntimeError, LoadError => e
$stderr.puts "Could not load execjs: #{e}. You need to manually install execjs to use JavaScript plugins for security reasons."
else
staged_files = files_filter(staged_files)
return if staged_files.empty?
errors = []
staged_files.each do |file|
error_list = Array(run_check(file))
error_list.each { |error_object| errors << display_error(error_object, file) }
end
return if errors.empty?
errors.join("\n")
end
|