1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
//! # convention-lint
//!
//! A file-naming convention linter configurable via `Cargo.toml` metadata.
//!
//! Drop a `[package.metadata.convention-lint]` section into the manifest of
//! the project you want to lint:
//!
//! ```toml
//! [package.metadata.convention-lint]
//! idl = "snake_case"
//! rs = "CamelCase"
//!
//! [package.metadata.convention-lint.dirs]
//! idl = ["src/idl"] # optional; omit to scan the whole project
//! ```
//!
//! Then invoke the linter as a Cargo subcommand:
//!
//! ```sh
//! cargo convention-lint
//! cargo convention-lint --manifest-path path/to/Cargo.toml
//! ```
//!
//! ## Library usage
//!
//! The crate exposes its full API so it can be embedded in build-scripts or
//! other tooling:
//!
//! ```no_run
//! use convention_lint::{config::load_config, lint::run};
//!
//! let cfg = load_config(std::path::Path::new("Cargo.toml")).unwrap();
//! let violations = run(&cfg, std::path::Path::new("."));
//! for v in &violations {
//! eprintln!("{v}");
//! }
//! std::process::exit(if violations.is_empty() { 0 } else { 1 });
//! ```
pub use Convention;
pub use Error;
pub use Violation;