Coder Social home page Coder Social logo

Comments (9)

chavacava avatar chavacava commented on May 19, 2024 2

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.

mgechev avatar mgechev commented on May 19, 2024 1

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.

mgechev avatar mgechev commented on May 19, 2024 1

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.

narqo avatar narqo commented on May 19, 2024 1

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.

andradei avatar andradei commented on May 19, 2024

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.

andradei avatar andradei commented on May 19, 2024

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.

akerl avatar akerl commented on May 19, 2024

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.

andradei avatar andradei commented on May 19, 2024

@akerl Yes. The only way to configure any of the lints is via config file.

from revive.

mgechev avatar mgechev commented on May 19, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.