summaryrefslogtreecommitdiff
path: root/pylint/config/config_file_parser.py
diff options
context:
space:
mode:
authorPierre Sassoulas <pierre.sassoulas@gmail.com>2023-03-20 22:55:03 +0100
committerGitHub <noreply@github.com>2023-03-20 22:55:03 +0100
commita47930321b849502481a59f7d9930a1c93dbdd8a (patch)
tree8a8ffcfab7c0680a239dd5e877b8069035ec5d4d /pylint/config/config_file_parser.py
parent699ac888e5db6c02a617596196b436f4c9566069 (diff)
downloadpylint-git-a47930321b849502481a59f7d9930a1c93dbdd8a.tar.gz
[deprecation] ``setup.cfg``and ``tox.ini`` sections need to start by 'pylint' (#8465)
Diffstat (limited to 'pylint/config/config_file_parser.py')
-rw-r--r--pylint/config/config_file_parser.py23
1 files changed, 6 insertions, 17 deletions
diff --git a/pylint/config/config_file_parser.py b/pylint/config/config_file_parser.py
index 019f9b738..ebb74b42b 100644
--- a/pylint/config/config_file_parser.py
+++ b/pylint/config/config_file_parser.py
@@ -9,7 +9,6 @@ from __future__ import annotations
import configparser
import os
import sys
-import warnings
from pathlib import Path
from typing import TYPE_CHECKING
@@ -41,23 +40,13 @@ class _ConfigurationFileParser:
config_content: dict[str, str] = {}
options: list[str] = []
+ ini_file_with_sections = self._ini_file_with_sections(file_path)
for section in parser.sections():
- if self._ini_file_with_sections(file_path) and not section.startswith(
- "pylint"
- ):
- if section.lower() == "master":
- # TODO: 3.0: Remove deprecated handling of master, only allow 'pylint.' sections
- warnings.warn(
- "The use of 'MASTER' or 'master' as configuration section for pylint "
- "has been deprecated, as it's bad practice to not start sections titles "
- "with the tool name. Please use 'pylint.main' instead.",
- UserWarning,
- )
- else:
- continue
- for opt, value in parser[section].items():
- config_content[opt] = value
- options += [f"--{opt}", value]
+ if ini_file_with_sections and not section.startswith("pylint"):
+ continue
+ for option, value in parser[section].items():
+ config_content[option] = value
+ options += [f"--{option}", value]
return config_content, options
@staticmethod