summaryrefslogtreecommitdiff
path: root/pylint
diff options
context:
space:
mode:
authorPierre Sassoulas <pierre.sassoulas@gmail.com>2023-03-20 21:50:34 +0100
committerGitHub <noreply@github.com>2023-03-20 21:50:34 +0100
commit5a72e22b350ce717ebf1f693d3ca9a0edc343839 (patch)
treeb7a034a3ad5327bd7cbade24c8c309c72d7515ac /pylint
parent9488c8c7576ed13e42a295041551df046d2f7d56 (diff)
downloadpylint-git-5a72e22b350ce717ebf1f693d3ca9a0edc343839.tar.gz
[deprecation] Remove the warning about the old pylint home (#8462)
Also remove related tests, and simplify existing one
Diffstat (limited to 'pylint')
-rw-r--r--pylint/config/help_formatter.py5
-rw-r--r--pylint/constants.py50
2 files changed, 2 insertions, 53 deletions
diff --git a/pylint/config/help_formatter.py b/pylint/config/help_formatter.py
index 5e517d944..47caa3fff 100644
--- a/pylint/config/help_formatter.py
+++ b/pylint/config/help_formatter.py
@@ -7,7 +7,7 @@ from __future__ import annotations
import argparse
from pylint.config.callback_actions import _CallbackAction
-from pylint.constants import DEFAULT_PYLINT_HOME, OLD_DEFAULT_PYLINT_HOME
+from pylint.constants import DEFAULT_PYLINT_HOME
class _HelpFormatter(argparse.RawDescriptionHelpFormatter):
@@ -35,8 +35,7 @@ class _HelpFormatter(argparse.RawDescriptionHelpFormatter):
Environment variables:
The following environment variables are used:
* PYLINTHOME Path to the directory where persistent data for the run will
- be stored. If not found, it defaults to '{DEFAULT_PYLINT_HOME}'
- or '{OLD_DEFAULT_PYLINT_HOME}' (in the current working directory).
+ be stored. If not found, it defaults to '{DEFAULT_PYLINT_HOME}'.
* PYLINTRC Path to the configuration file. See the documentation for the method used
to search for configuration file.
diff --git a/pylint/constants.py b/pylint/constants.py
index ad7fc2256..1818eed52 100644
--- a/pylint/constants.py
+++ b/pylint/constants.py
@@ -5,10 +5,8 @@
from __future__ import annotations
import os
-import pathlib
import platform
import sys
-from datetime import datetime
import astroid
import platformdirs
@@ -49,9 +47,6 @@ MSG_TYPES_STATUS = {"I": 0, "C": 16, "R": 8, "W": 4, "E": 2, "F": 1}
# 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
-OLD_DEFAULT_PYLINT_HOME = ".pylint.d"
DEFAULT_PYLINT_HOME = platformdirs.user_cache_dir("pylint")
DEFAULT_IGNORE_LIST = ("CVS",)
@@ -101,55 +96,10 @@ INCOMPATIBLE_WITH_USELESS_SUPPRESSION = frozenset(
)
-def _warn_about_old_home(pylint_home: pathlib.Path) -> None:
- """Warn users about the old pylint home being deprecated.
-
- The spam prevention mechanism is due to pylint being used in parallel by
- pre-commit, and the message being spammy in this context
- Also if you work with an old version of pylint that recreates the
- old pylint home, you can get the old message for a long time.
- """
- prefix_spam_prevention = "pylint_warned_about_old_cache_already"
- spam_prevention_file = pathlib.Path(pylint_home) / datetime.now().strftime(
- prefix_spam_prevention + "_%Y-%m-%d.temp"
- )
- old_home = pathlib.Path(USER_HOME) / OLD_DEFAULT_PYLINT_HOME
-
- if old_home.exists() and not spam_prevention_file.exists():
- print(
- f"PYLINTHOME is now '{pylint_home}' but obsolescent '{old_home}' is found; "
- "you can safely remove the latter",
- file=sys.stderr,
- )
-
- # Remove old spam prevention file
- if pylint_home.exists():
- for filename in pylint_home.iterdir():
- if prefix_spam_prevention in str(filename):
- try:
- os.remove(pylint_home / filename)
- except OSError: # pragma: no cover
- pass
-
- # Create spam prevention file for today
- try:
- pylint_home.mkdir(parents=True, exist_ok=True)
- with open(spam_prevention_file, "w", encoding="utf8") as f:
- f.write("")
- except Exception as exc: # pragma: no cover # pylint: disable=broad-except
- print(
- "Can't write the file that was supposed to "
- f"prevent 'pylint.d' deprecation spam in {pylint_home} because of {exc}."
- )
-
-
def _get_pylint_home() -> str:
"""Return the pylint home."""
if "PYLINTHOME" in os.environ:
return os.environ["PYLINTHOME"]
-
- _warn_about_old_home(pathlib.Path(DEFAULT_PYLINT_HOME))
-
return DEFAULT_PYLINT_HOME