From 3e643a0b3ad0d019a6ca9395e4ca377efd60c63d Mon Sep 17 00:00:00 2001 From: Andreas Finkler <3929834+DudeNr33@users.noreply.github.com> Date: Sun, 15 May 2022 09:01:11 +0200 Subject: Create constant for default ignore list (#6615) --- pylint/constants.py | 2 ++ pylint/lint/base_options.py | 4 ++-- pylint/pyreverse/inspector.py | 3 ++- pylint/pyreverse/main.py | 3 ++- 4 files changed, 8 insertions(+), 4 deletions(-) diff --git a/pylint/constants.py b/pylint/constants.py index 2a6276ff3..6993b400c 100644 --- a/pylint/constants.py +++ b/pylint/constants.py @@ -54,6 +54,8 @@ USER_HOME = os.path.expanduser("~") OLD_DEFAULT_PYLINT_HOME = ".pylint.d" DEFAULT_PYLINT_HOME = platformdirs.user_cache_dir("pylint") +DEFAULT_IGNORE_LIST = ("CVS",) + class WarningScope: LINE = "line-based-msg" diff --git a/pylint/lint/base_options.py b/pylint/lint/base_options.py index a25827b2b..aab019044 100644 --- a/pylint/lint/base_options.py +++ b/pylint/lint/base_options.py @@ -10,7 +10,7 @@ import re import sys from typing import TYPE_CHECKING -from pylint import interfaces +from pylint import constants, interfaces from pylint.config.callback_actions import ( _DisableAction, _DoNothingAction, @@ -44,7 +44,7 @@ def _make_linter_options(linter: PyLinter) -> Options: "metavar": "[,...]", "dest": "black_list", "kwargs": {"old_names": ["black_list"]}, - "default": ("CVS",), + "default": constants.DEFAULT_IGNORE_LIST, "help": "Files or directories to be skipped. " "They should be base names, not paths.", }, diff --git a/pylint/pyreverse/inspector.py b/pylint/pyreverse/inspector.py index afd55c0a6..01f720874 100644 --- a/pylint/pyreverse/inspector.py +++ b/pylint/pyreverse/inspector.py @@ -18,6 +18,7 @@ from typing import Any, Callable, Optional import astroid from astroid import nodes +from pylint import constants from pylint.pyreverse import utils _WrapperFuncT = Callable[[Callable[[str], nodes.Module], str], Optional[nodes.Module]] @@ -322,7 +323,7 @@ def project_from_files( files: list[str], func_wrapper: _WrapperFuncT = _astroid_wrapper, project_name: str = "no name", - black_list: tuple[str, ...] = ("CVS",), + black_list: tuple[str, ...] = constants.DEFAULT_IGNORE_LIST, ) -> Project: """Return a Project from a list of files or modules.""" # build the project representation diff --git a/pylint/pyreverse/main.py b/pylint/pyreverse/main.py index 0dc731618..8584bc698 100644 --- a/pylint/pyreverse/main.py +++ b/pylint/pyreverse/main.py @@ -10,6 +10,7 @@ import sys from collections.abc import Sequence from typing import NoReturn +from pylint import constants from pylint.config.arguments_manager import _ArgumentsManager from pylint.config.arguments_provider import _ArgumentsProvider from pylint.lint.utils import fix_import_path @@ -175,7 +176,7 @@ OPTIONS: Options = ( type="csv", metavar="", dest="ignore_list", - default=("CVS",), + default=constants.DEFAULT_IGNORE_LIST, help="Files or directories to be skipped. They should be base names, not paths.", ), ), -- cgit v1.2.1