-
-
Notifications
You must be signed in to change notification settings - Fork 328
Expand file tree
/
Copy pathfactory.py
More file actions
17 lines (15 loc) · 612 Bytes
/
factory.py
File metadata and controls
17 lines (15 loc) · 612 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
from commitizen import BaseCommitizen
from commitizen.config import BaseConfig
from commitizen.cz import registry
from commitizen.exceptions import NoCommitizenFoundException
def committer_factory(config: BaseConfig) -> BaseCommitizen:
"""Return the correct commitizen existing in the registry."""
name: str = config.settings["name"]
try:
return registry[name](config)
except KeyError:
msg_error = (
"The committer has not been found in the system.\n\n"
f"Try running 'pip install {name}'\n"
)
raise NoCommitizenFoundException(msg_error)