elixir-lang/ex_doc

Refactor warning generation

viniciusmuller opened this issue · 4 comments

I've noticed we have quite a few ways of warning and the most standardized one we have is on the Autolink module.

Perhaps for some general cases we could move this to a new helper module?

There are certain cases with a different format (no ANSI yellow on warning, no stacktrace like this):
https://github.com/elixir-lang/ex_doc/blob/6645809b2c4434221a2005b22646ad55ea2db069/lib/ex_doc/formatter/html.ex#L267C11-L267C11

I think moving this base warning logic for different cases into a specific module would help with code clarity and also make the warnings more consistent (as currently updating the mentioned piece of code to call Autolink just because of its warning function feels weird to me)

Let's wait for #1564 and revisit!

We might also want to use IO.warn more and pass the file + line information to it, since it will create a diagnostic which will be more nicely printed by the upcoming elixir release

👍 with moving to IO.warn!

I've moved to IO.warn for autolinks in #1805 (comment). We can keep this issue open until we move remaining warnings we emit.