-
Notifications
You must be signed in to change notification settings - Fork 34
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
feat: auto-find config that is not pylintrc based #156
Conversation
Changes the way that the config file is retrieved from pylint.config. Previously this was done using the static `variable pylint.config.PYLINTRC` which is defined at load by iterating over all the files found via `pylint.config.find_default_config_files()` until one ending in "pylintrc" is found. In pylint itself config seems instead to be found by calling `next(find_default_config_files(), None)` which is also able to find setup.cfg or pyproject.toml based config files automatically. I have thus changed PyLintPlugin to use the same version and can now call `py.test --pylint` and have config from my pyproject.toml picked up correctly. I have added one additional test, essentially copying the existing `test_pylint_file_toml`, but now called `test_pyline_file_pyproject_toml`, which is modified to name the config file `pyproject.toml` and does not pass the `--pyline-fcfile` option but expects it to be auto-detected. This test passes when the file is called pyproject.toml but fails when it is called something different.
…is being used and there is no support for pyproject.toml etc.
… file but still ran the test that would fail when it couldn't detect the file. this should fix that. I also had to modify the test invalidate_cache_when_config_changes as autofinding the config caused that test to fail (which I assume was not intended)
…lint - fixed that.
…figured, not at load time of the module which may have been affecting things. Also made a change to the import of pylint.config to comply with isort and pylint 2.3
…pport find_default_config_files
Sorry for the string of commits, it took me a while to figure out how to get all the different version of pylint to be happy with the code. I also found that some tests passed on my dev machine but not on travis for an earlier version of the code - to fix that I had to move the search for the config file into the plugin pytest_configure() method, to make sure it picks up on the change in path. Hopefully you agree that this is a useful feature of the plugin, I certainly like being able to drop the extra command line argument. |
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 for this great enhancement! I'm sorry I missed it earlier😬
Changes the way that the config file is retrieved from pylint.config. Previously
this was done using the static
variable pylint.config.PYLINTRC
which is definedat load by iterating over all the files found via
pylint.config.find_default_config_files()
until one ending in "pylintrc" isfound. In pylint itself config seems instead to be found by calling
next(find_default_config_files(), None)
which is also able to find setup.cfg orpyproject.toml based config files automatically. I have thus changed PyLintPlugin
to use the same version and can now call
py.test --pylint
and have config frommy pyproject.toml picked up correctly.
I have added one additional test, essentially copying the existing
test_pylint_file_toml
, but now calledtest_pyline_file_pyproject_toml
, whichis modified to name the config file
pyproject.toml
and does not pass the--pyline-fcfile
option but expects it to be auto-detected. This test passeswhen the file is called pyproject.toml but fails when it is called something
different.