File tree Expand file tree Collapse file tree 1 file changed +19
-13
lines changed
Expand file tree Collapse file tree 1 file changed +19
-13
lines changed Original file line number Diff line number Diff line change 11use clap:: ArgMatches ;
2+ use std:: path:: PathBuf ;
23
34pub fn linter_command ( _: & ArgMatches ) {
45 lint ( ) . unwrap ( ) ;
56}
67
78pub 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, ¤t_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}
You can’t perform that action at this time.
0 commit comments