Switch to pep8 output format

Change output format so it would follow the same
default format used by pep8/pycodestyle which is
parsable by many tools.

Relates to https://review.openstack.org/335520

Change-Id: I3e34ec09d439104482a979f7b63d393b9faccdb4
This commit is contained in:
Sorin Sbarnea 2018-07-17 13:41:26 +01:00 committed by Ian Wienand
parent 925500dc00
commit b530efc069
3 changed files with 15 additions and 4 deletions

View File

@ -9,6 +9,10 @@ to fill the same part of code review that pep8 does in most OpenStack
projects. It started from humble beginnings in the DevStack project, projects. It started from humble beginnings in the DevStack project,
and will continue to evolve over time. and will continue to evolve over time.
The output format aims to follow `pycodestyle (pep8) default output format
<https://github.com/PyCQA/pycodestyle/blob/master/pycodestyle.py#L108>`_.
- Free software: Apache license - Free software: Apache license
- Documentation: https://docs.openstack.org/bashate - Documentation: https://docs.openstack.org/bashate
- Source: https://git.openstack.org/cgit/openstack-dev/bashate - Source: https://git.openstack.org/cgit/openstack-dev/bashate

View File

@ -296,11 +296,14 @@ class BashateRun(object):
self.log_error(error, line, filename, filelineno, warn) self.log_error(error, line, filename, filelineno, warn)
def log_error(self, error, line, filename, filelineno, warn=False): def log_error(self, error, line, filename, filelineno, warn=False):
print("[%(warn)s] %(error)s: '%(line)s'" % # following pycodestyle/pep8 default output format
{'warn': "W" if warn else "E", # https://github.com/PyCQA/pycodestyle/blob/master/pycodestyle.py#L108
'error': error, print("%(filename)s:%(filelineno)s:1: %(error)s" %
{'filename': filename,
'filelineno': filelineno,
'warn': "W" if warn else "E",
'error': error.replace(":", "", 1),
'line': line.rstrip('\n')}) 'line': line.rstrip('\n')})
print(" - %s : L%s" % (filename, filelineno))
def check_files(self, files, verbose): def check_files(self, files, verbose):
logical_line = "" logical_line = ""

View File

@ -0,0 +1,4 @@
---
features:
- |
Adoped pycodestyle/pep8 default output format.