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
pylint_plugins: add forbidden import checker #463
pylint_plugins: add forbidden import checker #463
Conversation
pylint_plugins.py
Outdated
|
|
||
| name = 'ipa' | ||
| msgs = { | ||
| 'E9901': ( |
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.
Could we use Warning instead of error?
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.
Sure.
pylint_plugins.py
Outdated
| name = 'ipa' | ||
| msgs = { | ||
| 'E9901': ( | ||
| 'Forbidden import %s', |
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.
Maybe would be nice to write whihc rule has been applied Forbidden import %s (%s should not import %s)
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 agree.
How can be the issue mentioned by @tiran solved in this PR? should regexp be used or allow rules added? |
|
@MartinBasti, this issue is already solved in the PR without using regular expressions. See |
|
Ok, this will not work if ipaclient/submodule allows to import any module, but seems OK for me now, can be improved when needed |
|
I don't know what you mean, could you give me an example? |
|
In this case:
But as I said this is a corner case, should be done when needed |
|
You can, using: |
|
Awesome then |
|
The format could be nicer though - suggestions are welcome. |
|
@MartinBasti any progress in reviewing this PR? |
|
@martbab, I haven't incorporated @MartinBasti's suggestions in yet. |
|
I have now incorporated the suggestions. |
Add new pylint AST checker plugin which implements a check for imports forbidden in IPA. Which imports are forbidden is configurable in pylintrc. Provide default forbidden import configuration and disable the check for existing forbidden imports in our code base.
|
master:
|
Add new pylint AST checker plugin which implements a check for imports
forbidden in IPA. Which imports are forbidden is configurable in pylintrc.
Provide default forbidden import configuration and disable the check for
existing forbidden imports in our code base.
Supersedes @MartinBasti's PR #462.