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

Unified Diff: build/android/gyp/lint.py

Issue 447793002: Enable Android lint by default (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « build/android/buildbot/bb_run_bot.py ('k') | build/common.gypi » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: build/android/gyp/lint.py
diff --git a/build/android/gyp/lint.py b/build/android/gyp/lint.py
index 6ae7a32e4ed90bb4e297477064266c060efd4768..1940c0eb6989eafeaeb161c9905337ecdfac76ba 100755
--- a/build/android/gyp/lint.py
+++ b/build/android/gyp/lint.py
@@ -55,17 +55,15 @@ def _RunLint(lint_path, config_path, processed_config_path, manifest_path,
print >> sys.stderr
for issue in issues:
issue_id = issue.attributes['id'].value
- severity = issue.attributes['severity'].value
message = issue.attributes['message'].value
location_elem = issue.getElementsByTagName('location')[0]
path = location_elem.attributes['file'].value
line = location_elem.getAttribute('line')
if line:
- error = '%s:%s %s: %s [%s]' % (path, line, severity, message,
- issue_id)
+ error = '%s:%s %s: %s [warning]' % (path, line, message, issue_id)
else:
# Issues in class files don't have a line number.
- error = '%s %s: %s [%s]' % (path, severity, message, issue_id)
+ error = '%s %s: %s [warning]' % (path, message, issue_id)
print >> sys.stderr, error
for attr in ['errorLine1', 'errorLine2']:
error_line = issue.getAttribute(attr)
@@ -90,13 +88,24 @@ def _RunLint(lint_path, config_path, processed_config_path, manifest_path,
try:
build_utils.CheckOutput(cmd, cwd=_SRC_ROOT)
- except build_utils.CalledProcessError:
+ except build_utils.CalledProcessError as e:
# There is a problem with lint usage
if not os.path.exists(result_path):
- raise
+ print 'Something is wrong:'
+ print e
+ return 0
+
# There are actual lint issues
else:
- num_issues = _ParseAndShowResultFile()
+ try:
+ num_issues = _ParseAndShowResultFile()
+ except Exception:
+ print 'Lint created unparseable xml file...'
+ print 'File contents:'
+ with open(result_path) as f:
+ print f.read()
+ return 0
+
_ProcessResultFile()
msg = ('\nLint found %d new issues.\n'
' - For full explanation refer to %s\n'
« no previous file with comments | « build/android/buildbot/bb_run_bot.py ('k') | build/common.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698