diff --git a/src/git_commit_guard/__init__.py b/src/git_commit_guard/__init__.py index 7c98182..372471f 100644 --- a/src/git_commit_guard/__init__.py +++ b/src/git_commit_guard/__init__.py @@ -231,10 +231,10 @@ def check_imperative(desc, result): first = tokens[0] if first in IMPERATIVE_VERBS: return - tagged = nltk.pos_tag(tokens) - if tagged[0][1] != "VB": + tagged = nltk.pos_tag(["i", *tokens]) + if tagged[1][1] not in {"VB", "VBP"}: result.error( - f"expected imperative verb, got '{tagged[0][0]}' (POS={tagged[0][1]})", + f"expected imperative verb, got '{tagged[1][0]}' (POS={tagged[1][1]})", ) diff --git a/tests/test_git_commit_guard.py b/tests/test_git_commit_guard.py index ccd91a2..0755232 100644 --- a/tests/test_git_commit_guard.py +++ b/tests/test_git_commit_guard.py @@ -215,6 +215,11 @@ def test_non_whitelist_imperative_passes(self): check_imperative("refactor authentication module", r) assert r.ok + def test_write_imperative_passes(self): + r = Result() + check_imperative("write unit tests", r) + assert r.ok + def test_empty_desc_passes(self): r = Result() check_imperative("", r)