-
-
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
Enable usage of custom pylintrc file for message documentation tests #6131
Enable usage of custom pylintrc file for message documentation tests #6131
Conversation
… and demonstrate it with optional checker message as example.
Pull Request Test Coverage Report for Build 2082161191
💛 - 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.
Thanks you @DudeNr33 !
@@ -0,0 +1,2 @@ | |||
Following an indented ``if`` block directly with an ``elif`` of lower indentation can lead to confusion whether the unindent is deliberate or accidental. | |||
Adding an explicit ``else`` in the indented ``if`` statement, even if it only contains a ``pass`` statement, can help clarify the code. |
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.
Adding an explicit ``else`` in the indented ``if`` statement, even if it only contains a ``pass`` statement, can help clarify the code. | |
Creating a function for the nested conditional, or adding an explicit ``else`` in the indented ``if`` statement, even if it only contains a ``pass`` statement, can help clarify the code. |
config_file = next(config.find_default_config_files(), None) | ||
# Check if this message has a custom configuration file (e.g. for enabling optional checkers). | ||
# If not, use the default configuration. | ||
config_file: Optional[Path] |
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.
@DanielNoord I think we talked about this already before but what do you think about using FunctionalTestFile
instead here ? At some point we will encounter the same issue than for functional tests (i.e. handling min_version, max_version, some options...). We could do test_file.option_file
instead of recreating the logic a little differently.
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.
That was actually my initial approach, but the problem is that FunctionalTestFile
assumes the config file to have the same name as the .py
file.
There is quite a good portion of code duplication also in the LintModuleTest
class here.
Besides the different folder structure, the tight coupling between the "original" LintModuleTest
and test_functional.py
is another problem.
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.
Yeah, I advise against trying to use LintModuleTest
here. The idea is similar but because of the different folder structures it doesn't really work.
It's similar to your Duck
vs. PlasticDuck
example @Pierre-Sassoulas 😄
To ease the process of reviewing your PR, do make sure to complete the following boxes.
and preferred name in
script/.contributors_aliases.json
Type of Changes
Description
In order to test some messages (e.g. for messages of optional checkers), we need a way to use a custom config.
With this modification it is possible to place a
pylintrc
file next togood.py
andbad.py
.To prove it works I added a documentation example for one of the optional checkers.
Ref: #5953 (comment)