Reland "Update third_party/checkstyle to 7.6.1"
Reverted in:
https://codereview.chromium.org/2807753003/
Reason for reland:
1. No longer uses Android-related wrapper script for downloading
checkstyle binary file.
2. chromium_presubmit bot now supports Java 8.
TBR=klobag@chromium.org
BUG=703238
Review-Url: https://codereview.chromium.org/2820583002
Cr-Original-Commit-Position: refs/heads/master@{#465999}
Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src
Cr-Mirrored-Commit: ccf6d26c344204648d226c7b1903179f389230c2
diff --git a/checkstyle/checkstyle.py b/checkstyle/checkstyle.py
index 44e1ecf..2433850 100644
--- a/checkstyle/checkstyle.py
+++ b/checkstyle/checkstyle.py
@@ -13,7 +13,15 @@
os.path.join(os.path.dirname(__file__),
os.pardir, os.pardir, os.pardir))
CHECKSTYLE_ROOT = os.path.join(CHROMIUM_SRC, 'third_party', 'checkstyle',
- 'checkstyle-6.5-all.jar')
+ 'checkstyle-7.6.1-all.jar')
+
+
+def FormatCheckstyleOutput(checkstyle_output):
+ lines = checkstyle_output.splitlines(True)
+ if 'Checkstyle ends with' in lines[-1]:
+ return ''.join(lines[:-1])
+ else:
+ return checkstyle_output
def RunCheckstyle(input_api, output_api, style_file, black_list=None):
@@ -49,8 +57,10 @@
result_errors = []
result_warnings = []
+ formatted_checkstyle_output = FormatCheckstyleOutput(stdout)
+
local_path = input_api.PresubmitLocalPath()
- root = xml.dom.minidom.parseString(stdout)
+ root = xml.dom.minidom.parseString(formatted_checkstyle_output)
for fileElement in root.getElementsByTagName('file'):
fileName = fileElement.attributes['name'].value
fileName = os.path.relpath(fileName, local_path)