Skip to content

Use main instead of master as main checker name #6569

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

Merged
merged 4 commits into from
May 10, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/BUG-REPORT.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ body:
placeholder: |
# Leave this blank if the configuration is not relevant!

[MASTER]
[MAIN]
load-plugins=
pylint.extensions.code_style

Expand Down
4 changes: 4 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@ Release date: TBA

Closes #6101

* The main checker name is now ``main`` instead of ``master``. The configuration does not need to be updated as sections' name are optional.

Closes #5467

* Added new checker ``typevar-name-mismatch``: TypeVar must be assigned to a variable with the same name as its name argument.

Closes #5224
Expand Down
2 changes: 1 addition & 1 deletion doc/data/messages/b/broken-collections-callable/pylintrc
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[master]
[main]
py-version=3.9
load-plugins=pylint.extensions.typing
2 changes: 1 addition & 1 deletion doc/data/messages/c/confusing-consecutive-elif/pylintrc
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
[MASTER]
[MAIN]
load-plugins=pylint.extensions.confusing_elif
2 changes: 1 addition & 1 deletion doc/data/messages/m/missing-return-doc/pylintrc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[master]
[main]
load-plugins=pylint.extensions.docparams

[Parameter_documentation]
Expand Down
2 changes: 1 addition & 1 deletion doc/data/messages/m/missing-return-type-doc/pylintrc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[master]
[main]
load-plugins=pylint.extensions.docparams

[Parameter_documentation]
Expand Down
2 changes: 1 addition & 1 deletion doc/data/messages/m/missing-yield-doc/pylintrc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[master]
[main]
load-plugins=pylint.extensions.docparams

[Parameter_documentation]
Expand Down
2 changes: 1 addition & 1 deletion doc/data/messages/m/missing-yield-type-doc/pylintrc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[master]
[main]
load-plugins=pylint.extensions.docparams

[Parameter_documentation]
Expand Down
2 changes: 1 addition & 1 deletion doc/data/messages/r/redefined-loop-name/pylintrc
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
[MASTER]
[MAIN]
load-plugins=pylint.extensions.redefined_loop_name,
2 changes: 1 addition & 1 deletion doc/data/messages/w/while-used/pylintrc
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
[master]
[main]
load-plugins=pylint.extensions.while_used
2 changes: 1 addition & 1 deletion doc/exts/pylint_extensions.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ def builder_inited(app: Optional[Sphinx]) -> None:
stream.write("\n")
stream.write(
"You can activate any or all of these extensions "
"by adding a ``load-plugins`` line to the ``MASTER`` "
"by adding a ``load-plugins`` line to the ``MAIN`` "
"section of your ``.pylintrc``, for example::\n"
)
stream.write(
Expand Down
4 changes: 2 additions & 2 deletions doc/faq.rst
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ any formatting accepted by ConfigParser, e.g.

.. code-block:: ini

[MASTER]
[MAIN]
output-format = colorized

[Messages Control]
Expand All @@ -221,7 +221,7 @@ Alternatively, if you use ``pyproject.toml``, e.g.

.. code-block:: toml

[tool.pylint.master]
[tool.pylint.main]
output-format = "colorized"

[tool.pylint.messages_control]
Expand Down
2 changes: 1 addition & 1 deletion doc/technical_reference/startup.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ It does some basic checking of the given command line options to
find the initial hook to run,
find the config file to use,
and find which plugins have been specified.
It can then create the master :class:`.pylint.lint.PyLinter` instance
It can then create the main :class:`.pylint.lint.PyLinter` instance
and initialise it with the config file and plugins that were discovered
when preprocessing the command line options.
Finally the :class:`.pylint.lint.Run` object launches any child linters
Expand Down
4 changes: 2 additions & 2 deletions doc/whatsnew/1.7.rst
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ New checkers

load-plugins=pylint.extensions.emptystring

to the ``MASTER`` section of your ``.pylintrc`` or using the command::
to the ``MAIN`` section of your ``.pylintrc`` or using the command::

$ pylint a.py --load-plugins=pylint.extensions.emptystring

Expand Down Expand Up @@ -200,7 +200,7 @@ New checkers

load-plugins=pylint.extensions.comparetozero

to the ``MASTER`` section of your ``.pylintrc`` or using the command::
to the ``MAIN`` section of your ``.pylintrc`` or using the command::

$ pylint a.py --load-plugins=pylint.extensions.comparetozero

Expand Down
2 changes: 1 addition & 1 deletion doc/whatsnew/2.11.rst
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ Extensions
Other Changes
=============

* Added ``py-version`` config key (if ``[MASTER]`` section). Used for version dependent checks.
* Added ``py-version`` config key (if ``[MAIN]`` section). Used for version dependent checks.
Will default to whatever Python version pylint is executed with.

* The ``invalid-name`` message is now more detailed when using multiple naming style regexes.
Expand Down
4 changes: 4 additions & 0 deletions doc/whatsnew/2.14.rst
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,10 @@ Other Changes

Closes #3312

* The main checker name is now ``main`` instead of ``master``. The configuration does not need to be updated as sections' name are optional.

Closes #5467

* Update ``invalid-slots-object`` message to show bad object rather than its inferred value.

Closes #6101
Expand Down
2 changes: 1 addition & 1 deletion examples/pylintrc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[MASTER]
[MAIN]

# A comma-separated list of package or module names from where C extensions may
# be loaded. Extensions are loading into the active Python interpreter and may
Expand Down
4 changes: 2 additions & 2 deletions pylint/config/arguments_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ def _register_options_provider(self, provider: _ArgumentsProvider) -> None:

section_desc = provider.option_groups_descs.get(section, None)

# We exclude master since its docstring comes from PyLinter
# We exclude main since its docstring comes from PyLinter
if provider.name != MAIN_CHECKER_NAME and provider.__doc__:
section_desc = provider.__doc__.split("\n\n")[0]

Expand Down Expand Up @@ -662,7 +662,7 @@ def _generate_config_file(self) -> None:

for group in sorted(
self._arg_parser._action_groups,
key=lambda x: (x.title != "Master", x.title),
key=lambda x: (x.title != "Main", x.title),
):
# Skip the options section with the --help option
if group.title in {"options", "optional arguments", "Commands"}:
Expand Down
4 changes: 2 additions & 2 deletions pylint/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@

# You probably don't want to change the MAIN_CHECKER_NAME
# This would affect rcfile generation and retro-compatibility
# on all project using [MASTER] in their rcfile.
MAIN_CHECKER_NAME = "master"
# on all project using [MAIN] in their rcfile.
MAIN_CHECKER_NAME = "main"

USER_HOME = os.path.expanduser("~")
# TODO: 3.0: Remove in 3.0 with all the surrounding code
Expand Down
2 changes: 1 addition & 1 deletion pylint/extensions/docparams.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class DocstringParameterChecker(BaseChecker):

load-plugins=pylint.extensions.docparams

to the ``MASTER`` section of your ``.pylintrc``.
to the ``MAIN`` section of your ``.pylintrc``.
"""

name = "parameter_documentation"
Expand Down
2 changes: 1 addition & 1 deletion pylint/extensions/docparams.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ You can activate this checker by adding the line::

load-plugins=pylint.extensions.docparams

to the ``MASTER`` section of your ``.pylintrc``.
to the ``MAIN`` section of your ``.pylintrc``.

This checker verifies that all function, method, and constructor docstrings
include documentation of the
Expand Down
2 changes: 1 addition & 1 deletion pylint/utils/docs.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def _get_checkers_infos(linter: PyLinter) -> dict[str, dict[str, Any]]:
by_checker: dict[str, dict[str, Any]] = {}
for checker in linter.get_checkers():
name = checker.name
if name != "master":
if name != MAIN_CHECKER_NAME:
try:
by_checker[name]["checker"] = checker
with warnings.catch_warnings():
Expand Down
2 changes: 1 addition & 1 deletion pylintrc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[MASTER]
[MAIN]

# Specify a configuration file.
#rcfile=
Expand Down
30 changes: 15 additions & 15 deletions tests/benchmark/test_baseline_benchmarks.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ def test_baseline_benchmark_j1(self, benchmark):
linter = PyLinter(reporter=Reporter())
fileinfos = [self.empty_filepath] # Single file to end-to-end the system
assert linter.config.jobs == 1
assert len(linter._checkers) == 1, "Should just have 'master'"
assert len(linter._checkers) == 1, "Should just have 'main'"
benchmark(linter.check, fileinfos)
assert (
linter.msg_status == 0
Expand All @@ -147,7 +147,7 @@ def test_baseline_benchmark_j2(self, benchmark):
fileinfos = [self.empty_filepath for _ in range(linter.config.jobs)]

assert linter.config.jobs == 2
assert len(linter._checkers) == 1, "Should have 'master'"
assert len(linter._checkers) == 1, "Should have 'main'"
benchmark(linter.check, fileinfos)
assert (
linter.msg_status == 0
Expand All @@ -161,16 +161,16 @@ def test_baseline_benchmark_check_parallel_j2(self, benchmark):
# Create file per worker, using all workers
fileinfos = [self.empty_file_info for _ in range(linter.config.jobs)]

assert len(linter._checkers) == 1, "Should have 'master'"
assert len(linter._checkers) == 1, "Should have 'main'"
benchmark(check_parallel, linter, jobs=2, files=fileinfos)
assert (
linter.msg_status == 0
), f"Expected no errors to be thrown: {pprint.pformat(linter.reporter.messages)}"

def test_baseline_lots_of_files_j1(self, benchmark):
"""Establish a baseline with only 'master' checker being run in -j1.
"""Establish a baseline with only 'main' checker being run in -j1.

We do not register any checkers except the default 'master', so the cost is just
We do not register any checkers except the default 'main', so the cost is just
that of the system with a lot of files registered
"""
if benchmark.disabled:
Expand All @@ -180,18 +180,18 @@ def test_baseline_lots_of_files_j1(self, benchmark):
linter.config.jobs = 1
fileinfos = [self.empty_filepath for _ in range(self.lot_of_files)]
assert linter.config.jobs == 1
assert len(linter._checkers) == 1, "Should have 'master'"
assert len(linter._checkers) == 1, "Should have 'main'"
benchmark(linter.check, fileinfos)
assert (
linter.msg_status == 0
), f"Expected no errors to be thrown: {pprint.pformat(linter.reporter.messages)}"

@pytest.mark.needs_two_cores
def test_baseline_lots_of_files_j2(self, benchmark):
"""Establish a baseline with only 'master' checker being run in -j2.
"""Establish a baseline with only 'main' checker being run in -j2.

As with the -j1 variant above `test_baseline_lots_of_files_j1`, we do not
register any checkers except the default 'master', so the cost is just that of
register any checkers except the default 'main', so the cost is just that of
the check_parallel system across 2 workers, plus the overhead of PyLinter
"""
if benchmark.disabled:
Expand All @@ -201,7 +201,7 @@ def test_baseline_lots_of_files_j2(self, benchmark):
linter.config.jobs = 2
fileinfos = [self.empty_filepath for _ in range(self.lot_of_files)]
assert linter.config.jobs == 2
assert len(linter._checkers) == 1, "Should have 'master'"
assert len(linter._checkers) == 1, "Should have 'main'"
benchmark(linter.check, fileinfos)
assert (
linter.msg_status == 0
Expand All @@ -221,7 +221,7 @@ def test_baseline_lots_of_files_j1_empty_checker(self, benchmark):
linter.register_checker(NoWorkChecker(linter))
fileinfos = [self.empty_filepath for _ in range(self.lot_of_files)]
assert linter.config.jobs == 1
assert len(linter._checkers) == 2, "Should have 'master' and 'sleeper'"
assert len(linter._checkers) == 2, "Should have 'main' and 'sleeper'"
benchmark(linter.check, fileinfos)
assert (
linter.msg_status == 0
Expand All @@ -242,7 +242,7 @@ def test_baseline_lots_of_files_j2_empty_checker(self, benchmark):
linter.register_checker(NoWorkChecker(linter))
fileinfos = [self.empty_filepath for _ in range(self.lot_of_files)]
assert linter.config.jobs == 2
assert len(linter._checkers) == 2, "Should have 'master' and 'sleeper'"
assert len(linter._checkers) == 2, "Should have 'main' and 'sleeper'"
benchmark(linter.check, fileinfos)
assert (
linter.msg_status == 0
Expand All @@ -268,7 +268,7 @@ def test_baseline_benchmark_j1_single_working_checker(self, benchmark):
fileinfos = [self.empty_filepath for _ in range(2)]

assert linter.config.jobs == 1
assert len(linter._checkers) == 2, "Should have 'master' and 'sleeper'"
assert len(linter._checkers) == 2, "Should have 'main' and 'sleeper'"
benchmark(linter.check, fileinfos)
assert (
linter.msg_status == 0
Expand Down Expand Up @@ -296,7 +296,7 @@ def test_baseline_benchmark_j2_single_working_checker(self, benchmark):
fileinfos = [self.empty_filepath for _ in range(2)]

assert linter.config.jobs == 2
assert len(linter._checkers) == 2, "Should have 'master' and 'sleeper'"
assert len(linter._checkers) == 2, "Should have 'main' and 'sleeper'"
benchmark(linter.check, fileinfos)
assert (
linter.msg_status == 0
Expand All @@ -308,7 +308,7 @@ def test_baseline_benchmark_j1_all_checks_single_file(self, benchmark):
runner = benchmark(Run, args, reporter=Reporter(), exit=False)
assert runner.linter.config.jobs == 1
print("len(runner.linter._checkers)", len(runner.linter._checkers))
assert len(runner.linter._checkers) > 1, "Should have more than 'master'"
assert len(runner.linter._checkers) > 1, "Should have more than 'main'"

assert (
runner.linter.msg_status == 0
Expand Down Expand Up @@ -338,5 +338,5 @@ def test_baseline_benchmark_j1_all_checks_lots_of_files(self, benchmark):

assert linter.config.jobs == 1
print("len(linter._checkers)", len(linter._checkers))
assert len(linter._checkers) > 1, "Should have more than 'master'"
assert len(linter._checkers) > 1, "Should have more than 'main'"
benchmark(linter.check, fileinfos)
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Test for the behavior of https://github.com/PyCQA/pylint/issues/4371
[pylint.MASTER]
[pylint.MAIN]
persistent=no
ignore = migrations
[flake8]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Test for the behaviour of https://github.com/PyCQA/pylint/issues/4272
[pylint.NOTMASTER]
[pylint.NOTMAIN]
load-plugins=pylint.extensions.bad_builtin
[pylint.MASTER]
[pylint.MAIN]
persistent=no
[pylint.DEPRECATED_BUILTINS]
bad-functions=print,map
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# The pylint_websockets plugin does not exist and therefore this toml is invalid
[tool.pylint.MASTER]
[tool.pylint.MAIN]
load-plugins = 'pylint_websockets'
2 changes: 1 addition & 1 deletion tests/functional/a/alternative/alternative_union_syntax.rc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[master]
[main]
py-version=3.10

[testoptions]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[master]
[main]
py-version=3.8

[testoptions]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[master]
[main]
py-version=3.8

[testoptions]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[master]
[main]
py-version=3.8

[testoptions]
Expand Down
2 changes: 1 addition & 1 deletion tests/functional/e/.#emacs_file_lock_by_conf.rc
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
[MASTER]
[MAIN]
ignore-patterns=^\.#
2 changes: 1 addition & 1 deletion tests/functional/e/.#emacs_file_lock_redefined_conf.rc
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[MASTER]
[MAIN]
ignore-patterns=""
disable=non-ascii-name
2 changes: 1 addition & 1 deletion tests/functional/ext/bad_builtin/bad_builtin_extension.rc
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
[MASTER]
[MAIN]
load-plugins=pylint.extensions.bad_builtin,
2 changes: 1 addition & 1 deletion tests/functional/ext/bad_builtin/bad_builtins.rc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[MASTER]
[MAIN]
load-plugins = pylint.extensions.bad_builtin

[pylint.DEPRECATED_BUILTINS]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
[MASTER]
[MAIN]
load-plugins=pylint.extensions.broad_try_clause,
2 changes: 1 addition & 1 deletion tests/functional/ext/check_elif/check_elif.rc
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
[MASTER]
[MAIN]
load-plugins=pylint.extensions.check_elif,
Loading