Add new rule to check sdk_no_wait() usage#292
Open
Conversation
evelyn-ys
reviewed
Apr 9, 2021
| @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.') |
Member
There was a problem hiding this comment.
The error msg seems to report wrong error.
evelyn-ys
reviewed
Apr 9, 2021
| source_code = inspect.getsource(op) | ||
| pattern = re.compile("sdk_no_wait") | ||
| support_no_wait = pattern.search(source_code) | ||
| if no_wait: |
Member
There was a problem hiding this comment.
Suggested change
| if no_wait: | |
| if no_wait and not support_no_wait: |
evelyn-ys
reviewed
Apr 9, 2021
| return help_entry.short_summary or help_entry.long_summary | ||
| return help_entry | ||
|
|
||
| def support_no_wait(self, command_name): |
Member
There was a problem hiding this comment.
Suggested change
| def support_no_wait(self, command_name): | |
| def lack_of_sdk_no_wait(self, command_name): |
kairu-ms
reviewed
Apr 12, 2021
| pattern = re.compile("sdk_no_wait") | ||
| support_no_wait = pattern.search(source_code) | ||
| if no_wait: | ||
| return command_name |
Contributor
There was a problem hiding this comment.
Why return command_name instead of True
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Sometimes service team add support no wait for long running operation, but they forget to use sdk_no_wait() in custom function. Here is a new linter rule to check sdk_no_wait() usage.