Skip to content

Commit 7c91521

Browse files
Use main instead of master as main checker name (#6569)
Co-authored-by: Pierre Sassoulas <[email protected]>
1 parent 133e2e5 commit 7c91521

File tree

122 files changed

+154
-144
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

122 files changed

+154
-144
lines changed

.github/ISSUE_TEMPLATE/BUG-REPORT.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ body:
3535
placeholder: |
3636
# Leave this blank if the configuration is not relevant!
3737
38-
[MASTER]
38+
[MAIN]
3939
load-plugins=
4040
pylint.extensions.code_style
4141

ChangeLog

+4
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,10 @@ Release date: TBA
4040

4141
Closes #6101
4242

43+
* The main checker name is now ``main`` instead of ``master``. The configuration does not need to be updated as sections' name are optional.
44+
45+
Closes #5467
46+
4347
* Added new checker ``typevar-name-mismatch``: TypeVar must be assigned to a variable with the same name as its name argument.
4448

4549
Closes #5224
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
[master]
1+
[main]
22
py-version=3.9
33
load-plugins=pylint.extensions.typing
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
[MASTER]
1+
[MAIN]
22
load-plugins=pylint.extensions.confusing_elif

doc/data/messages/m/missing-return-doc/pylintrc

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
[master]
1+
[main]
22
load-plugins=pylint.extensions.docparams
33

44
[Parameter_documentation]

doc/data/messages/m/missing-return-type-doc/pylintrc

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
[master]
1+
[main]
22
load-plugins=pylint.extensions.docparams
33

44
[Parameter_documentation]

doc/data/messages/m/missing-yield-doc/pylintrc

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
[master]
1+
[main]
22
load-plugins=pylint.extensions.docparams
33

44
[Parameter_documentation]

doc/data/messages/m/missing-yield-type-doc/pylintrc

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
[master]
1+
[main]
22
load-plugins=pylint.extensions.docparams
33

44
[Parameter_documentation]
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
[MASTER]
1+
[MAIN]
22
load-plugins=pylint.extensions.redefined_loop_name,
+1-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
[master]
1+
[main]
22
load-plugins=pylint.extensions.while_used

doc/exts/pylint_extensions.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ def builder_inited(app: Optional[Sphinx]) -> None:
5959
stream.write("\n")
6060
stream.write(
6161
"You can activate any or all of these extensions "
62-
"by adding a ``load-plugins`` line to the ``MASTER`` "
62+
"by adding a ``load-plugins`` line to the ``MAIN`` "
6363
"section of your ``.pylintrc``, for example::\n"
6464
)
6565
stream.write(

doc/faq.rst

+2-2
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ any formatting accepted by ConfigParser, e.g.
203203

204204
.. code-block:: ini
205205
206-
[MASTER]
206+
[MAIN]
207207
output-format = colorized
208208
209209
[Messages Control]
@@ -221,7 +221,7 @@ Alternatively, if you use ``pyproject.toml``, e.g.
221221

222222
.. code-block:: toml
223223
224-
[tool.pylint.master]
224+
[tool.pylint.main]
225225
output-format = "colorized"
226226
227227
[tool.pylint.messages_control]

doc/technical_reference/startup.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ It does some basic checking of the given command line options to
88
find the initial hook to run,
99
find the config file to use,
1010
and find which plugins have been specified.
11-
It can then create the master :class:`.pylint.lint.PyLinter` instance
11+
It can then create the main :class:`.pylint.lint.PyLinter` instance
1212
and initialise it with the config file and plugins that were discovered
1313
when preprocessing the command line options.
1414
Finally the :class:`.pylint.lint.Run` object launches any child linters

doc/whatsnew/1.7.rst

+2-2
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ New checkers
166166

167167
load-plugins=pylint.extensions.emptystring
168168

169-
to the ``MASTER`` section of your ``.pylintrc`` or using the command::
169+
to the ``MAIN`` section of your ``.pylintrc`` or using the command::
170170

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

@@ -200,7 +200,7 @@ New checkers
200200

201201
load-plugins=pylint.extensions.comparetozero
202202

203-
to the ``MASTER`` section of your ``.pylintrc`` or using the command::
203+
to the ``MAIN`` section of your ``.pylintrc`` or using the command::
204204

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

doc/whatsnew/2.11.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ Extensions
6767
Other Changes
6868
=============
6969

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

7373
* The ``invalid-name`` message is now more detailed when using multiple naming style regexes.

doc/whatsnew/2.14.rst

+4
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,10 @@ Other Changes
136136

137137
Closes #3312
138138

139+
* The main checker name is now ``main`` instead of ``master``. The configuration does not need to be updated as sections' name are optional.
140+
141+
Closes #5467
142+
139143
* Update ``invalid-slots-object`` message to show bad object rather than its inferred value.
140144

141145
Closes #6101

examples/pylintrc

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
[MASTER]
1+
[MAIN]
22

33
# Analyse import fallback blocks. This can be used to support both Python 2 and
44
# 3 compatible code, which means that the block might have code that exists

pylint/config/arguments_manager.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ def _register_options_provider(self, provider: _ArgumentsProvider) -> None:
130130

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

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

@@ -662,7 +662,7 @@ def _generate_config_file(self) -> None:
662662

663663
for group in sorted(
664664
self._arg_parser._action_groups,
665-
key=lambda x: (x.title != "Master", x.title),
665+
key=lambda x: (x.title != "Main", x.title),
666666
):
667667
# Skip the options section with the --help option
668668
if group.title in {"options", "optional arguments", "Commands"}:

pylint/constants.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,8 @@
4646

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

5252
USER_HOME = os.path.expanduser("~")
5353
# TODO: 3.0: Remove in 3.0 with all the surrounding code

pylint/extensions/docparams.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ class DocstringParameterChecker(BaseChecker):
3939
4040
load-plugins=pylint.extensions.docparams
4141
42-
to the ``MASTER`` section of your ``.pylintrc``.
42+
to the ``MAIN`` section of your ``.pylintrc``.
4343
"""
4444

4545
name = "parameter_documentation"

pylint/extensions/docparams.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ You can activate this checker by adding the line::
77

88
load-plugins=pylint.extensions.docparams
99

10-
to the ``MASTER`` section of your ``.pylintrc``.
10+
to the ``MAIN`` section of your ``.pylintrc``.
1111

1212
This checker verifies that all function, method, and constructor docstrings
1313
include documentation of the

pylint/utils/docs.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ def _get_checkers_infos(linter: PyLinter) -> dict[str, dict[str, Any]]:
2222
by_checker: dict[str, dict[str, Any]] = {}
2323
for checker in linter.get_checkers():
2424
name = checker.name
25-
if name != "master":
25+
if name != MAIN_CHECKER_NAME:
2626
try:
2727
by_checker[name]["checker"] = checker
2828
with warnings.catch_warnings():

pylintrc

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
[MASTER]
1+
[MAIN]
22

33
# Specify a configuration file.
44
#rcfile=

tests/benchmark/test_baseline_benchmarks.py

+15-15
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ def test_baseline_benchmark_j1(self, benchmark):
124124
linter = PyLinter(reporter=Reporter())
125125
fileinfos = [self.empty_filepath] # Single file to end-to-end the system
126126
assert linter.config.jobs == 1
127-
assert len(linter._checkers) == 1, "Should just have 'master'"
127+
assert len(linter._checkers) == 1, "Should just have 'main'"
128128
benchmark(linter.check, fileinfos)
129129
assert (
130130
linter.msg_status == 0
@@ -147,7 +147,7 @@ def test_baseline_benchmark_j2(self, benchmark):
147147
fileinfos = [self.empty_filepath for _ in range(linter.config.jobs)]
148148

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

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

170170
def test_baseline_lots_of_files_j1(self, benchmark):
171-
"""Establish a baseline with only 'master' checker being run in -j1.
171+
"""Establish a baseline with only 'main' checker being run in -j1.
172172
173-
We do not register any checkers except the default 'master', so the cost is just
173+
We do not register any checkers except the default 'main', so the cost is just
174174
that of the system with a lot of files registered
175175
"""
176176
if benchmark.disabled:
@@ -180,18 +180,18 @@ def test_baseline_lots_of_files_j1(self, benchmark):
180180
linter.config.jobs = 1
181181
fileinfos = [self.empty_filepath for _ in range(self.lot_of_files)]
182182
assert linter.config.jobs == 1
183-
assert len(linter._checkers) == 1, "Should have 'master'"
183+
assert len(linter._checkers) == 1, "Should have 'main'"
184184
benchmark(linter.check, fileinfos)
185185
assert (
186186
linter.msg_status == 0
187187
), f"Expected no errors to be thrown: {pprint.pformat(linter.reporter.messages)}"
188188

189189
@pytest.mark.needs_two_cores
190190
def test_baseline_lots_of_files_j2(self, benchmark):
191-
"""Establish a baseline with only 'master' checker being run in -j2.
191+
"""Establish a baseline with only 'main' checker being run in -j2.
192192
193193
As with the -j1 variant above `test_baseline_lots_of_files_j1`, we do not
194-
register any checkers except the default 'master', so the cost is just that of
194+
register any checkers except the default 'main', so the cost is just that of
195195
the check_parallel system across 2 workers, plus the overhead of PyLinter
196196
"""
197197
if benchmark.disabled:
@@ -201,7 +201,7 @@ def test_baseline_lots_of_files_j2(self, benchmark):
201201
linter.config.jobs = 2
202202
fileinfos = [self.empty_filepath for _ in range(self.lot_of_files)]
203203
assert linter.config.jobs == 2
204-
assert len(linter._checkers) == 1, "Should have 'master'"
204+
assert len(linter._checkers) == 1, "Should have 'main'"
205205
benchmark(linter.check, fileinfos)
206206
assert (
207207
linter.msg_status == 0
@@ -221,7 +221,7 @@ def test_baseline_lots_of_files_j1_empty_checker(self, benchmark):
221221
linter.register_checker(NoWorkChecker(linter))
222222
fileinfos = [self.empty_filepath for _ in range(self.lot_of_files)]
223223
assert linter.config.jobs == 1
224-
assert len(linter._checkers) == 2, "Should have 'master' and 'sleeper'"
224+
assert len(linter._checkers) == 2, "Should have 'main' and 'sleeper'"
225225
benchmark(linter.check, fileinfos)
226226
assert (
227227
linter.msg_status == 0
@@ -242,7 +242,7 @@ def test_baseline_lots_of_files_j2_empty_checker(self, benchmark):
242242
linter.register_checker(NoWorkChecker(linter))
243243
fileinfos = [self.empty_filepath for _ in range(self.lot_of_files)]
244244
assert linter.config.jobs == 2
245-
assert len(linter._checkers) == 2, "Should have 'master' and 'sleeper'"
245+
assert len(linter._checkers) == 2, "Should have 'main' and 'sleeper'"
246246
benchmark(linter.check, fileinfos)
247247
assert (
248248
linter.msg_status == 0
@@ -268,7 +268,7 @@ def test_baseline_benchmark_j1_single_working_checker(self, benchmark):
268268
fileinfos = [self.empty_filepath for _ in range(2)]
269269

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

298298
assert linter.config.jobs == 2
299-
assert len(linter._checkers) == 2, "Should have 'master' and 'sleeper'"
299+
assert len(linter._checkers) == 2, "Should have 'main' and 'sleeper'"
300300
benchmark(linter.check, fileinfos)
301301
assert (
302302
linter.msg_status == 0
@@ -308,7 +308,7 @@ def test_baseline_benchmark_j1_all_checks_single_file(self, benchmark):
308308
runner = benchmark(Run, args, reporter=Reporter(), exit=False)
309309
assert runner.linter.config.jobs == 1
310310
print("len(runner.linter._checkers)", len(runner.linter._checkers))
311-
assert len(runner.linter._checkers) > 1, "Should have more than 'master'"
311+
assert len(runner.linter._checkers) > 1, "Should have more than 'main'"
312312

313313
assert (
314314
runner.linter.msg_status == 0
@@ -338,5 +338,5 @@ def test_baseline_benchmark_j1_all_checks_lots_of_files(self, benchmark):
338338

339339
assert linter.config.jobs == 1
340340
print("len(linter._checkers)", len(linter._checkers))
341-
assert len(linter._checkers) > 1, "Should have more than 'master'"
341+
assert len(linter._checkers) > 1, "Should have more than 'main'"
342342
benchmark(linter.check, fileinfos)

tests/config/functional/setup_cfg/identical_name_in_flake8/setup.cfg

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Test for the behavior of https://github.com/PyCQA/pylint/issues/4371
2-
[pylint.MASTER]
2+
[pylint.MAIN]
33
persistent=no
44
ignore = migrations
55
[flake8]
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Test for the behaviour of https://github.com/PyCQA/pylint/issues/4272
2-
[pylint.NOTMASTER]
2+
[pylint.NOTMAIN]
33
load-plugins=pylint.extensions.bad_builtin
4-
[pylint.MASTER]
4+
[pylint.MAIN]
55
persistent=no
66
[pylint.DEPRECATED_BUILTINS]
77
bad-functions=print,map
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
# The pylint_websockets plugin does not exist and therefore this toml is invalid
2-
[tool.pylint.MASTER]
2+
[tool.pylint.MAIN]
33
load-plugins = 'pylint_websockets'

tests/functional/a/alternative/alternative_union_syntax.rc

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
[master]
1+
[main]
22
py-version=3.10
33

44
[testoptions]

tests/functional/a/alternative/alternative_union_syntax_error.rc

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
[master]
1+
[main]
22
py-version=3.8
33

44
[testoptions]

tests/functional/a/alternative/alternative_union_syntax_py37.rc

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
[master]
1+
[main]
22
py-version=3.8
33

44
[testoptions]

tests/functional/d/deprecated/deprecated_module_py39_earlier_pyversion.rc

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
[master]
1+
[main]
22
py-version=3.8
33

44
[testoptions]
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
[MASTER]
1+
[MAIN]
22
ignore-patterns=^\.#
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
[MASTER]
1+
[MAIN]
22
ignore-patterns=""
33
disable=non-ascii-name
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
[MASTER]
1+
[MAIN]
22
load-plugins=pylint.extensions.bad_builtin,

tests/functional/ext/bad_builtin/bad_builtins.rc

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
[MASTER]
1+
[MAIN]
22
load-plugins = pylint.extensions.bad_builtin
33

44
[pylint.DEPRECATED_BUILTINS]
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
[MASTER]
1+
[MAIN]
22
load-plugins=pylint.extensions.broad_try_clause,
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
[MASTER]
1+
[MAIN]
22
load-plugins=pylint.extensions.check_elif,

0 commit comments

Comments
 (0)