-
Notifications
You must be signed in to change notification settings - Fork 2
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 #4
base: main
Are you sure you want to change the base?
add new rule #4
Conversation
flake8_vedro/visitors/context_checkers/assert_context_checker.py
Outdated
Show resolved
Hide resolved
for line in context.context_node.body: | ||
if isinstance(line, ast.Assert): | ||
has_assert = True | ||
break | ||
|
||
has_assert = self._has_assert_in_block(context.context_node.body) |
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.
you have a loop for every line in context.context_node.body, for each line there's a call of method _has_assert_in_block for the whole context.context_node.body
are you sure that it's a good solution?
|
||
return errors | ||
|
||
def _has_assert_in_block(self, block: List[ast.stmt]): |
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.
missing typing for return value
Added a new optional rule to the linter, the presence of which is subsequently asserted in contexts marked by the @vedro.context decorator. It is disabled by default.