Bumped flake8

- Upgraded hacking(flake8)
- Added more modern tox linters environment (pep8 alias)
- Temporary added skips for broken newer rules
- Fixed few basic rule violations
- Moved flake8 config to setup.cfg (tox.ini is not recommended)

Change-Id: I75b3ce5d2ce965a9dc5bdfaa49b2aacd8f0195ad
This commit is contained in:
Sorin Sbarnea
2020-05-19 17:59:26 +01:00
parent 6fc19ee5b9
commit f68a8719af
9 changed files with 41 additions and 25 deletions

View File

@@ -15,8 +15,9 @@
# under the License.
# The configuration file should look like:
"""
The configuration file should look like:
```
[ircbot]
nick=NICKNAME
pass=PASSWORD
@@ -31,16 +32,16 @@ user=gerrit2
[data_source[
es_url=URLofELASTICSEARCH
db_uri=SQLALCHEMY_URI_TO_SUBUNIT2SQL
"""
```
# The yaml channel config should look like:
"""
```
openstack-qa:
events:
- positive
- negative
```
"""
import argparse
import daemon
import os

View File

@@ -12,9 +12,9 @@
# License for the specific language governing permissions and limitations
# under the License.
from six.moves import configparser
import os
import re
from six.moves import configparser
DEFAULT_INDEX_FORMAT = 'logstash-%Y.%m.%d'
@@ -52,9 +52,9 @@ INCLUDED_PROJECTS_REGEX = "(^openstack/|devstack|grenade)"
# Let's value legibility over pep8 line width here...
ALL_FAILS_QUERY = (
'('
'(filename:"job-output.txt" AND message:"POST-RUN END" AND message:"playbooks/base/post.yaml")' # flake8: noqa
'(filename:"job-output.txt" AND message:"POST-RUN END" AND message:"playbooks/base/post.yaml")' # noqa E501
' OR '
'(filename:"console.html" AND (message:"[Zuul] Job complete" OR message:"[SCP] Copying console log" OR message:"Grabbing consoleLog"))' # flake8: noqa
'(filename:"console.html" AND (message:"[Zuul] Job complete" OR message:"[SCP] Copying console log" OR message:"Grabbing consoleLog"))' # noqa E501
')'
' AND build_status:"FAILURE"'
' AND build_queue:"gate"'
@@ -130,7 +130,8 @@ class Config(object):
if config.has_section('gerrit'):
self.gerrit_user = config.get('gerrit', 'user')
self.gerrit_query_file = config.get('gerrit', 'query_file')
# workaround for python api change https://docs.python.org/3/library/configparser.html#fallback-values
# workaround for python api change:
# https://docs.python.org/3/library/configparser.html#fallback-values
try:
self.gerrit_host = config.get('gerrit',
'host',

View File

@@ -227,7 +227,7 @@ class Stream(object):
# these items. It's orthoginal to non voting ES searching.
if " (non-voting)" in line:
continue
m = re.search("- ([\w-]+)\s*(http://\S+)\s*:\s*FAILURE", line)
m = re.search(r"- ([\w-]+)\s*(http://\S+)\s*:\s*FAILURE", line)
if m:
failed_tests.append(FailJob(m.group(1), m.group(2)))
return failed_tests

View File

@@ -78,9 +78,9 @@ def result_ready(change, patchset, name, short_uuid):
# TODO(dmsimard): Revisit this query once Zuul v2 is no longer supported
# Let's value legibility over pep8 line width here...
query = (
'((filename:"job-output.txt" AND message:"POST-RUN END" AND message:"project-config/playbooks/base/post-ssh.yaml")' # flake8: noqa
'((filename:"job-output.txt" AND message:"POST-RUN END" AND message:"project-config/playbooks/base/post-ssh.yaml")' # noqa E501
' OR '
'(filename:"console.html" AND (message:"[Zuul] Job complete" OR message:"[SCP] Copying console log" OR message:"Grabbing consoleLog")))' # flake8: noqa
'(filename:"console.html" AND (message:"[Zuul] Job complete" OR message:"[SCP] Copying console log" OR message:"Grabbing consoleLog")))' # noqa E501
' AND build_status:"FAILURE"'
' AND build_change:"{change}"'
' AND build_patchset:"{patchset}"'