-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Need Guidance on Custom Pylint Checker for Library Module #2073
Comments
Hey @knappador Thanks for considering pylint for that! I don't quite follow what you try to do though, would you mind sharing some examples, even in pseudocode? |
The situation where a lint warning needs to be generated will be of the following form: with Accounting: # context manager will track instance creation from here
result = talk_to_database().black_box_stuff()
de = DoubleEntry(result...)
if (result.some_condition):
Accounting.realize(de) # this logic path consumes the double entry
else:
return False
# at this point at runtime, in the else branch, we end up warning that the DoubleEntry was
# created but not consumed, meaning we may have just created an accounting violation. I can start analysis whenever context is opened. I'll be looking for certain API calls in all branches that indicate that each I also need to be aware if a |
Sounds good. I don't have specific suggestions but feel free to look at the checkers that we currently have for some inspiration. |
Hello there, I'm developing a library for doing double-entry accounting:
https://github.com/knappador/enron-py
I'm building a
ContextManager
for proper transaction treatment. While I can find transactions that don't end up in a proper state before leaving scope, this occurs at runtime. I'd like to get a linter in place for static analysis.Because the warnings will always be tied to a
with
scope, I would like to write for a scope-based interface if it exists. Is there a preferred class I can implement?Second, because it's a library, is there a manner of including the lint checker so that pylint can load the customer checker at library import or would I need to guide users to customize their config? Can I ship the custom lint checker with the project?
Source issue knappador/enron-py#6
The text was updated successfully, but these errors were encountered: