Skip to content

Custom linters infrastructure for Rust

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT
Notifications You must be signed in to change notification settings

GoldsteinE/cargo-nag

Repository files navigation

cargo-nag: experimental toolkit for writing custom Rust linters

How to write lints?

Use nag-toolkit library, call declare_lints!() macro and export resulting ::register() function: see example-nag-linter/src/lints.rs as an example.

You can provide a crate with lints for the users of your library or just write them in the same crate as your linter.

nightly-rustc documentation, especially part about LateLintPass is extremely useful when writing lints.

How to write a linter?

Use nag-driver library, call nag_driver::run() or nag_driver::Driver::with_callback() and then .run(): see example-nag-linter/src/main.rs as an example.

How to use a linter?

Install cargo-nag binary. Set CARGO_NAG_LINTER_DIR environment variable to the absolute path to your linter source code, then run cargo nag. It will compile and run a linter for you.

About

Custom linters infrastructure for Rust

Resources

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published