-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Improve docs clarity on loading custom checkers - FIXED #7502
Improve docs clarity on loading custom checkers - FIXED #7502
Conversation
Whilst the docs on testing custom checkers do touch on the fact the module has to be in your load path, there are some restrictions that were not made clear before. Specifically, the init-hook configuration item (which is often used explicitly to change the sys.path) is not automatically sufficient. If the init hook is in a file, but the load-plugins argument is passed in the CLI, then the plugins are loaded before the init-hook has run, and so will not be imported. In this case, the failure can also be silent, so the outcome is a lint that will simply not contain any information from the checker, as opposed to a run that will error. This corner case may merit fixing in a separate PR, that is to be confirmed. Closes #7264
Thanks @DanielNoord for pointing it out.
As per suggestion from @DanielNoord, this makes it clearer that installing the custom module is the recommended way.
Thanks to @DanielNoord Co-authored-by: DaniΓ«l van Noord <[email protected]>
This is not the way. Co-authored-by: DaniΓ«l van Noord <[email protected]>
Co-authored-by: DaniΓ«l van Noord <[email protected]>
This is a much clearer way of explaining what is meant by this recommendation. Co-authored-by: DaniΓ«l van Noord <[email protected]>
Thanks to Pierre Sassoulas and Daniel Noord
Pull Request Test Coverage Report for Build 3088428075
π - Coveralls |
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.
Final points!
doc/whatsnew/fragments/7264.other
Outdated
@@ -0,0 +1,3 @@ | |||
Dev documentation is now clearer about custom checker loading. |
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 think this can be removed.
Comments thanks to Daniel Noord
Thank you very much for this and all other work related to it @daogilvie π |
You are very welcome, thanks for improving and maintaining a project that has saved me from myself more times than I can remember π |
NOTE: This PR replaces #7276 due to an admin error on my part.
Type of Changes
Description
Short
This PR just updates the documentation page on writing custom checkers. It adds
information about some restrictions between how
init-hook
changes the loadingpath and when you can use that to import your custom module.
Long (in the commit message)
Whilst the docs on testing custom checkers do touch on the fact the
module has to be in your load path, there are some restrictions that
were not made clear before.
Specifically, the init-hook configuration item (which is often used
explicitly to change the sys.path) is not automatically sufficient. If
the init hook is in a file, but the load-plugins argument is passed in
the CLI, then the plugins are loaded before the init-hook has run, and
so will not be imported. In this case, the failure can also be silent,
so the outcome is a lint that will simply not contain any information
from the checker, as opposed to a run that will error.
This corner case may merit fixing in a separate PR, that is to be
confirmed.
Closes #7264