lib/pronto/formatter/text_formatter.rb in pronto-0.1.7 vs lib/pronto/formatter/text_formatter.rb in pronto-0.2.0
- old
+ new
@@ -3,10 +3,15 @@
class TextFormatter
def format(messages)
messages.map do |message|
level = message.level[0].upcase
line = message.line
- "#{message.path}:#{line.new_lineno} #{level}: #{message.msg}"
+ lineno = line.new_lineno if line
+ path = message.path
+ commit_sha = message.commit_sha[0..6] if message.commit_sha
+
+ location = (path.nil? && lineno.nil?) ? commit_sha : "#{path}:#{lineno}"
+ "#{location} #{level}: #{message.msg}"
end
end
end
end
end