aboutsummaryrefslogtreecommitdiff
path: root/checkstyle.py
diff options
context:
space:
mode:
authorLorDClockaN <lordclockan@gmail.com>2017-09-17 21:35:51 +0200
committermosimchah <mosimchah@gmail.com>2018-11-10 17:09:02 -0500
commit6d8acb8c88970c33fab6aeae12824a839b4c146a (patch)
tree17ebffab130465e2577b4de19cba1ac501e0cd00 /checkstyle.py
parenta8a50e922b39a2dba7e56030c660e1aabca168f3 (diff)
Fix repo upload command with python >=3.0 compatibilityHEADo8.1
Change-Id: Ifded3eae4594bc3299ce6f13f644dba6dbad2db5
Diffstat (limited to 'checkstyle.py')
-rwxr-xr-xcheckstyle.py22
1 files changed, 11 insertions, 11 deletions
diff --git a/checkstyle.py b/checkstyle.py
index 97c4e93..c7dd113 100755
--- a/checkstyle.py
+++ b/checkstyle.py
@@ -80,7 +80,7 @@ def RunCheckstyleOnFiles(java_files, classpath=CHECKSTYLE_JAR, config_xml=CHECKS
Returns:
A tuple of errors and warnings.
"""
- print 'Running Checkstyle on inputted files'
+ print ('Running Checkstyle on inputted files')
java_files = map(os.path.abspath, java_files)
stdout = _ExecuteCheckstyle(java_files, classpath, config_xml)
(errors, warnings) = _ParseAndFilterOutput(stdout)
@@ -108,17 +108,17 @@ def RunCheckstyleOnACommit(commit,
A tuple of errors and warnings.
"""
if not git.repository_root():
- print 'FAILURE: not inside a git repository'
+ print ('FAILURE: not inside a git repository')
sys.exit(1)
explicit_commit = commit is not None
if not explicit_commit:
_WarnIfUntrackedFiles()
commit = git.last_commit()
- print 'Running Checkstyle on %s commit' % commit
+ print ('Running Checkstyle on %s commit' % commit)
commit_modified_files = _GetModifiedFiles(commit, explicit_commit)
commit_modified_files = _FilterFiles(commit_modified_files, file_whitelist)
if not commit_modified_files.keys():
- print 'No Java files to check'
+ print ('No Java files to check')
return [], []
(tmp_dir, tmp_file_map) = _GetTempFilesForCommit(
@@ -153,11 +153,11 @@ def _WarnIfUntrackedFiles(out=sys.stdout):
def _PrintErrorsAndWarnings(errors, warnings):
"""Prints given errors and warnings."""
if errors:
- print 'ERRORS:'
- print '\n'.join(errors)
+ print ('ERRORS:')
+ print ('\n'.join(errors))
if warnings:
- print 'WARNINGS:'
- print '\n'.join(warnings)
+ print ('WARNINGS:')
+ print ('\n'.join(warnings))
def _ExecuteCheckstyle(java_files, classpath, config_xml):
@@ -182,7 +182,7 @@ def _ExecuteCheckstyle(java_files, classpath, config_xml):
stdout, _ = check.communicate()
except OSError as e:
if e.errno == errno.ENOENT:
- print 'Error running Checkstyle!'
+ print ('Error running Checkstyle!')
sys.exit(1)
# A work-around for Checkstyle printing error count to stdio.
@@ -339,7 +339,7 @@ def main(args=None):
config_xml = args.config_xml or CHECKSTYLE_STYLE
if not os.path.exists(config_xml):
- print 'Java checkstyle configuration file is missing'
+ print ('Java checkstyle configuration file is missing')
sys.exit(1)
classpath = CHECKSTYLE_JAR
@@ -357,7 +357,7 @@ def main(args=None):
if errors or warnings:
sys.exit(1)
- print 'SUCCESS! NO ISSUES FOUND'
+ print ('SUCCESS! NO ISSUES FOUND')
sys.exit(0)