Skip to content

Commit

Permalink
Load static config
Browse files Browse the repository at this point in the history
  • Loading branch information
cdo-defcon committed Apr 4, 2018
1 parent 4a728f6 commit 696f6ea
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions atomshields/scanner.py
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ def installPlugin(origin, destination):
def installChecker(path):
AtomShieldsScanner.installPlugin(path, AtomShieldsScanner.CHECKERS_DIR)
instance = AtomShieldsScanner._getClassInstance(path)
config = self.loadConfig()
config = AtomShieldsScanner._loadConfig()
AtomShieldsScanner._addConfig(instance = instance, config = config, parent_section = 'checkers')


Expand Down Expand Up @@ -350,16 +350,19 @@ def getConfig(self, section = None):
data = dict(self.config.items(section))
return data


def loadConfig(self):
if self.configFile is not None:
@staticmethod
def _loadConfig(path = AtomShieldsScanner.CONFIG_PATH):
if path is not None and os.path.isfile(path):
handler = ConfigParser()
handler.read(self.configFile)
self.config = handler

handler.read(path)
return handler
else:
raise Exception('Path to config file is not setted!')

def loadConfig(self):
config = self.__class__._loadConfig(self.configFile)
self.config = config

@staticmethod
def _getClassName(path):
if not path.endswith(".py"):
Expand Down

0 comments on commit 696f6ea

Please sign in to comment.