hacking: Ensure use of openstackclient.command
These have the necessary type hints for the clientmanager and should always be used. Change-Id: I8420212be63dbeaff02c97823e1b80441cbc62ca Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
This commit is contained in:
@@ -177,3 +177,20 @@ def assert_find_ignore_missing_kwargs(logical_line, filename):
|
|||||||
'O403: Calls to find_* proxy methods must explicitly set '
|
'O403: Calls to find_* proxy methods must explicitly set '
|
||||||
'ignore_missing',
|
'ignore_missing',
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@core.flake8ext
|
||||||
|
def assert_use_of_osc_command(logical_line, filename):
|
||||||
|
"""Ensure we use openstackclient.command instead of osc_lib.command.
|
||||||
|
|
||||||
|
O404
|
||||||
|
"""
|
||||||
|
if filename == 'openstackclient/command.py':
|
||||||
|
return
|
||||||
|
|
||||||
|
if re.match(r'^from osc_lib\.command import command$', logical_line):
|
||||||
|
yield (
|
||||||
|
0,
|
||||||
|
'O404: Import Command classes from openstackclient.command, not '
|
||||||
|
'osc_lib.command.command',
|
||||||
|
)
|
||||||
|
|||||||
1
tox.ini
1
tox.ini
@@ -128,4 +128,5 @@ extension =
|
|||||||
O401 = checks:assert_no_duplicated_setup
|
O401 = checks:assert_no_duplicated_setup
|
||||||
O402 = checks:assert_use_of_client_aliases
|
O402 = checks:assert_use_of_client_aliases
|
||||||
O403 = checks:assert_find_ignore_missing_kwargs
|
O403 = checks:assert_find_ignore_missing_kwargs
|
||||||
|
O404 = checks:assert_use_of_osc_command
|
||||||
paths = ./hacking
|
paths = ./hacking
|
||||||
|
|||||||
Reference in New Issue
Block a user