arcnmx / cargo-clippy

cargo clippy
MIT License
68 stars 11 forks source link

Have a configuration file for setting lint levels #13

Closed crumblingstatue closed 8 years ago

crumblingstatue commented 8 years ago

This would allow projects to enable/disable specific lints without users having to pass command line arguments every time they want to run clippy.

See https://github.com/Manishearth/rust-clippy/issues/574 for more information.

The configuration file could be something as simple as this.

cargo-clippy.conf

allow cyclomatic_complexity
deny bad_bit_mask
warn string_add

cargo-clippy would read this file, and pass the appropriate flags (-A cyclomatic_complexity -D bad_bit_mask -W string_add).

crumblingstatue commented 8 years ago

Another option would be to pass a --cfg argument to the compiler, so the user can then conditionally set lint levels with .e.g. #[cfg_attr(clippy, allow(cyclomatic_complexity))]. Apparently, clippy itself cannot do this.

W4RH4WK commented 8 years ago

I'd like to set allow / warn / deny on a file per file basis.

crumblingstatue commented 8 years ago

@W4RH4WK

This tool is deprecated. Now rust-clippy provides its own cargo-clippy tool.

I'm closing this issue in light of that.

As for allow/warn/deny on a per file basis, you can add a clippy feature to your Cargo.toml, and run cargo-clippy (the one provided by rust-clippy) with --features=clippy. Then you can use the cfg_attr(clippy, allow(cyclomatic_complexity)) syntax I mentioned above.