• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 pub mod git_hook;
2 pub mod intellij;
3 pub mod vscode;
4 
5 use std::path::Path;
6 
7 const CLIPPY_DEV_DIR: &str = "clippy_dev";
8 
9 /// This function verifies that the tool is being executed in the clippy directory.
10 /// This is useful to ensure that setups only modify Clippy's resources. The verification
11 /// is done by checking that `clippy_dev` is a sub directory of the current directory.
12 ///
13 /// It will print an error message and return `false` if the directory could not be
14 /// verified.
verify_inside_clippy_dir() -> bool15 fn verify_inside_clippy_dir() -> bool {
16     let path = Path::new(CLIPPY_DEV_DIR);
17     if path.exists() && path.is_dir() {
18         true
19     } else {
20         eprintln!("error: unable to verify that the working directory is clippy's directory");
21         false
22     }
23 }
24