Comments (8)
Hi there. Copypasta is currently the only option, but that behaviour will change soon. If sou have any suggestions/input on this it is more than welcome! 👍🏻
from credo.
I have the same question. I'd like to disable a rule without having to maintain the list of rules or forgetting to add a new rule when a new version is released.
from credo.
How about a config file fallback chain that will look for a .credo.exs file in the current project, if that is not found then it will look for one in the home dir ~/.credo.exs , and if that is not found it will just use the defaults.
We could then format the custom config file for example like :
%{
configs: [
name: "default",
ignore_checks: [
{Credo.Check.Readability.ModuleDoc},
...
],
override_checks: [
{Credo.Check.Readability.MaxLineLength, priority: :low, max_length: 80},
...
]
]
}
as long as the custom config has no key 'checks' it will include all the checks as defined in the default config coming from credo, if it does have the key, it will naturally only use those checks. Basically we are using the default config, and then merge the settings from our custom config over it.
What do you think about this ?
from credo.
I could guess where you got the idea for this. 😉 Unfortunately, I am opposed to having multiple keys for this.
The way it will most probably work in v0.4.0
is that the list of checks will be merged with the default list. The checks in your .credo.exs
are prioritized and if you want to deactivate individual checks you just pust {Credo.Check.CheckModule, false}
in the config.
P.S. The "config fallback" you describe is already active in Credo since - I think - the initial release. You can put a .credo.exs
in any parent directory.
from credo.
Yeah the false annotation would work.
Would I be correct in assuming that the config file will then only contain override rules ?
So by default it would run all checks with default settings, unless in you specify otherwise in the config file. For example if you have {Credo.Check.CheckModule, false}, {Credo.Check.Readability.MaxLineLength, priority: :low, max_length: 80}
It would disable the CheckModule, override the default settings of the MaxLineLength and run all other checks with the defaults ?
P.S. Good stuff with the config fallback :)
from credo.
Yepp, that's how I think it should work.
Everyone I talk to tells me they don't want to monitor if new checks get implemented and that their prime use case is customizing/disabling a few checks. Quote: "Nobody wants to run just three checks."
So I am leaning very much towards following that line of thinking with the next "bigger" release.
from credo.
Sounds good :)
Let me know if there is anything that I could help with.
from credo.
This was released as part of v0.4.0-beta1
. Please report any further issues you might find.
from credo.
Related Issues (20)
- Question: Is it possible to define a .credo.exs in a dependency with custom checks and apply it when running mix credo in a project HOT 3
- Predicate function names check does not work for non-zero arity functions HOT 2
- Add list of standard checks to docs HOT 2
- Credo.Check.Warning.Dbg does not detect `dbg` HOT 8
- #FIXME fails silently HOT 6
- Credo wrongly reports about macro name HOT 2
- Credo.Check.Warning.MissedMetadataKeyInLoggerConfig reporting false errors since 1.7.2 upgrade HOT 8
- Elixir version check fails with Credo.Check.Warning.LazyLogging HOT 1
- Credo warning /test/add_credo_plugin_to_project.exs:121:6 HOT 2
- Code readability: Predicate function names should not start with 'is', and should end in a question mark. HOT 1
- Command line switch `--read-from-stdin` doesn't respect config files HOT 4
- Predicate callbacks from behavior are not ignored HOT 2
- Issue with Unused variables confused about the strategy HOT 1
- missing spec on unquoted function raise error HOT 3
- Credo.Check.Warning.WrongTestFileExtension displayed in non-test module in v1.7.4 HOT 8
- NoAmbiguousAliases fails on function param with name alias HOT 3
- "Most of the time you are using the multi-alias/require/import/use syntax..." with compile_env HOT 3
- Gracefully handle output of bitstring `:message` in `%Credo.Issue{}` HOT 8
- False positive: spec in quoted HOT 2
- False Positive: Macro sigils with uppercase words HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from credo.