crystal-ameba / ameba

A static code analysis tool for Crystal
https://crystal-ameba.github.io
MIT License
525 stars 39 forks source link

Reference for default configuration #130

Open digitalcora opened 4 years ago

digitalcora commented 4 years ago

Unless I've missed something, right now it doesn't seem possible to get an overview of all supported rules and their default settings. This makes it difficult to discover rules that are disabled by default, and to decide ahead of time what kind of code style you want to enforce. For example, even if you're in the habit of running ameba --all, you might not realize LineLength exists.

How other linters handle this:

Rubocop has a default.yml which defines the default values for all known rules in one place. It has an "inheritance" mechanism so user configuration can start with these settings and override them.

Credo has a gen.config command-line task that generates a config file containing all known rules and their default settings. This is like copying Rubocop's default.yml into your project, though the config format is more concise (most rules fit on one line).

ESLint has "inheritance" like Rubocop, and comes with a recommended config which is inherited by default when you set up the library with eslint --init (this also automatically adds overrides for rules your code currently fails). There is a nice table of all supported rules and whether they are enabled in the recommended config.

veelenga commented 4 years ago

Thanks for pointing this out. It was planned to have the ability to generate a config file containing all the available rules. I have to finalize a convenient design for this.

Sija commented 3 years ago

179 made the rule list a bit more accessible, though it doesn't cover all of the mentioned features from OP.

nobodywasishere commented 1 week ago

Related, #497 could provide similar introspection about the different rules config options.

Sija commented 1 week ago

@nobodywasishere That's certainly helpful, although won't resolve this issue as-is.