Skip to main content

cpp_linter/
lib.rs

1#![doc(
2    html_logo_url = "https://raw.githubusercontent.com/cpp-linter/cpp-linter-rs/main/docs/docs/images/logo.png"
3)]
4#![doc(
5    html_favicon_url = "https://github.com/cpp-linter/cpp-linter-rs/raw/main/docs/docs/images/favicon.ico"
6)]
7#![doc = include_str!("../README.md")]
8#![deny(
9    clippy::unwrap_used,
10    clippy::expect_used,
11    clippy::panic,
12    clippy::unimplemented,
13    clippy::todo,
14    missing_docs
15)]
16
17// project specific modules/crates
18pub mod clang_tools;
19pub mod cli;
20pub mod common_fs;
21pub mod error;
22mod git;
23pub mod rest_client;
24pub mod run;
25
26#[cfg(test)]
27pub(crate) mod test_common {
28    #![allow(clippy::unwrap_used)]
29
30    use std::{fs, path::PathBuf};
31
32    /// helper to avoid concurrent writes by executing (& processing the output of)
33    /// clang tools on the same test assets.
34    pub fn setup_tmp_workspace() -> tempfile::TempDir {
35        let tmp_workspace = tempfile::TempDir::with_prefix("cpp-linter-unit-tests_").unwrap();
36        let demo_path = tmp_workspace.path().join("demo");
37        fs::create_dir(&demo_path).unwrap();
38        for asset in ["demo.cpp", "demo.hpp"] {
39            fs::copy(
40                PathBuf::from("tests/demo").join(asset),
41                demo_path.join(asset),
42            )
43            .unwrap();
44        }
45        tmp_workspace
46    }
47}