diff --git a/azdev/__main__.py b/azdev/__main__.py index c319d843f..7c82c5e51 100644 --- a/azdev/__main__.py +++ b/azdev/__main__.py @@ -16,7 +16,7 @@ class AzDevCli(CLI): def get_cli_version(self): - from . import __VERSION__ + from azdev import __VERSION__ return __VERSION__ diff --git a/azdev/operations/linter/linter.py b/azdev/operations/linter/linter.py index 414ccd9fe..c6c3e336d 100644 --- a/azdev/operations/linter/linter.py +++ b/azdev/operations/linter/linter.py @@ -169,6 +169,18 @@ def _get_loaded_help_description(self, entry): return help_entry.short_summary or help_entry.long_summary return help_entry + def support_no_wait(self, command_name): + no_wait = self._command_loader.command_table[command_name].support_no_wait + op = self.get_op_handler() + import inspect + import re + source_code = inspect.getsource(op) + pattern = re.compile("sdk_no_wait") + support_no_wait = pattern.search(source_code) + if no_wait: + return command_name + return False + # pylint: disable=too-many-instance-attributes class LinterManager(object): diff --git a/azdev/operations/linter/rules/command_rules.py b/azdev/operations/linter/rules/command_rules.py index f09dcc65c..e676b22d9 100644 --- a/azdev/operations/linter/rules/command_rules.py +++ b/azdev/operations/linter/rules/command_rules.py @@ -35,3 +35,9 @@ def group_delete_commands_should_confirm(linter, command_name): if 'yes' not in linter.get_command_parameters(command_name): raise RuleError("If this command deletes a collection, or group of resources. " "Please make sure to ask for confirmation.") + + +@CommandRule(LinterSeverity.HIGH) +def no_wait_command(linter, command_name): + if linter.support_no_wait(command_name): + raise RuleError('Deprecated command is expired and should be removed.')