-
Notifications
You must be signed in to change notification settings - Fork 11
adds linter warnings on unused imports #132
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
adds linter warnings on unused imports #132
Conversation
d8eb17d
to
946a05f
Compare
@@ -41,7 +41,7 @@ def __init__(self, mh, stab, verify_checks, debug_vcg, cvc5_binary): | |||
self.abstract_extensions = {} | |||
self.checked_types = set() | |||
|
|||
def verify(self): |
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.
Why do you prefer the name perform_sanity_checks
over verify
? The new name is fine with me, I just want to understand the reason behind the renaming.
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.
it was called perform_sanity_checks before, within the "process" method in the trlc.py file. so I kept the naming on this level, thus changing it in the lint.py file. reason: I got rid of the shell method that combined the initialization of the linter object and the verify method
@@ -202,3 +202,34 @@ def verify_array_type(self, n_typ): | |||
"An array with 0 to 1 components should just\n" | |||
"be an optional %s instead." % | |||
n_typ.element_type.name) | |||
|
|||
def markup_ref(self, item, string_literals): | |||
for string_literal in string_literals: |
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.
I am not 100% clear on the goal of this function. Especially, what shall be returned if reference.package.name == item.name
is never true?
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.
if it is not true then it will return None.
with other words: if it did not find a reference in the Markup_String then it does return nothing. and if it does return something. It will be added to the list of found tokens that are referencing the imported package
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.
Please add an explicit return None
at the end of the function. I am surprised pylint does not complain here.
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.
Indeed it is recommended PEP8 to force clarity by explicitly setting the return value if it is meant to be caught. Although the design of python does not enforce this. Every function in python implicitly returns None
. So the approach was that None
is always expected and you only need to specify other return values than None
.
That said, added for clarity
946a05f
to
503d425
Compare
@christophkloeffel I have reviewed the change, but there seem to be merge conflicts which cannot be resolved automatically. Please rebase and request a new review. Thanks! |
ffb1902
to
73276c8
Compare
closes #49