-
Notifications
You must be signed in to change notification settings - Fork 113
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add new rule to check sdk_no_wait() usage #292
base: dev
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -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: | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
return command_name | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why return |
||||||
return False | ||||||
|
||||||
|
||||||
# pylint: disable=too-many-instance-attributes | ||||||
class LinterManager(object): | ||||||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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.') | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The error msg seems to report wrong error. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.