-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Can read setup.cfg and pyproject.toml files
Closes #617
- Loading branch information
Showing
8 changed files
with
166 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
************************** | ||
What's New in Pylint 2.5 | ||
************************** | ||
|
||
:Release: 2.5 | ||
:Date: TBC | ||
|
||
|
||
Summary -- Release highlights | ||
============================= | ||
|
||
|
||
New checkers | ||
============ | ||
|
||
|
||
Other Changes | ||
============= | ||
|
||
* Configuration can be read from a setup.cfg or pyproject.toml file | ||
in the current directory. | ||
A setup.cfg must prepend pylintrc section names with ``pylint.``, | ||
for example ``[pylint.MESSAGES CONTROL]``. | ||
A pyproject.toml file must prepend section names with ``tool.pylint.``, | ||
for example ``[tool.pylint.'MESSAGES CONTROL']``. | ||
These files can also be passed in on the command line. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import unittest.mock | ||
|
||
import pylint.lint | ||
import pytest | ||
|
||
|
||
def test_can_read_toml(tmp_path): | ||
config_file = tmp_path / "pyproject.toml" | ||
config_file.write_text( | ||
"[tool.pylint.'messages control']\n" | ||
"disable='all'\n" | ||
"enable='missing-module-docstring'\n" | ||
"jobs=10\n" | ||
) | ||
|
||
linter = pylint.lint.PyLinter() | ||
linter.global_set_option = unittest.mock.MagicMock() | ||
linter.read_config_file(str(config_file)) | ||
|
||
assert linter.global_set_option.called_with("disable", "all") | ||
assert linter.global_set_option.called_with("enable", "missing-module-docstring") | ||
assert linter.global_set_option.called_with("jobs", 10) | ||
|
||
|
||
def test_can_read_setup_cfg(tmp_path): | ||
config_file = tmp_path / "setup.cfg" | ||
config_file.write_text( | ||
"[pylint.messages control]\n" | ||
"disable=all\n" | ||
"enable=missing-module-docstring\n" | ||
"jobs=10\n" | ||
) | ||
|
||
linter = pylint.lint.PyLinter() | ||
linter.global_set_option = unittest.mock.MagicMock() | ||
linter.read_config_file(str(config_file)) | ||
|
||
assert linter.global_set_option.called_with("disable", "all") | ||
assert linter.global_set_option.called_with("enable", "missing-module-docstring") | ||
assert linter.global_set_option.called_with("jobs", 10) |