inaka / elvis

Erlang Style Reviewer
Apache License 2.0
426 stars 87 forks source link

New Rule: Define ChildSpecs in either supervisor or worker #531

Closed paulo-ferraz-oliveira closed 3 years ago

paulo-ferraz-oliveira commented 4 years ago

For consistency, inside a given project, we should either define childspecs inside workers, or inside supervisors. That doesn't mean there aren't exceptions to the rule, but that's why rules are configurable :)

This should support option ignore.

Of course, a supervisor might supervise other supervisors, so we need to take care of that case. In any case, the goal should be to "have the childspec defined in the module that uses it" v. "have the childspec defined outside the module that uses it".

I'm not sure about the default in (see below): supervisor v. worker.

I propose [{elvis_style, childspecs, #{ in => supervisor, ignore => [] }.

paulo-ferraz-oliveira commented 3 years ago

I think the analysis, here, will easily become too complicated too soon. Closing it for reference, but abandoning the idea for now.