Comments (9)
The configuration file does not only contain the list of rules to apply but also some knobs that control revive
behavior (default severity, error code to return, ...) and the particular configurations of rules like argument-limit
, cyclomatic
, max-public-sctructs
, line-length-limit
...
Today those rules will panic if there is no configuration for them (for example try to use line-length-limit
without setting its argument). We can set defaults for rules' configuration values but, of course, they will be totally arbitrary thus not necessarily adapted to everyone's use cases.
To resume, if the goal is to be able to run revive
without a config file then I'm afraid is not just as simple as adding a -all
flag to the command line.
from revive.
I'd prefer to not introduce new command line options and keep the interface minimalistic.
What are your main concerns with using a config.toml
file?
from revive.
Let's keep it open for now and collect opinions. If more folks would want to use -all
flag we can enable it.
from revive.
This might be outside of the scope of the issue, but it would nice if revive allowed enable/disable particular rule via command line argument.
Since there is no one default name for the config file (i.e. $PRJ_ROOT/.revive.toml
), it isn't clear how to configure an editor (vim+ale / vscode-go) use the same set of rules across different projects.
As an example revive -rule.exported=off
would be the only thing I wanted to configure for my editor.
from revive.
One extra config file to keep around as opposed to an extra command-line option. This really comes down to preference and convenience. I understand your goal, feel free to close the issue if it doesn't follow it.
from revive.
I'd like to say that after looking at the rules extensively, I finally understand the design choice for -config
and why there is a default.toml
. It isn't simply a matter of preference and changing the code, like @chavacava pointed out.
I must say I like the approach of a different .toml
files for different levels and ways of linting in the current state of the project.
I'd suggest, though, and maybe I should open another issue for this, to add a file with all of the rules listed in in this page so it is easier to copy-paste for those that want to have them all on a file for rapid testing and iteration. Right now I'm going through the rules one by one and adding them to my file and the ones I don't want I comment out.
Also, it would be nice to have a standardized default path like @narqo mentioned. Maybe this should be yet another separate issue.
from revive.
I think maybe I don't understand still, but I can't even find a way to enable all checks from the config file. Is the only current way to say "run all checks" to explicitly list all of them in the config file?
from revive.
@akerl Yes. The only way to configure any of the lints is via config file.
from revive.
Let's keep the configurability as minimalistic as possible. Closing it for now. Feel free to comment for further discussion.
from revive.
Related Issues (20)
- Error generated when try to compare strings in test which contains color codes HOT 3
- Add a comment length checking in `rule.exported` HOT 4
- bug: `redundant-import-alias` rule check for import path instead of package name HOT 7
- Ignore dot import aliases in git push in import-alias-naming rule HOT 2
- detect unnecessary gomock controller Finish call HOT 4
- modifies-value-receiver ignores modification to maps and slices HOT 1
- var-naming rule to check that plural vars with ID are capitalised HOT 7
- Add a linter rule to enforce omitting the type for the same type arguments in a function HOT 3
- add-constant suggests invalid fix of replacing struct tags with string constants for anonymous structs HOT 2
- New release (1.3.5) HOT 1
- Cannot install 1.3.5 HOT 9
- replace directive error in latest tag / release HOT 1
- Cannot install 1.3.5 but 1.3.3 works HOT 1
- `unhandled-error`: error message function name does not match name used for exclusions
- Expand `unused-parameter` to check anonymous functions HOT 1
- next phase of refactoring from black and white to block and allow HOT 2
- enforce-slice-style: Add declaration style HOT 8
- False Positive in rule max-control-nesting HOT 3
- False positive datarace detection in Go 1.22
- var-naming rule can suggest invalid identifiers HOT 2
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 revive.