suppress.py 文件源码

python
阅读 22 收藏 0 点赞 0 评论 0

项目:buildroot 作者: flutter 项目源码 文件源码
def _WriteConfigFile(config_path, issues_dict):
  new_dom = minidom.getDOMImplementation().createDocument(None, 'lint', None)
  top_element = new_dom.documentElement
  top_element.appendChild(new_dom.createComment(_DOC))
  for issue_id in sorted(issues_dict.keys()):
    severity = issues_dict[issue_id].severity
    paths = issues_dict[issue_id].paths
    issue = new_dom.createElement('issue')
    issue.attributes['id'] = issue_id
    if severity:
      issue.attributes['severity'] = severity
    if severity == 'ignore':
      print 'Warning: [%s] is suppressed globally.' % issue_id
    else:
      for path in sorted(paths):
        ignore = new_dom.createElement('ignore')
        ignore.attributes['path'] = path
        issue.appendChild(ignore)
    top_element.appendChild(issue)

  with open(config_path, 'w') as f:
    f.write(new_dom.toprettyxml(indent='  ', encoding='utf-8'))
  print 'Updated %s' % config_path
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号