From e847694a3d50c2c4a80f27858abe9e5da3e35490 Mon Sep 17 00:00:00 2001 From: Aurimas Liutikas Date: Thu, 3 Nov 2016 09:37:21 -0700 Subject: [PATCH] Print the project name if available when running Checkstyle. Add [project/foo/bar] to the beginning of each Checkstyle error line if the REPO_PROJECT environmental variable is set (set by repo hooks). Test: manually attempted to run checkstyle. Change-Id: I8ccf76d9ce9306668109029267081924300cb6ce --- tools/checkstyle/checkstyle.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tools/checkstyle/checkstyle.py b/tools/checkstyle/checkstyle.py index 05ad1e1cb..828e61fb6 100755 --- a/tools/checkstyle/checkstyle.py +++ b/tools/checkstyle/checkstyle.py @@ -188,7 +188,11 @@ def _ParseAndFilterOutput(stdout, if error.hasAttribute('column'): column = '%s:' % error.attributes['column'].value message = error.attributes['message'].value - result = ' %s:%s:%s %s' % (file_name, line, column, message) + project = '' + if os.environ.get('REPO_PROJECT'): + project = '[' + os.environ.get('REPO_PROJECT') + '] ' + + result = ' %s%s:%s:%s %s' % (project, file_name, line, column, message) severity = error.attributes['severity'].value if severity == 'error':