Fix issue with flake8 check and full paths
Currently hacking check_explicit_underscore_import is dependent on a relative file path. A call of "flake8 ." works fine but "flake8 $PWD" doesn't which shouldn't be any difference. Change-Id: I7d40bbb771f96d28db38db69939de5e5993f3e9b Closes-bug: #1530460
This commit is contained in:
parent
c2315085e8
commit
0845300d19
@ -32,7 +32,7 @@ Guidelines for writing new hacking checks
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
# NOTE(thangp): Ignore N323 pep8 error caused by importing cinder objects
|
# NOTE(thangp): Ignore N323 pep8 error caused by importing cinder objects
|
||||||
UNDERSCORE_IMPORT_FILES = ['./cinder/objects/__init__.py']
|
UNDERSCORE_IMPORT_FILES = ['cinder/objects/__init__.py']
|
||||||
|
|
||||||
translated_log = re.compile(
|
translated_log = re.compile(
|
||||||
r"(.)*LOG\.(audit|error|info|warn|warning|critical|exception)"
|
r"(.)*LOG\.(audit|error|info|warn|warning|critical|exception)"
|
||||||
@ -161,10 +161,11 @@ def check_explicit_underscore_import(logical_line, filename):
|
|||||||
|
|
||||||
# Build a list of the files that have _ imported. No further
|
# Build a list of the files that have _ imported. No further
|
||||||
# checking needed once it is found.
|
# checking needed once it is found.
|
||||||
if filename in UNDERSCORE_IMPORT_FILES:
|
for file in UNDERSCORE_IMPORT_FILES:
|
||||||
pass
|
if file in filename:
|
||||||
elif (underscore_import_check.match(logical_line) or
|
return
|
||||||
custom_underscore_check.match(logical_line)):
|
if (underscore_import_check.match(logical_line) or
|
||||||
|
custom_underscore_check.match(logical_line)):
|
||||||
UNDERSCORE_IMPORT_FILES.append(filename)
|
UNDERSCORE_IMPORT_FILES.append(filename)
|
||||||
elif(translated_log.match(logical_line) or
|
elif(translated_log.match(logical_line) or
|
||||||
string_translation.match(logical_line)):
|
string_translation.match(logical_line)):
|
||||||
|
Loading…
Reference in New Issue
Block a user