rumdl_lib/exit_codes.rs
1/// Exit codes for rumdl, following Ruff's convention
2///
3/// These exit codes allow users and CI/CD systems to distinguish between
4/// different types of failures.
5/// Success - No issues found or all issues were fixed
6pub const SUCCESS: i32 = 0;
7
8/// Linting issues found - One or more Markdown violations detected
9pub const VIOLATIONS_FOUND: i32 = 1;
10
11/// Tool error - Configuration error, file access error, or internal error
12pub const TOOL_ERROR: i32 = 2;
13
14/// Helper functions for consistent exit behavior
15pub mod exit {
16 use super::{SUCCESS, TOOL_ERROR, VIOLATIONS_FOUND};
17
18 /// Exit with success code (0)
19 pub fn success() -> ! {
20 std::process::exit(SUCCESS);
21 }
22
23 /// Exit with violations found code (1)
24 pub fn violations_found() -> ! {
25 std::process::exit(VIOLATIONS_FOUND);
26 }
27
28 /// Exit with tool error code (2)
29 pub fn tool_error() -> ! {
30 std::process::exit(TOOL_ERROR);
31 }
32}