Skip to content

Commit a879bd8

Browse files
committed
refactor(commands): remove unused args, type version command args
1 parent 1f8c4bc commit a879bd8

File tree

7 files changed

+14
-10
lines changed

7 files changed

+14
-10
lines changed

commitizen/commands/example.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
class Example:
66
"""Show an example so people understands the rules."""
77

8-
def __init__(self, config: BaseConfig, *args: object) -> None:
8+
def __init__(self, config: BaseConfig) -> None:
99
self.config: BaseConfig = config
1010
self.cz = factory.committer_factory(self.config)
1111

commitizen/commands/info.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
class Info:
66
"""Show in depth explanation of your rules."""
77

8-
def __init__(self, config: BaseConfig, *args: object) -> None:
8+
def __init__(self, config: BaseConfig) -> None:
99
self.config: BaseConfig = config
1010
self.cz = factory.committer_factory(self.config)
1111

commitizen/commands/init.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ def is_pre_commit_installed(self) -> bool:
7979

8080

8181
class Init:
82-
def __init__(self, config: BaseConfig, *args: object) -> None:
82+
def __init__(self, config: BaseConfig) -> None:
8383
self.config: BaseConfig = config
8484
self.encoding = config.settings["encoding"]
8585
self.cz = factory.committer_factory(self.config)

commitizen/commands/list_cz.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
class ListCz:
77
"""List currently installed rules."""
88

9-
def __init__(self, config: BaseConfig, *args: object) -> None:
9+
def __init__(self, config: BaseConfig) -> None:
1010
self.config: BaseConfig = config
1111

1212
def __call__(self) -> None:

commitizen/commands/schema.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
class Schema:
66
"""Show structure of the rule."""
77

8-
def __init__(self, config: BaseConfig, *args: object) -> None:
8+
def __init__(self, config: BaseConfig) -> None:
99
self.config: BaseConfig = config
1010
self.cz = factory.committer_factory(self.config)
1111

commitizen/commands/version.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,25 @@
11
import platform
22
import sys
3-
from collections.abc import Mapping
4-
from typing import Any
3+
from typing import TypedDict
54

65
from commitizen import out
76
from commitizen.__version__ import __version__
87
from commitizen.config import BaseConfig
98
from commitizen.providers import get_provider
109

1110

11+
class VersionArgs(TypedDict, total=False):
12+
report: bool
13+
project: bool
14+
verbose: bool
15+
16+
1217
class Version:
1318
"""Get the version of the installed commitizen or the current project."""
1419

15-
def __init__(self, config: BaseConfig, *args: Mapping[str, Any]) -> None:
20+
def __init__(self, config: BaseConfig, args: VersionArgs) -> None:
1621
self.config: BaseConfig = config
17-
self.parameter = args[0]
22+
self.parameter = args
1823
self.operating_system = platform.system()
1924
self.python_version = sys.version
2025

tests/commands/test_version_command.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,6 @@ def test_version_use_version_provider(
9797
{
9898
"report": False,
9999
"project": project,
100-
"commitizen": False,
101100
"verbose": not project,
102101
},
103102
)()

0 commit comments

Comments
 (0)