eric6/Plugins/CheckerPlugins/CodeStyleChecker/Security/Checks/__init__.py

changeset 7612
ca1ce1e0fcff
child 7613
382f89c11e27
equal deleted inserted replaced
7611:d546c4e72f52 7612:ca1ce1e0fcff
1 # -*- coding: utf-8 -*-
2
3 # Copyright (c) 2020 Detlev Offenbach <detlev@die-offenbachs.de>
4 #
5
6 """
7 Package containing the various security checker modules.
8 """
9
10 import collections
11
12 _checkermodules = [
13 "blackListCalls",
14 "blackListImports",
15 ]
16
17
18 def generateCheckersDict():
19 """
20 Function generate the dictionary with checkers.
21
22 @return dictionary containing list of tuples with checker data
23 @rtype dict
24 """
25 checkersDict = collections.defaultdict(list)
26
27 for checkerModule in _checkermodules:
28 modName = "Security.Checks.{0}".format(checkerModule)
29 try:
30 mod = __import__(modName)
31 components = modName.split('.')
32 for comp in components[1:]:
33 mod = getattr(mod, comp)
34 except ImportError:
35 continue
36
37 if not hasattr(mod, "getChecks"):
38 continue
39
40 modCheckersDict = mod.getChecks()
41 for checktype, check in modCheckersDict.items():
42 checkersDict[checktype].append(check)
43
44 return checkersDict

eric ide

mercurial