lib/xcprofiler/danger_reporter.rb in danger-xcprofiler-0.1.0 vs lib/xcprofiler/danger_reporter.rb in danger-xcprofiler-0.2.0

- old
+ new

@@ -16,19 +16,26 @@ options = {} if @inline_mode options[:file] = relative_path(execution.path) options[:line] = execution.line end - message = "`#{execution.method_name}` takes #{execution.time} ms to build" + message = message(execution) + if execution.time >= @thresholds[:fail] @dangerfile.fail(message, options) elsif execution.time >= @thresholds[:warn] @dangerfile.warn(message, options) end end end private + + def message(execution) + message = "`#{execution.method_name}` takes #{execution.time} ms to build" + return message if @inline_mode + "[#{execution.filename}] #{message}" + end def relative_path(path) working_dir = Pathname.new(@working_dir) Pathname.new(path).relative_path_from(working_dir).to_s end