def _ParseConfigFile(config_path):
print 'Parsing %s' % config_path
issues_dict = {}
dom = minidom.parse(config_path)
for issue in dom.getElementsByTagName('issue'):
issue_id = issue.attributes['id'].value
severity = issue.getAttribute('severity')
path_elements = (
p.attributes.get('path')
for p in issue.getElementsByTagName('ignore'))
paths = set(p.value for p in path_elements if p)
regexp_elements = (
p.attributes.get('regexp')
for p in issue.getElementsByTagName('ignore'))
regexps = set(r.value for r in regexp_elements if r)
issues_dict[issue_id] = _Issue(severity, paths, regexps)
return issues_dict
评论列表
文章目录