git_sumi/lint/constants/
config_descriptions.rs

1// CLI-exclusive --help descriptions.
2pub const COMMIT_MESSAGE: &str = "Commit message to lint. Alternatively, read from STDIN";
3pub const INIT: &str =
4    "Initialize the default configuration ('config'), commit-msg hook ('commit-msg'), prepare-commit-msg hook ('prepare-commit-msg') or both hooks ('hooks')";
5pub const GENERATE_SHELL_COMPLETION: &str =
6    "Generate shell completion script for the specified shell";
7pub const CONFIG: &str = "Path to a TOML configuration file";
8pub const COMMIT: &str = "Commit the message after successful linting";
9pub const FORCE: &str = "Force the commit even if linting fails";
10
11// Structure for rule descriptions.
12// The 'short' version is used in --help.
13// The 'extra' version is used to create the default config.
14pub struct RuleDescription {
15    pub short: &'static str,
16    pub extra: Option<&'static str>,
17}
18
19// General configuration.
20pub const QUIET: RuleDescription = RuleDescription {
21    short: "Suppresses progress messages",
22    extra: None,
23};
24pub const DISPLAY: RuleDescription = RuleDescription {
25    short: "Displays parsed commit message",
26    extra: None,
27};
28pub const FORMAT: RuleDescription = RuleDescription {
29    short: "Sets display format: cli, json, table, toml",
30    extra: None,
31};
32pub const SPLIT_LINES: RuleDescription = RuleDescription {
33    short: "Processes each non-empty line as an individual commit",
34    extra: None,
35};
36
37// Rules.
38pub const GITMOJI: RuleDescription = RuleDescription {
39    short: "Include one valid Gitmoji",
40    extra: Some("See https://gitmoji.dev/"),
41};
42
43pub const CONVENTIONAL: RuleDescription = RuleDescription {
44    short: "Follow Conventional Commits format",
45    extra: Some("See https://www.conventionalcommits.org/"),
46};
47
48pub const IMPERATIVE: RuleDescription = RuleDescription {
49    short: "Use the imperative mood in the description",
50    extra: Some("Example: 'Fix bug' instead of 'Fixed bug'"),
51};
52
53pub const WHITESPACE: RuleDescription = RuleDescription {
54    short: "No leading, trailing, or consecutive spaces",
55    extra: None,
56};
57
58pub const DESCRIPTION_CASE: RuleDescription = RuleDescription {
59    short: "Description must start with the specified case",
60    extra: Some("Options: 'any', 'lower', 'upper'"),
61};
62
63pub const NO_PERIOD: RuleDescription = RuleDescription {
64    short: "Do not end commit header with a period",
65    extra: None,
66};
67
68pub const MAX_HEADER_LENGTH: RuleDescription = RuleDescription {
69    short: "Header length limit",
70    extra: Some("A value of 0 disables the rule"),
71};
72
73pub const MAX_BODY_LENGTH: RuleDescription = RuleDescription {
74    short: "Body line length limit",
75    extra: Some("A value of 0 disables the rule"),
76};
77
78pub const SCOPES_ALLOWED: RuleDescription = RuleDescription {
79    short: "List of allowed commit scopes",
80    extra: Some("An empty list allows all scopes. Example: [\"docs\", \"cli\"]"),
81};
82
83pub const TYPES_ALLOWED: RuleDescription = RuleDescription {
84    short: "List of allowed commit types",
85    extra: Some("An empty list allows all types. Example: [\"feat\", \"fix\", \"docs\"]"),
86};
87
88pub const HEADER_PATTERN: RuleDescription = RuleDescription {
89    short: "Header must match regex pattern",
90    extra: Some("Example: '^JIRA-\\d+:'"),
91};
92
93pub const STRIP_HEADER_PATTERN: RuleDescription = RuleDescription {
94    short: "Remove header pattern before running other validation rules",
95    extra: None,
96};