1#[macro_use]
2extern crate tracing;
3#[macro_use]
4extern crate eyre;
5
6#[macro_use]
7mod prelude;
8pub use prelude::*;
9
10mod toolchain;
11pub use toolchain::*;
12
13pub mod cache;
14pub mod checks;
15pub mod config;
16pub mod info;
17pub mod layout;
18pub mod table;
19
20pub mod db {
21 pub use crate::cache::*;
22 pub use crate::checks::*;
23 pub use crate::config::RepoConfig;
24 pub use crate::info::*;
25 pub use crate::layout::*;
26 pub use crate::table::*;
27}
28
29pub mod out_json;
30
31#[cfg(test)]
32mod tests;
33
34#[derive(Clone, Debug, Serialize, Deserialize)]
35pub struct JsonOutput {
36 pub env: Env,
37 pub cmd: Vec<Cmd>,
38 pub data: Vec<Data>,
39}
40
41#[derive(Clone, Debug, Serialize, Deserialize)]
42pub struct Env {
43 pub tools: Tools,
44 pub kinds: Kinds,
45 pub repos: Vec<Repo>,
46 pub packages: Vec<Package>,
47}
48
49#[derive(Clone, Debug, Serialize, Deserialize)]
50pub struct Tools {
51 pub rust_toolchains: RustToolchains,
52 pub os_checker: ToolOsChecker,
53}
54
55#[derive(Clone, Debug, Serialize, Deserialize)]
56pub struct ToolOsChecker {
57 pub start: u64,
58 pub finish: u64,
59 pub duration_ms: u64,
60 pub git_time: String,
62 pub git_sha: String,
64}
65
66#[derive(Clone, Debug, Serialize, Deserialize)]
67pub struct Repo {
68 pub user: XString,
69 pub repo: XString,
70 }
74
75#[derive(Clone, Debug, Serialize, Deserialize)]
76pub struct Package {
77 pub name: XString,
78 pub repo: PackageRepo,
79 }
82
83#[derive(Clone, Debug, Serialize, Deserialize)]
84pub struct PackageRepo {
85 pub repo_idx: usize,
86 pub user: XString,
87 pub repo: XString,
88}
89
90#[derive(Clone, Debug, Serialize, Deserialize)]
91pub struct PackageCargo {
92 pub targets: Vec<XString>,
93 pub features: Vec<XString>,
94}
95
96#[derive(Clone, Debug, Serialize, Deserialize)]
97pub struct Cmd {
98 pub package_idx: usize,
99 pub tool: CheckerTool,
100 pub cmd: String,
101 pub count: usize,
102 pub duration_ms: u64,
103 pub arch: XString,
105 pub target_triple: String,
107 pub rust_toolchain: String,
110 pub features: Vec<XString>,
111 pub flags: Vec<XString>,
112}
113
114#[derive(Clone, Debug, Serialize, Deserialize)]
115pub struct Data {
116 pub cmd_idx: usize,
118 pub file: Utf8PathBuf,
119 pub kind: Kind,
120 pub raw: String,
121}
122
123#[derive(Debug, Serialize, Deserialize, Encode, Decode, PartialEq, Eq, Clone, Copy, Hash)]
125#[musli(name_all = "name")]
126pub enum Kind {
127 Unformatted,
129 #[serde(rename = "Clippy(Warn)")]
132 ClippyWarn,
133 #[serde(rename = "Clippy(Error)")]
134 ClippyError,
135 Miri,
137 #[serde(rename = "Semver Violation")]
139 SemverViolation,
140 Audit,
141 Mirai,
142 #[serde(rename = "Lockbud(Probably)")]
143 LockbudProbably,
144 #[serde(rename = "Lockbud(Possibly)")]
145 LockbudPossibly,
146 Atomvchecker,
147 Rapx,
148 Rudra,
149 Outdated,
150 Geiger,
151 #[serde(rename = "Unused Deps")]
152 Udeps,
153 Cargo,
154}
155
156impl Kind {
157 pub fn as_str(self) -> &'static str {
159 match self {
160 Kind::Unformatted => "Unformatted",
161 Kind::ClippyWarn => "Clippy(Warn)",
162 Kind::ClippyError => "Clippy(Error)",
163 Kind::Miri => "Miri",
164 Kind::SemverViolation => "Semver Violation",
165 Kind::Audit => "Audit",
166 Kind::Mirai => "Mirai",
167 Kind::LockbudProbably => "Lockbud(Probably)",
168 Kind::LockbudPossibly => "Lockbud(Possibly)",
169 Kind::Atomvchecker => "AtomVChecker",
170 Kind::Rapx => "Rapx",
171 Kind::Rudra => "Rudra",
172 Kind::Outdated => "Outdated",
173 Kind::Geiger => "Geiger",
174 Kind::Udeps => "Udeps",
175 Kind::Cargo => "Cargo",
176 }
177 }
178}
179
180#[derive(Clone, Debug, Serialize, Deserialize)]
181pub struct Kinds {
182 pub order: Vec<Kind>,
183 pub mapping: serde_json::Value,
184}
185
186#[derive(
187 Debug, Serialize, Deserialize, Encode, Decode, PartialEq, Eq, PartialOrd, Ord, Clone, Copy, Hash,
188)]
189#[musli(name_all = "name")]
190#[serde(rename_all = "kebab-case")]
191pub enum CheckerTool {
192 Cargo,
194 Clippy,
195 Miri,
196 SemverChecks,
197 Audit,
198 Mirai,
199 Lockbud,
200 Atomvchecker,
201 Rapx,
202 Rudra,
203 Outdated,
204 Geiger,
205 Fmt,
206 Udeps,
207}
208
209impl CheckerTool {
210 pub fn as_str(self) -> &'static str {
212 match self {
213 Self::Cargo => "cargo",
214 Self::Clippy => "clippy",
215 Self::Miri => "miri",
216 Self::SemverChecks => "semver-checks",
217 Self::Audit => "audit",
218 Self::Mirai => "mirai",
219 Self::Lockbud => "lockbud",
220 Self::Atomvchecker => "atomvchecker",
221 Self::Rapx => "rapx",
222 Self::Rudra => "rudra",
223 Self::Outdated => "outdated",
224 Self::Geiger => "geiger",
225 Self::Fmt => "fmt",
226 Self::Udeps => "udeps",
227 }
228 }
229}