Index: tools/android/checkstyle/checkstyle.py |
diff --git a/tools/android/checkstyle/checkstyle.py b/tools/android/checkstyle/checkstyle.py |
index 44e1ecf5f122a5d45587685fd92c5690af613173..24338504b3513da5c4a7d169b6f576f8b4578b6b 100644 |
--- a/tools/android/checkstyle/checkstyle.py |
+++ b/tools/android/checkstyle/checkstyle.py |
@@ -13,7 +13,15 @@ CHROMIUM_SRC = os.path.normpath( |
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 @@ def RunCheckstyle(input_api, output_api, style_file, black_list=None): |
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) |