Skip to content

Commit 3ee547f

Browse files
committed
fix: asserting that the type must be provided
1 parent 36f11e1 commit 3ee547f

File tree

6 files changed

+47
-22
lines changed

6 files changed

+47
-22
lines changed

Cargo.lock

Lines changed: 18 additions & 12 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

conventional_commits_linter/Cargo.toml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "conventional_commits_linter"
3-
version = "0.11.0"
3+
version = "0.11.1"
44
description = "A tooling and language agnostic utility to lint Git commits against the Conventional Commits specification."
55
authors = ["C <DeveloperC@protonmail.com>"]
66
edition = "2021"
@@ -20,13 +20,13 @@ log = "0.4.14"
2020
pretty_env_logger = "0.4.0"
2121

2222
# For reading Git commits.
23-
git2 = { version = "0.13.25", default-features = false, features=[] }
23+
git2 = { version = "0.14.1", default-features = false, features=[] }
2424

2525
# For enum from _str etc for CLI usage.
26-
strum = "0.23.0"
27-
strum_macros = "0.23.1"
26+
strum = "0.24.0"
27+
strum_macros = "0.24.0"
2828

29-
conventional_commits_linter_lib = "0.3.0"
29+
conventional_commits_linter_lib = "0.3.1"
3030

3131

3232
[dev-dependencies]

conventional_commits_linter_lib/Cargo.toml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "conventional_commits_linter_lib"
3-
version = "0.3.0"
3+
version = "0.3.1"
44
description = "A tooling and language agnostic library to lint Git commits against the Conventional Commits specification."
55
authors = ["C <DeveloperC@protonmail.com>"]
66
edition = "2021"
@@ -20,7 +20,7 @@ lazy_static = "1.4.0"
2020
log = "0.4.14"
2121

2222
# For reading Git commits.
23-
git2 = { version = "0.13.25", default-features = false, features=[] }
23+
git2 = { version = "0.14.1", default-features = false, features=[] }
2424

2525
# For printing output as JSON.
2626
serde = { version = "1.0.136", features = ["derive"] }
@@ -30,8 +30,8 @@ serde_json = "1.0.79"
3030
ansi_term = "0.12.1"
3131

3232
# For enum from _str etc for CLI usage.
33-
strum = "0.23.0"
34-
strum_macros = "0.23.1"
33+
strum = "0.24.0"
34+
strum_macros = "0.24.0"
3535

3636

3737
[dev-dependencies]

conventional_commits_linter_lib/src/commits/commit/constants/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ pub(crate) const PRECEDING_WHITESPACE: &str = "^([[:space:]])";
22
pub(crate) const OPTIONAL_EXCLAMATION: &str = "(!)?";
33
pub(crate) const ANGULAR_TYPE: &str = "(revert|build|ci|docs|feat|fix|perf|refactor|style|test)";
44
pub(crate) const EMPTY_SCOPE: &str = r"\(([[:space:]])*\)";
5-
pub(crate) const TYPE: &str = r"([[:alpha:]])*";
5+
pub(crate) const TYPE: &str = r"([[:alpha:]])+";
66
pub(crate) const OPTIONAL_SCOPE: &str = r"(\([[:alpha:]]+\))?";
77
pub(crate) const OPTIONAL_EMPTY_SCOPE_OR_SCOPE: &str = r"(\(.*\))?";
88

conventional_commits_linter_lib/src/commits/commit/conventional_commits_specification/mod.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,6 @@ pub(crate) fn lint(commit_message: &str) -> Result<(), LintingError> {
2121
false => Err(LintingError::NonConventionalCommitsSpecification),
2222
}
2323
}
24+
25+
#[cfg(test)]
26+
mod tests;
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
use super::*;
2+
3+
#[test]
4+
fn test_type_must_be_provided() {
5+
// Given
6+
let commit_message = ": body\n\n";
7+
8+
// When
9+
let result = lint(commit_message);
10+
11+
// Then
12+
assert_eq!(
13+
result,
14+
Err(LintingError::NonConventionalCommitsSpecification)
15+
);
16+
}

0 commit comments

Comments
 (0)