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 1
1
import importlib
2
+ import logging
2
3
import pkgutil
3
- from typing import Dict , Type
4
4
5
+ from typing import Dict , Type
5
6
from commitizen .cz .base import BaseCommitizen
6
7
from commitizen .cz .conventional_commits import ConventionalCommitsCz
7
8
from commitizen .cz .customize import CustomizeCommitsCz
8
9
from commitizen .cz .jira import JiraSmartCz
9
10
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
+
10
24
registry : Dict [str , Type [BaseCommitizen ]] = {
11
25
"cz_conventional_commits" : ConventionalCommitsCz ,
12
26
"cz_jira" : JiraSmartCz ,
13
27
"cz_customize" : CustomizeCommitsCz ,
14
28
}
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
- }
20
29
21
- registry .update (plugins )
30
+ registry .update (discover_plugins () )
You can’t perform that action at this time.
0 commit comments