Skip to content

Commit de81f47

Browse files
committed
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>
1 parent 2a28605 commit de81f47

2 files changed

Lines changed: 18 additions & 0 deletions

File tree

hacking/checks.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,3 +177,20 @@ def assert_find_ignore_missing_kwargs(logical_line, filename):
177177
'O403: Calls to find_* proxy methods must explicitly set '
178178
'ignore_missing',
179179
)
180+
181+
182+
@core.flake8ext
183+
def assert_use_of_osc_command(logical_line, filename):
184+
"""Ensure we use openstackclient.command instead of osc_lib.command.
185+
186+
O404
187+
"""
188+
if filename == 'openstackclient/command.py':
189+
return
190+
191+
if re.match(r'^from osc_lib\.command import command$', logical_line):
192+
yield (
193+
0,
194+
'O404: Import Command classes from openstackclient.command, not '
195+
'osc_lib.command.command',
196+
)

tox.ini

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,4 +128,5 @@ extension =
128128
O401 = checks:assert_no_duplicated_setup
129129
O402 = checks:assert_use_of_client_aliases
130130
O403 = checks:assert_find_ignore_missing_kwargs
131+
O404 = checks:assert_use_of_osc_command
131132
paths = ./hacking

0 commit comments

Comments
 (0)