Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ commit-guard --disable body,signed-off,signature
Available checks:

* `subject` - Format matches `type(scope): description`, valid type,
lowercase start, no trailing period, max 72 chars
lowercase start, no trailing `.` `!` `?` or space, max 72 chars
* `imperative` - First word is an imperative verb (for example `add` not `added`)
* `body` - Blank line separates subject from body, and body is non-empty
* `signed-off` - `Signed-off-by:` trailer exists
Expand Down Expand Up @@ -110,8 +110,8 @@ In `.commit-guard.toml`:
require-lowercase = false
```

By default trailing `.` is forbidden. To change the set of forbidden trailing
characters (any character is valid, including space):
By default `.`, `!`, `?`, and space are forbidden as trailing characters.
To change the set (any character is valid):

```bash
commit-guard --no-trailing-chars ".,"
Expand Down
2 changes: 1 addition & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ inputs:
required: false
default: 'false'
no-trailing-chars:
description: Forbidden trailing characters, comma-separated (default '.')
description: Forbidden trailing characters, comma-separated (default '.', '!', '?', ' ')
required: false
allow-empty:
description: Exit 0 when --range yields no commits
Expand Down
2 changes: 1 addition & 1 deletion docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,7 @@ <h3>Checks</h3>
<td><code>subject</code></td>
<td>
<a href="https://www.conventionalcommits.org/" target="_blank" rel="noopener">Conventional Commits</a>
format: valid type, lowercase start, no trailing period,
format: valid type, lowercase start, no trailing <code>.</code> <code>!</code> <code>?</code> or space,
max length (default 72). All limits are configurable. Use
<code>!</code> before the colon for breaking changes:
<code>feat!: remove endpoint</code>
Expand Down
4 changes: 2 additions & 2 deletions src/git_commit_guard/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ def check_subject( # noqa: PLR0913 Too many arguments in function definition (9
allowed_types=TYPES,
max_subject_length=MAX_SUBJECT_LEN,
min_description_length=0,
no_trailing_chars=frozenset("."),
no_trailing_chars=frozenset({".", "!", "?", " "}),
*,
require_scope=False,
require_lowercase=True,
Expand Down Expand Up @@ -362,7 +362,7 @@ def _resolve_no_trailing_chars(args, config):
return frozenset(c for c in args.no_trailing_chars.split(",") if c)
if "no-trailing-chars" in config:
return frozenset(config["no-trailing-chars"])
return frozenset(".")
return frozenset({".", "!", "?", " "})


def _resolve_required_trailers(args, config):
Expand Down
4 changes: 2 additions & 2 deletions tests/test_git_commit_guard.py
Original file line number Diff line number Diff line change
Expand Up @@ -659,9 +659,9 @@ def test_config_overrides_default(self):
)
assert result == frozenset({".", "!"})

def test_default_is_period(self):
def test_default_includes_common_punctuation_and_space(self):
result = _resolve_no_trailing_chars(Namespace(no_trailing_chars=None), {})
assert result == frozenset(".")
assert result == frozenset({".", "!", "?", " "})


class TestGitTimeout:
Expand Down
Loading