-
Notifications
You must be signed in to change notification settings - Fork 70
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The Credo
experiment
#1740
The Credo
experiment
#1740
Conversation
And switch from a long case statement to individual functions.
And reenable `Credo.Check.Consistency.ExceptionNames`
Good start! I agree with skipping parenthesis for zero-argument functions personally. I believe the norm for Nerves-projects are to add the I'll let others weigh in as well but I think this is the right direction. I think there are some things that Credo won't enforce that is preferred in Nerves projects. If/when we see those it may be worth making a Credo-integration for that. So we have something common to all Nerves Project projects. |
I abhor no parens 😆 I like the rule that there are always parens, regardless of arity. Aesthetically this makes more sense to me.
This seems a little silly to me. Why not refactor those two-condition
Yep, absolutely 😆 3 is fine for now. |
And yet I also see your point, so I'm kinda in two minds. I'll defer to @jjcarstens for the final decision 😄 |
Co-authored-by: Jon Carstens <[email protected]>
@jjcarstens you might be interested in us enabling |
I've gone ahead and enabled |
1717f98
to
c8ebec7
Compare
@nshoes @lawik @jjcarstens please reread the PR description as I've updated it to reflect some recent changes (a few rules enabled, and a few rules customized) |
This PR adds credo and addresses the most important issues (and some low hanging fruit) raised when using
--strict
.This also adds it to our CI, but it doesn't fail it for now.
I've also modified some of the settings:
{Credo.Check.Readability.ParenthesesOnZeroArityDefs, []}
as I don't know if I agree with this, at the very least we should discuss and decide if we want this enforced. (this check, if enabled, would require us to remove()
from functions which don't accept any arguments){Credo.Check.Refactor.CondStatements, []}
as we have two 2-conditioncond
statements inNervesHub.Extensions
which are useful to keep around. If we want to enforce this then we might need to change these until it makes sense switching back to usingcond
for them.{Credo.Check.Refactor.Nesting, [max_nesting: 3]}
, the default is 2 but we have enough 3 level nesting that I didn't feel like going down that path right now.Credo.Check.Warning.MissedMetadataKeyInLoggerConfig
to tell it that we do use:all
inruntime.exs
Credo.Check.Readability.ParenthesesOnZeroArityDefs
to require parentheses (the opposite of its default)Credo.Check.Warning.LeakyEnvironment
to warn us if we are passing the full environment from the parent process when running system commands.Credo.Check.Readability.ImplTrue
as @jjcarstens hates it when@impl true
is usedCredo.Check.Readability.MultiAlias
as the use ofalias NervesHub.{Deployments, Devices, Products, ...}
is a code smell (@jjcarstens can swear to this)We have only
readability
andsoftware design suggestions
issues to address, or ignore. These primarily consist of:Modules should have a @moduledoc tag
Nested modules could be aliased at the top of the invoking module.
Found a TODO tag in a comment
I think we should address all of these, but we can instead leave these for another PR.