OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # | 2 # |
3 # Copyright (c) 2013 The Chromium Authors. All rights reserved. | 3 # Copyright (c) 2013 The Chromium Authors. All rights reserved. |
4 # Use of this source code is governed by a BSD-style license that can be | 4 # Use of this source code is governed by a BSD-style license that can be |
5 # found in the LICENSE file. | 5 # found in the LICENSE file. |
6 | 6 |
7 """Add all generated lint_result.xml files to suppressions.xml""" | 7 """Add all generated lint_result.xml files to suppressions.xml""" |
8 | 8 |
9 | 9 |
10 import collections | 10 import collections |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 f.write(new_dom.toprettyxml(indent=' ', encoding='utf-8')) | 94 f.write(new_dom.toprettyxml(indent=' ', encoding='utf-8')) |
95 print 'Updated %s' % config_path | 95 print 'Updated %s' % config_path |
96 | 96 |
97 | 97 |
98 def _Suppress(config_path, result_path): | 98 def _Suppress(config_path, result_path): |
99 issues_dict = _ParseConfigFile(config_path) | 99 issues_dict = _ParseConfigFile(config_path) |
100 _ParseAndMergeResultFile(result_path, issues_dict) | 100 _ParseAndMergeResultFile(result_path, issues_dict) |
101 _WriteConfigFile(config_path, issues_dict) | 101 _WriteConfigFile(config_path, issues_dict) |
102 | 102 |
103 | 103 |
104 def main(): | 104 def main(argv): |
105 parser = optparse.OptionParser(usage='%prog RESULT-FILE') | 105 parser = optparse.OptionParser(usage='%prog RESULT-FILE') |
106 _, args = parser.parse_args() | 106 _, args = parser.parse_args() |
107 | 107 |
108 if len(args) != 1 or not os.path.exists(args[0]): | 108 if len(args) != 1 or not os.path.exists(args[0]): |
109 parser.error('Must provide RESULT-FILE') | 109 parser.error('Must provide RESULT-FILE') |
110 | 110 |
111 _Suppress(_CONFIG_PATH, args[0]) | 111 _Suppress(_CONFIG_PATH, args[0]) |
112 | 112 |
113 | 113 |
114 if __name__ == '__main__': | 114 if __name__ == '__main__': |
115 main() | 115 main(sys.argv) |
OLD | NEW |