OLD | NEW |
1 #!/usr/bin/python | 1 #!/usr/bin/python |
2 # Copyright 2015 The Chromium Authors. All rights reserved. | 2 # Copyright 2015 The Chromium Authors. All rights reserved. |
3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
5 | 5 |
6 # To integrate dartanalyze with out build system, we take an input file, run | 6 # To integrate dartanalyze with out build system, we take an input file, run |
7 # the analyzer on it, and write a stamp file if it passed. | 7 # the analyzer on it, and write a stamp file if it passed. |
8 # | 8 # |
9 # The first argument to this script is a reference to this build's gen | 9 # The first argument to this script is a reference to this build's gen |
10 # directory, which we treat as the package root. The second is the stamp file | 10 # directory, which we treat as the package root. The second is the stamp file |
(...skipping 29 matching lines...) Expand all Loading... |
40 subprocess.check_output(cmd, shell=False, stderr=subprocess.STDOUT) | 40 subprocess.check_output(cmd, shell=False, stderr=subprocess.STDOUT) |
41 except subprocess.CalledProcessError as e: | 41 except subprocess.CalledProcessError as e: |
42 # Perform post processing on the output. Filter out non-error messages and | 42 # Perform post processing on the output. Filter out non-error messages and |
43 # known problem patterns that we're working on. | 43 # known problem patterns that we're working on. |
44 raw_lines = e.output.split('\n') | 44 raw_lines = e.output.split('\n') |
45 # Remove the last empty line | 45 # Remove the last empty line |
46 raw_lines.pop() | 46 raw_lines.pop() |
47 filtered_lines = [i for i in raw_lines if ( | 47 filtered_lines = [i for i in raw_lines if ( |
48 not re.match(_ANALYZING_PATTERN, i) and | 48 not re.match(_ANALYZING_PATTERN, i) and |
49 not re.match(_FINAL_REPORT_PATTERN, i) and | 49 not re.match(_FINAL_REPORT_PATTERN, i) and |
50 # TODO(erg): Remove the rest of these as fixes land: | 50 # TODO(zra, erg): Fix warnings. |
51 not re.match(_WARNING_PATTERN, i) and | 51 not re.match(_WARNING_PATTERN, i))] |
52 not re.match(_NATIVE_ERROR_PATTERN, i) and | |
53 not re.match(_THAT_ONE_BROKEN_CLOSE_IN_WEB_SOCKETS_PATTERN, i))] | |
54 for line in filtered_lines: | 52 for line in filtered_lines: |
55 passed = False | 53 passed = False |
56 print >> sys.stderr, line | 54 print >> sys.stderr, line |
57 | 55 |
58 if passed: | 56 if passed: |
59 # We passed cleanly, so touch the stamp file so that we don't run again. | 57 # We passed cleanly, so touch the stamp file so that we don't run again. |
60 with open(stamp_file, 'a'): | 58 with open(stamp_file, 'a'): |
61 os.utime(stamp_file, None) | 59 os.utime(stamp_file, None) |
62 return 0 | 60 return 0 |
63 else: | 61 else: |
64 return -2 | 62 return -2 |
65 | 63 |
66 if __name__ == '__main__': | 64 if __name__ == '__main__': |
67 sys.exit(main(sys.argv[1:])) | 65 sys.exit(main(sys.argv[1:])) |
OLD | NEW |