Fix zuul tox flake8 failures from newer version of hacking

A newer version of hacking was released which enables additional
checks and is breaking flake8 and zuul.

Hacking has now been clamped at 2.0.0 in test-requirements.txt
Added the same for patch-alarm, although it was not failing.

The new checks that are fixed are:
 H106: Don't put vim configuration in source files
 W605 invalid escape sequence
 F632 use ==/!= to compare str, bytes, and int literals
 F841 local variable is assigned to but never used

The following flake8 extension check has been removed:
 H904 Delay string interpolations at logging calls

Closes-Bug: 1856585
Change-Id: I8bdc94539f4a6ce243c4e30efc07eed3bad1ce62
Signed-off-by: Al Bailey <Al.Bailey@windriver.com>
This commit is contained in:
Al Bailey 2019-12-16 08:48:14 -06:00
parent 678e786c5b
commit 5d2da5d041
8 changed files with 15 additions and 16 deletions

View File

@ -1498,7 +1498,7 @@ def set_capture_source_path():
old_path = "%s/stx/extras.ND/scripts/source_collect_package" % my_repo
if os.path.isfile(old_path):
rc = issue_cmd_rc("mkdir -p %s" % new_dir)
rc = issue_cmd_rc("\cp -f %s %s" % (old_path, new_path))
rc = issue_cmd_rc("\\cp -f %s %s" % (old_path, new_path))
if rc == 0:
capture_source_path = new_path

View File

@ -1,4 +1,3 @@
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# -*- encoding: utf-8 -*-
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may

View File

@ -1,5 +1,4 @@
# vim: tabstop=4 shiftwidth=4 softtabstop=4
#
# Copyright (c) 2011 OpenStack Foundation
# All Rights Reserved.
#

View File

@ -1,5 +1,5 @@
"""
Copyright (c) 2017-2017 Wind River Systems, Inc.
Copyright (c) 2017-2019 Wind River Systems, Inc.
SPDX-License-Identifier: Apache-2.0

View File

@ -375,11 +375,11 @@ class PatchData(object):
for pkgver in self.package_versions[patch_sw_version][pkgname][arch].keys():
if self.package_versions[patch_sw_version][pkgname][arch][pkgver] == patch_id:
del self.package_versions[patch_sw_version][pkgname][arch][pkgver]
if len(self.package_versions[patch_sw_version][pkgname][arch]) is 0:
if len(self.package_versions[patch_sw_version][pkgname][arch]) == 0:
del self.package_versions[patch_sw_version][pkgname][arch]
if len(self.package_versions[patch_sw_version][pkgname]) is 0:
if len(self.package_versions[patch_sw_version][pkgname]) == 0:
del self.package_versions[patch_sw_version][pkgname]
if len(self.package_versions[patch_sw_version]) is 0:
if len(self.package_versions[patch_sw_version]) == 0:
del self.package_versions[patch_sw_version]
for patch_sw_version in self.groups.keys():
@ -1018,7 +1018,7 @@ class PatchFile(object):
for cert_type_str in cert_type_all:
try:
PatchFile.read_patch(abs_patch, metadata_only=True, cert_type=[cert_type_str])
except PatchValidationFailure as e:
except PatchValidationFailure:
pass
else:
# Successfully opened the file for reading, and we have discovered the cert_type

View File

@ -2,7 +2,7 @@
# of appearance. Changing the order has an impact on the overall integration
# process, which may cause wedges in the gate later.
hacking>=1.1.0 # Apache-2.0
hacking>=1.1.0,<=2.0.0 # Apache-2.0
coverage!=4.4,>=4.0 # Apache-2.0
mock>=2.0.0 # BSD

View File

@ -87,18 +87,19 @@ commands = bandit --ini tox.ini -n 5 -r cgcs_patch
# H401 docstring should not start with a space
# H404 multi line docstring should start without a leading new line
# H405 multi line docstring summary not separated with an empty line
# Note: W503 and W504 are mutually exclusive. Must select one of them to suppress.
# W504 line break after binary operator
# E501 line too long. skipped because some of the code files include templates
# that end up quite wide
# F401 'XXXXX' imported but unused
# F841 local variable 'XXXXXX' is assigned to but never used
show-source = True
#ignore = H101,H102,H105,H306,H401,H404,H405,E501,F401,F841
ignore = H101,H102,H105,H306,H401,H404,H405,E501,F401
ignore = H101,H102,H105,H306,H401,H404,H405,
W504,E501,F401
exclude = .venv,.git,.tox,dist,doc,*lib/python*,*egg,build,release-tag-*
# H106: Don't put vim configuration in source files (off by default).
# H203: Use assertIs(Not)None to check for None (off by default).
# enable: H904 Delay string interpolations at logging calls (off by default).
enable-extensions = H106 H203 H904
# (todo) enable H904 Delay string interpolations at logging calls (off by default)
enable-extensions = H106 H203
max-line-length = 120
[testenv:flake8]

View File

@ -2,7 +2,7 @@
# of appearance. Changing the order has an impact on the overall integration
# process, which may cause wedges in the gate later.
hacking>=1.1.0 # Apache-2.0
hacking>=1.1.0,<=2.0.0 # Apache-2.0
coverage!=4.4,>=4.0 # Apache-2.0
mock>=2.0.0 # BSD