Skip to content

Commit a479303

Browse files
[deprecation] setup.cfgand tox.ini sections need to start by 'pylint' (#8465)
1 parent 699ac88 commit a479303

File tree

4 files changed

+11
-23
lines changed

4 files changed

+11
-23
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
Following a deprecation period, it's no longer possible to use ``MASTER``
2+
or ``master`` as configuration section in ``setup.cfg`` or ``tox.ini``. It's bad practice
3+
to not start sections titles with the tool name. Please use ``pylint.main`` instead.
4+
5+
Refs #8464

pylint/config/config_file_parser.py

Lines changed: 6 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
import configparser
1010
import os
1111
import sys
12-
import warnings
1312
from pathlib import Path
1413
from typing import TYPE_CHECKING
1514

@@ -41,23 +40,13 @@ def _parse_ini_file(self, file_path: Path) -> tuple[dict[str, str], list[str]]:
4140

4241
config_content: dict[str, str] = {}
4342
options: list[str] = []
43+
ini_file_with_sections = self._ini_file_with_sections(file_path)
4444
for section in parser.sections():
45-
if self._ini_file_with_sections(file_path) and not section.startswith(
46-
"pylint"
47-
):
48-
if section.lower() == "master":
49-
# TODO: 3.0: Remove deprecated handling of master, only allow 'pylint.' sections
50-
warnings.warn(
51-
"The use of 'MASTER' or 'master' as configuration section for pylint "
52-
"has been deprecated, as it's bad practice to not start sections titles "
53-
"with the tool name. Please use 'pylint.main' instead.",
54-
UserWarning,
55-
)
56-
else:
57-
continue
58-
for opt, value in parser[section].items():
59-
config_content[opt] = value
60-
options += [f"--{opt}", value]
45+
if ini_file_with_sections and not section.startswith("pylint"):
46+
continue
47+
for option, value in parser[section].items():
48+
config_content[option] = value
49+
options += [f"--{option}", value]
6150
return config_content, options
6251

6352
@staticmethod

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

Lines changed: 0 additions & 3 deletions
This file was deleted.

tests/config/functional/setup_cfg/deprecate_master/setup.result.json

Lines changed: 0 additions & 3 deletions
This file was deleted.

0 commit comments

Comments
 (0)