File tree Expand file tree Collapse file tree 1 file changed +16
-7
lines changed
Expand file tree Collapse file tree 1 file changed +16
-7
lines changed Original file line number Diff line number Diff line change 11import importlib
2+ import logging
23import pkgutil
3- from typing import Dict , Type
44
5+ from typing import Dict , Type
56from commitizen .cz .base import BaseCommitizen
67from commitizen .cz .conventional_commits import ConventionalCommitsCz
78from commitizen .cz .customize import CustomizeCommitsCz
89from commitizen .cz .jira import JiraSmartCz
910
11+ logger = logging .getLogger (__name__ )
12+
13+ def discover_plugins ():
14+ plugins = {}
15+ for finder , name , ispkg in pkgutil .iter_modules ():
16+ try :
17+ if name .startswith ("cz_" ):
18+ plugins [name ] = importlib .import_module (name ).discover_this
19+ except AttributeError as e :
20+ logger .warning (e .args [0 ])
21+ continue
22+ return plugins
23+
1024registry : Dict [str , Type [BaseCommitizen ]] = {
1125 "cz_conventional_commits" : ConventionalCommitsCz ,
1226 "cz_jira" : JiraSmartCz ,
1327 "cz_customize" : CustomizeCommitsCz ,
1428}
15- plugins = {
16- name : importlib .import_module (name ).discover_this # type: ignore
17- for finder , name , ispkg in pkgutil .iter_modules ()
18- if name .startswith ("cz_" )
19- }
2029
21- registry .update (plugins )
30+ registry .update (discover_plugins () )
You can’t perform that action at this time.
0 commit comments