lib/swiftformat/swiftformat.rb in danger-swiftformat-0.3.0 vs lib/swiftformat/swiftformat.rb in danger-swiftformat-0.3.1
- old
+ new
@@ -1,5 +1,7 @@
+require "logger"
+
module Danger
class SwiftFormat
def initialize(path = nil)
@path = path || "swiftformat"
end
@@ -43,9 +45,15 @@
end
RUNTIME_REGEX = /.*swiftformat completed.*(.+\..+)s/
def run_time(output)
- RUNTIME_REGEX.match(output)[1]
+ if RUNTIME_REGEX.match(output)
+ RUNTIME_REGEX.match(output)[1]
+ else
+ logger = Logger.new(STDERR)
+ logger.error("Invalid run_time output: #{output}")
+ "-1"
+ end
end
end
end