Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(105)

Side by Side Diff: third_party/closure_compiler/checker.py

Issue 853983002: Fix js checker script (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/python 1 #!/usr/bin/python
2 # Copyright 2014 The Chromium Authors. All rights reserved. 2 # Copyright 2014 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 """Runs Closure compiler on a JavaScript file to check for errors.""" 6 """Runs Closure compiler on a JavaScript file to check for errors."""
7 7
8 import argparse 8 import argparse
9 import os 9 import os
10 import re 10 import re
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after
233 233
234 includes = [rel_path(f) for f in depends + [source_file]] 234 includes = [rel_path(f) for f in depends + [source_file]]
235 contents = ['<include src="%s">' % i for i in includes] 235 contents = ['<include src="%s">' % i for i in includes]
236 meta_file = self._create_temp_file("\n".join(contents)) 236 meta_file = self._create_temp_file("\n".join(contents))
237 self._debug("Meta file: %s" % meta_file) 237 self._debug("Meta file: %s" % meta_file)
238 238
239 self._processor = processor.Processor(meta_file) 239 self._processor = processor.Processor(meta_file)
240 self._expanded_file = self._create_temp_file(self._processor.contents) 240 self._expanded_file = self._create_temp_file(self._processor.contents)
241 self._debug("Expanded file: %s" % self._expanded_file) 241 self._debug("Expanded file: %s" % self._expanded_file)
242 242
243 errors, stderr = self.run_js_check(self._expanded_file, depends) 243 errors, stderr = self.run_js_check([self._expanded_file], externs)
Tyler Breisacher (Chromium) 2015/01/15 20:43:09 run_js_check's first argument is a list of sources
244 244
245 # Filter out false-positive promise chain errors. 245 # Filter out false-positive promise chain errors.
246 # See https://github.com/google/closure-compiler/issues/715 for details. 246 # See https://github.com/google/closure-compiler/issues/715 for details.
247 errors = self._error_filter.filter(errors); 247 errors = self._error_filter.filter(errors);
248 248
249 output = self._format_errors(map(self._fix_up_error, errors)) 249 output = self._format_errors(map(self._fix_up_error, errors))
250 if errors: 250 if errors:
251 prefix = "\n" if output else "" 251 prefix = "\n" if output else ""
252 self._error("Error in: %s%s%s" % (source_file, prefix, output)) 252 self._error("Error in: %s%s%s" % (source_file, prefix, output))
253 elif output: 253 elif output:
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
316 open(opts.out_file, "w").write("") 316 open(opts.out_file, "w").write("")
317 else: 317 else:
318 has_errors, errors = checker.check_multiple(opts.sources) 318 has_errors, errors = checker.check_multiple(opts.sources)
319 if has_errors: 319 if has_errors:
320 print errors 320 print errors
321 sys.exit(1) 321 sys.exit(1)
322 322
323 if opts.success_stamp: 323 if opts.success_stamp:
324 with open(opts.success_stamp, 'w'): 324 with open(opts.success_stamp, 'w'):
325 os.utime(opts.success_stamp, None) 325 os.utime(opts.success_stamp, None)
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698