Skip to content

Commit bef33f7

Browse files
fix(types): correct nullability of config fields in command TypedDicts
Several command TypedDicts declared fields as non-nullable (int, str, dict, list) while argparse produces None when CLI flags are omitted. Runtime code already handles None correctly, but the type annotations were misleading. Changes: - CommitArgs: message_length_limit int -> int | None - CheckArgs: message_length_limit int -> int | None, allowed_prefixes list[str] -> list[str] | None - BumpArgs: file_name str -> str | None - ChangelogArgs: file_name, start_rev, tag_format, version_scheme, export_template, template str -> str | None; extras dict[str, Any] -> dict[str, Any] | None Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent a656af5 commit bef33f7

4 files changed

Lines changed: 11 additions & 11 deletions

File tree

commitizen/commands/bump.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ class BumpArgs(Settings, total=False):
4747
check_consistency: bool
4848
devrelease: int | None
4949
dry_run: bool
50-
file_name: str
50+
file_name: str | None
5151
files_only: bool | None
5252
version_files_only: bool | None
5353
get_next: bool # TODO: maybe rename to `next_version_to_stdout`

commitizen/commands/changelog.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -31,17 +31,17 @@ class ChangelogArgs(TypedDict, total=False):
3131
change_type_order: list[str]
3232
current_version: str
3333
dry_run: bool
34-
file_name: str
34+
file_name: str | None
3535
incremental: bool
3636
merge_prerelease: bool
3737
rev_range: str
38-
start_rev: str
39-
tag_format: str
38+
start_rev: str | None
39+
tag_format: str | None
4040
unreleased_version: str | None
41-
version_scheme: str
42-
template: str
43-
extras: dict[str, Any]
44-
export_template: str
41+
version_scheme: str | None
42+
template: str | None
43+
extras: dict[str, Any] | None
44+
export_template: str | None
4545
during_version_bump: bool | None
4646
allow_no_commit: bool | None # Internal-only when invoked by bump.
4747

commitizen/commands/check.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ class CheckArgs(TypedDict, total=False):
2121
commit_msg: str
2222
rev_range: str
2323
allow_abort: bool
24-
message_length_limit: int
25-
allowed_prefixes: list[str]
24+
message_length_limit: int | None
25+
allowed_prefixes: list[str] | None
2626
message: str
2727
use_default_range: bool
2828

commitizen/commands/commit.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ class CommitArgs(TypedDict, total=False):
3535
dry_run: bool
3636
edit: bool
3737
extra_cli_args: list[str]
38-
message_length_limit: int
38+
message_length_limit: int | None
3939
no_retry: bool
4040
signoff: bool
4141
write_message_to_file: Path | None

0 commit comments

Comments
 (0)