rrrene / credo

A static code analysis tool for the Elixir language with a focus on code consistency and teaching.
http://credo-ci.org/
MIT License
4.92k stars 415 forks source link

Analysis of checks in regards to Elixir versions #505

Closed josevalim closed 1 year ago

josevalim commented 6 years ago

Outdated by warnings in the compiler (since v1.4):

Outdated by the formatter in Elixir v1.6:

Will be solved in Elixir v1.7:

Checks that have a high false positive rate (IMO):

coreyhaines commented 6 years ago

It appears that lazy_logging.ex is solved via the macro in Elixir 1.6.2. https://github.com/elixir-lang/elixir/blob/v1.6.2/lib/logger/lib/logger.ex#L746-L754

TheFirstAvenger commented 4 years ago

@rrrene How do you envision Credo working in relation to the Elixir formatter? If we were to take the stance that "Credo complements the Formatter, and doesn't ever try to reproduce or contradict it" (contradict meaning enforce a style which the formatter would undo), it would allow us to remove a number of checks as mentioned above, speeding up execution time, and also would help weed out some of the proposals which go against the formatter. Thoughts?

rrrene commented 4 years ago

Credo complements the Formatter, and doesn't ever try to [...] contradict it

@TheFirstAvenger In my mind, Credo's default config should conform with the formatter. I am not sure if this is trivial, as the formatter changes slightly over time. We should probably add a test suite that checks this.

That said, we should allow people to customize their checks without "respecting" the formatter. I think it is wrong to assume that everybody uses it, so having the defaults conform with it seems the way to go.

Thoughts?

TheFirstAvenger commented 4 years ago

I guess where I am heading with this is more the idea of identifying the checks that are unnecessary if you also run mix format --check-formatted, and retiring them from Credo (maybe to a formatter-plugin that can be included if a user isn't using the formatter?). The reason for this change would be that a number of these checks are consistency and readability checks which are often the ones cited in issue reports about credo taking forever to run (e.g. this and this). If most users are using the formatter anyway, then the cycles spent to run these redundant checks are wasted.