-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
♻️ refactor: unify and rephrase options descriptions (#12)
- Loading branch information
Showing
7 changed files
with
250 additions
and
91 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
pub mod config_descriptions; | ||
pub mod gitmoji; | ||
pub mod non_imperative_verbs; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
// CLI-exclusive --help descriptions. | ||
pub const COMMIT_MESSAGE: &str = "Commit message to lint. Alternatively, read from STDIN"; | ||
pub const INIT: &str = | ||
"Initialize the default configuration ('config') or commit-msg hook ('hook'). Default: 'config'"; | ||
pub const GENERATE_SHELL_COMPLETION: &str = | ||
"Generate shell completion script for the specified shell"; | ||
pub const CONFIG: &str = "Path to a TOML configuration file"; | ||
pub const COMMIT: &str = "Commit the message after successful linting"; | ||
pub const FORCE: &str = "Force the commit even if linting fails"; | ||
|
||
// Structure for rule descriptions. | ||
// The 'short' version is used in --help. | ||
// The 'extra' version is used to create the default config. | ||
pub struct RuleDescription { | ||
pub short: &'static str, | ||
pub extra: Option<&'static str>, | ||
} | ||
|
||
// General configuration. | ||
pub const QUIET: RuleDescription = RuleDescription { | ||
short: "Suppresses progress messages", | ||
extra: None, | ||
}; | ||
pub const DISPLAY: RuleDescription = RuleDescription { | ||
short: "Displays parsed commit message", | ||
extra: None, | ||
}; | ||
pub const FORMAT: RuleDescription = RuleDescription { | ||
short: "Sets display format: cli, json, table, toml", | ||
extra: None, | ||
}; | ||
pub const SPLIT_LINES: RuleDescription = RuleDescription { | ||
short: "Processes each non-empty line as an individual commit", | ||
extra: None, | ||
}; | ||
|
||
// Rules. | ||
pub const GITMOJI: RuleDescription = RuleDescription { | ||
short: "Include one valid Gitmoji", | ||
extra: Some("See https://gitmoji.dev/"), | ||
}; | ||
|
||
pub const CONVENTIONAL: RuleDescription = RuleDescription { | ||
short: "Follow Conventional Commits format", | ||
extra: Some("See https://www.conventionalcommits.org/"), | ||
}; | ||
|
||
pub const IMPERATIVE: RuleDescription = RuleDescription { | ||
short: "Use the imperative mood in the description", | ||
extra: Some("Example: 'Fix bug' instead of 'Fixed bug'"), | ||
}; | ||
|
||
pub const WHITESPACE: RuleDescription = RuleDescription { | ||
short: "No leading, trailing, or consecutive spaces", | ||
extra: None, | ||
}; | ||
|
||
pub const DESCRIPTION_CASE: RuleDescription = RuleDescription { | ||
short: "Description must start with the specified case", | ||
extra: Some("Options: 'any', 'lower', 'upper'"), | ||
}; | ||
|
||
pub const NO_PERIOD: RuleDescription = RuleDescription { | ||
short: "Do not end commit header with a period", | ||
extra: None, | ||
}; | ||
|
||
pub const MAX_HEADER_LENGTH: RuleDescription = RuleDescription { | ||
short: "Header length limit", | ||
extra: Some("A value of 0 disables the rule"), | ||
}; | ||
|
||
pub const MAX_BODY_LENGTH: RuleDescription = RuleDescription { | ||
short: "Body line length limit", | ||
extra: Some("A value of 0 disables the rule"), | ||
}; | ||
|
||
pub const SCOPES_ALLOWED: RuleDescription = RuleDescription { | ||
short: "List of allowed commit scopes", | ||
extra: Some("An empty list allows all scopes. Example: [\"docs\", \"cli\"]"), | ||
}; | ||
|
||
pub const TYPES_ALLOWED: RuleDescription = RuleDescription { | ||
short: "List of allowed commit types", | ||
extra: Some("An empty list allows all types. Example: [\"feat\", \"fix\", \"docs\"]"), | ||
}; | ||
|
||
pub const HEADER_PATTERN: RuleDescription = RuleDescription { | ||
short: "Header must match regex pattern", | ||
extra: Some("Example: '^JIRA-\\d+:'"), | ||
}; |
Oops, something went wrong.