How do I document test modules?

One of Credo’s default rules is that all modules should have a @moduledoc:

https://hexdocs.pm/credo/Credo.Check.Readability.ModuleDoc.html

Since test modules don’t really need a @moduledoc (Disclaimer: I’m not a seasoned veteran), I just put @moduledoc false so that Credo would shut up.


Having gained some experience since the last time I used Credo, what I would do now is to relax those rules a bit. Maybe disable the rule in the test modules at least (I don’t know the specifics of customizing Credo rules, but I know that it can be done to some degree or another).

But I don’t think there is a particularly compelling reason to require a @moduledoc tag for a test module. Like @dimitarvp said, if you need one, then use one. Otherwise, it’s just unnecessary cruft IMO.

EDIT: Relevant link with tips on removing the rule (if that’s your thing):

1 Like