emacs.py 767 B

1234567891011121314151617181920212223242526
  1. from prospector.formatters.text import TextFormatter
  2. __all__ = ("EmacsFormatter",)
  3. class EmacsFormatter(TextFormatter):
  4. def render_message(self, message):
  5. output = [
  6. "%s:%s:%d:"
  7. % (
  8. self._make_path(message.location.path),
  9. message.location.line,
  10. (message.location.character or 0) + 1,
  11. ),
  12. " L%s:%s %s: %s - %s"
  13. % (
  14. message.location.line or "-",
  15. message.location.character if message.location.line else "-",
  16. message.location.function,
  17. message.source,
  18. message.code,
  19. ),
  20. " %s" % message.message,
  21. ]
  22. return "\n".join(output)