-
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
Add support for pyproject.toml as pylint config file #107
Conversation
pytest_pylint.py
Outdated
|
||
def _load_pyproject_toml(session, pylintrc_file): | ||
with open(pylintrc_file, "r") as f_p: |
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.
With f
or fp
instead of f_p
:
C:153,37: Variable name "f" doesn't conform to snake_case naming style (invalid-name)
@@ -20,7 +20,7 @@ | |||
py_modules=['pytest_pylint'], | |||
entry_points={'pytest11': ['pylint = pytest_pylint']}, | |||
python_requires=">=3.5", | |||
install_requires=['pytest>=5.0', 'pylint>=2.0.0'], | |||
install_requires=['pytest>=5.0', 'pylint>=2.0.0', 'toml>=0.7.1'], |
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.
Same lower bound as pylint.
test_pytest_pylint.py
Outdated
"""Verify that pyproject.toml can be used as a pylint rc file.""" | ||
rcfile = testdir.makefile('.toml', """ | ||
[tool.pylint.FORMAT] | ||
max-line-length = "3" |
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.
With 3
instead of "3"
, toml loads it as an integer and not a string and breaks pylint. This might change in the future.
test_pytest_pylint.py
Outdated
elif rcformat == "simple_toml": | ||
rcfile = testdir.makefile('toml', """ | ||
[tool.pylint.MASTER] | ||
ignore = "test_pylintrc_ignore.py,foo.py" |
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.
toml has support for lists, see a few lines above. pylint however does not support them yet. See pylint-dev/pylint#617 (comment) and following comments.
Since pytest-pylint handles the ignores, we can use lists, but should also support the old format to keep switches from pylint to pytest-pylint and back simple.
rcformat
toml
vs simple_toml
also tests [tool.pylint.master]
vs [tool.pylint.MASTER]
. pylint supports both, see pylint-dev/pylint#617 (comment).
@@ -9,6 +9,7 @@ deps = | |||
pytest-pep8 | |||
coverage | |||
mock | |||
https://github.com/PyCQA/pylint/archive/master.tar.gz |
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.
This is necessary until pylint 2.5 is released.
Hey, @michael-k this looks great, and thank you for the contribution. Sorry for the delay in getting back to you. I'm back from an open source hiatus, and did some refactoring of this repo tonight. Could you rebase? I just moved the monolithic file into multiple files and got rid of the |
9886be4
to
831c1a4
Compare
done :) |
Support is in master but not yet released. ref carsongee/pytest-pylint#107
pylint 2.5 (unreleased) can read its config also from
pyproject.toml
andsetup.cfg
. See pylint-dev/pylint#3169 for details.This PR adds support for
pyproject.toml
.