Closed pnezis closed 3 years ago
Thanks for opening up this PR! I can get on board with the typespec skipping...but personally I usually add moduledocs for exceptions so codebase readers know when that exception can occur (sort of how it is done in Ecto https://github.com/elixir-ecto/ecto/blob/master/lib/ecto/exceptions.ex). Thoughts?
@akoutmos I also add moduledocs to exceptions but in most projects (elixir itself included) this is not the case. I could add a config option for defining if the moduledoc in exceptions is required or not. What do you think?
That's a fair point with regards to the Elixir codebase itself. I'd be good with a config flag for moduledoc enforcement on exception modules. Think that get's use to a best of both worlds scenario :).
@akoutmos I added an exception_moduledoc_required
config option which defaults to true
.
Also included in the PR:
mix doctor.explain
(currently it does not support command line args like --config-file
)ModuleReport.module
, it was set to module()
but it actually is a String.t()
Regarding the implementation of the extra option I considered several approaches:
is_exception
member to the ModuleInformation
class which will be copied to the ModuleReport
is_exception?
function in ModuleInformation
public and call it from the reportersI finally settled with adding a generic properties
field in ModuleInformation
which is copied to ModuleReport
. The main reasoning for this is extensibility. In the future some extra corner cases may need to be handled, or some extra checks may need to be added, and a generic properties
field would make any future enhancement of such kind easy. Thoughts?
Really like all the changes that you have put together @pnezis! I'll pull this down and play with it either today or tomorrow and if all looks good I'll merge it in. Thanks!
Thanks for merging this @akoutmos
Thank you for the awesome contribution :). I'll cut a new release in the coming days.
In case of a
defexception
the convention is to not have amoduledoc
, struct type spec can be ignored as well since the__struct__
is injected from thedefexception
macro.