elvis_core icon indicating copy to clipboard operation
elvis_core copied to clipboard

Possible New Rules: Code Complexity

Open elbrujohalcon opened this issue 1 year ago • 4 comments

Inspired by https://hexdocs.pm/credo/Credo.Check.Refactor.ABCSize.html

Read the comments below to find more possible rules :)

elbrujohalcon avatar Feb 28 '23 14:02 elbrujohalcon

There's also https://hexdocs.pm/credo/Credo.Check.Refactor.CyclomaticComplexity.html in a similar spirit.

paulo-ferraz-oliveira avatar Feb 28 '23 20:02 paulo-ferraz-oliveira

And https://hexdocs.pm/credo/Credo.Check.Refactor.PerceivedComplexity.html.

paulo-ferraz-oliveira avatar Feb 28 '23 20:02 paulo-ferraz-oliveira

The assignments (A) part probably needs to be weighted differently for Erlang versus other languages. For example, I do WAY fewer assignments in Elixir than in Erlang, because in Elixir, there are pipes, and in Erlang there's a bunch of intermediate variables.

maco avatar Feb 28 '23 21:02 maco

Agreed. This could probably be released initially as experimental (something I'm not sure we've ever done in elvis_core) and then tweaked with community feedback.

paulo-ferraz-oliveira avatar Feb 28 '23 21:02 paulo-ferraz-oliveira