Skip to content

Commit a1e11c7

Browse files
committed
chore: use dotenv-linter 4.0
1 parent 947b89b commit a1e11c7

File tree

1 file changed

+19
-13
lines changed

1 file changed

+19
-13
lines changed

src/commands/linter.rs

Lines changed: 19 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,28 @@
11
use clap::ArgMatches;
2+
use std::path::PathBuf;
23

34
pub fn linter_command(_: &ArgMatches) {
45
lint().unwrap();
56
}
67

78
pub fn lint() -> anyhow::Result<()> {
8-
// use dotenv_linter::cli::options::CheckOptions;
9-
// use dotenv_linter::{check, cli};
10-
// let args_vec = vec![
11-
// "dotenv-linter",
12-
// "--skip",
13-
// "UnorderedKey",
14-
// "--exclude",
15-
// ".env.keys",
16-
// ];
17-
// let current_dir = std::env::current_dir()?;
18-
// let matches = cli::command().try_get_matches_from(args_vec)?;
19-
// let options = CheckOptions::new(&matches);
20-
// check(&options, &current_dir).unwrap();
9+
use dotenv_analyzer::LintKind;
10+
use dotenv_linter::CheckOptions;
11+
use dotenv_linter::check;
12+
let current_dir = std::env::current_dir()?;
13+
let mut excludes: Vec<&PathBuf> = vec![];
14+
let env_keys_file = current_dir.join(".env.keys");
15+
if env_keys_file.exists() {
16+
excludes.push(&env_keys_file);
17+
}
18+
let options = CheckOptions {
19+
files: vec![&current_dir],
20+
ignore_checks: vec![LintKind::UnorderedKey],
21+
exclude: excludes,
22+
quiet: false,
23+
recursive: false,
24+
schema: None,
25+
};
26+
check(&options, &current_dir).unwrap();
2127
Ok(())
2228
}

0 commit comments

Comments
 (0)