summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPierre Sassoulas <pierre.sassoulas@gmail.com>2021-10-24 19:38:12 +0200
committerPierre Sassoulas <pierre.sassoulas@gmail.com>2021-10-26 06:48:45 +0200
commitb6597225fbbc336b5fb30a36ba21b3866d2a9fdb (patch)
treeb1ff207b1f9e022c7571f68fee30ca2df9b56146
parentd3fd7f0f5292be31b92b431b6c9c9d6c05e8dd64 (diff)
downloadpylint-git-b6597225fbbc336b5fb30a36ba21b3866d2a9fdb.tar.gz
Create a OLD_DEFAULT_PYLINT_HOME constants
-rw-r--r--pylint/config/__init__.py6
-rw-r--r--pylint/constants.py3
-rw-r--r--pylint/lint/run.py5
-rw-r--r--tests/lint/unittest_lint.py5
4 files changed, 12 insertions, 7 deletions
diff --git a/pylint/config/__init__.py b/pylint/config/__init__.py
index f9c393ef7..a07bf594a 100644
--- a/pylint/config/__init__.py
+++ b/pylint/config/__init__.py
@@ -47,7 +47,7 @@ from pylint.config.option import Option
from pylint.config.option_manager_mixin import OptionsManagerMixIn
from pylint.config.option_parser import OptionParser
from pylint.config.options_provider_mixin import OptionsProviderMixIn, UnsupportedAction
-from pylint.constants import DEFAULT_PYLINT_HOME
+from pylint.constants import DEFAULT_PYLINT_HOME, OLD_DEFAULT_PYLINT_HOME
from pylint.utils import LinterStats
__all__ = [
@@ -67,7 +67,7 @@ if "PYLINTHOME" in os.environ:
if USER_HOME == "~":
USER_HOME = os.path.dirname(PYLINT_HOME)
elif USER_HOME == "~":
- PYLINT_HOME = ".pylint.d"
+ PYLINT_HOME = OLD_DEFAULT_PYLINT_HOME
else:
PYLINT_HOME = DEFAULT_PYLINT_HOME
# The spam prevention is due to pylint being used in parallel by
@@ -79,7 +79,7 @@ else:
PYLINT_HOME,
datetime.now().strftime(prefix_spam_prevention + "_%Y-%m-%d.temp"),
)
- old_home = os.path.join(USER_HOME, ".pylint.d")
+ old_home = os.path.join(USER_HOME, OLD_DEFAULT_PYLINT_HOME)
if os.path.exists(old_home) and not os.path.exists(spam_prevention_file):
print(
f"PYLINTHOME is now '{PYLINT_HOME}' but obsolescent '{old_home}' is found; "
diff --git a/pylint/constants.py b/pylint/constants.py
index df688eada..bee1055e1 100644
--- a/pylint/constants.py
+++ b/pylint/constants.py
@@ -40,6 +40,9 @@ MSG_TYPES_STATUS = {"I": 0, "C": 16, "R": 8, "W": 4, "E": 2, "F": 1}
# on all project using [MASTER] in their rcfile.
MAIN_CHECKER_NAME = "master"
+# pylint: disable-next=fixme
+# TODO Remove in 3.0 with all the surrounding code
+OLD_DEFAULT_PYLINT_HOME = ".pylint.d"
DEFAULT_PYLINT_HOME = platformdirs.user_cache_dir("pylint")
diff --git a/pylint/lint/run.py b/pylint/lint/run.py
index d63c936f1..4348fd721 100644
--- a/pylint/lint/run.py
+++ b/pylint/lint/run.py
@@ -6,7 +6,7 @@ import sys
import warnings
from pylint import __pkginfo__, extensions, interfaces
-from pylint.constants import DEFAULT_PYLINT_HOME, full_version
+from pylint.constants import DEFAULT_PYLINT_HOME, OLD_DEFAULT_PYLINT_HOME, full_version
from pylint.lint.pylinter import PyLinter
from pylint.lint.utils import ArgumentPreprocessingError, preprocess_options
from pylint.utils import print_full_documentation, utils
@@ -275,7 +275,8 @@ group are mutually exclusive.",
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}'.
+not found, it defaults to '{DEFAULT_PYLINT_HOME}' or '{OLD_DEFAULT_PYLINT_HOME}'
+(in the current working directory).
* PYLINTRC
Path to the configuration file. See the documentation for the method used
to search for configuration file.
diff --git a/tests/lint/unittest_lint.py b/tests/lint/unittest_lint.py
index 91d736744..ad9b28fee 100644
--- a/tests/lint/unittest_lint.py
+++ b/tests/lint/unittest_lint.py
@@ -60,6 +60,7 @@ from pylint.constants import (
MSG_STATE_CONFIDENCE,
MSG_STATE_SCOPE_CONFIG,
MSG_STATE_SCOPE_MODULE,
+ OLD_DEFAULT_PYLINT_HOME,
)
from pylint.exceptions import InvalidMessageError
from pylint.lint import ArgumentPreprocessingError, PyLinter, Run, preprocess_options
@@ -668,13 +669,13 @@ def pop_pylintrc() -> None:
def test_pylint_home() -> None:
uhome = os.path.expanduser("~")
if uhome == "~":
- expected = ".pylint.d"
+ expected = OLD_DEFAULT_PYLINT_HOME
else:
expected = platformdirs.user_cache_dir("pylint")
assert config.PYLINT_HOME == expected
try:
- pylintd = join(tempfile.gettempdir(), ".pylint.d")
+ pylintd = join(tempfile.gettempdir(), OLD_DEFAULT_PYLINT_HOME)
os.environ["PYLINTHOME"] = pylintd
try:
reload(config)