summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Kolbus <peter.kolbus@gmail.com>2020-11-29 07:57:39 -0600
committerPierre Sassoulas <pierre.sassoulas@gmail.com>2021-03-09 09:13:05 +0100
commitd19c7733717ae9ad0a527233c2950473dce3ffcf (patch)
tree4215a2523554d2230ce1276da867e27d45a2308c
parent0f1245c2959f16dd68a2f7cf191c3cee0fcc08c2 (diff)
downloadpylint-git-d19c7733717ae9ad0a527233c2950473dce3ffcf.tar.gz
Reduce 'blacklist' term for ignored files
Replace usage of the term 'blacklist' in the context of ignored files and directories (--ignore and --ignore-patterns), except in cases where backward compatibility is needed. In documentation and help, supplement 'ignore' with 'skip'; in code use the term 'ignore list'.
-rw-r--r--doc/user_guide/run.rst4
-rw-r--r--doc/whatsnew/1.7.rst2
-rw-r--r--examples/pylintrc7
-rw-r--r--man/pylint.14
-rw-r--r--man/pyreverse.12
-rw-r--r--pylint/lint/pylinter.py6
-rw-r--r--pylint/pyreverse/main.py6
-rw-r--r--pylint/utils/__init__.py4
-rw-r--r--pylint/utils/utils.py24
-rw-r--r--pylintrc2
-rw-r--r--tests/utils/unittest_utils.py12
11 files changed, 36 insertions, 37 deletions
diff --git a/doc/user_guide/run.rst b/doc/user_guide/run.rst
index d8268c36d..971ae801d 100644
--- a/doc/user_guide/run.rst
+++ b/doc/user_guide/run.rst
@@ -118,8 +118,8 @@ configuration.
Other useful global options include:
---ignore=<file[,file...]> Add files or directories to the blacklist. They
- should be base names, not paths.
+--ignore=<file[,file...]> Files or directories to be skipped. They should be
+ base names, not paths.
--output-format=<format> Select output format (text, json, custom).
--msg-template=<template> Modify text output message template.
--list-msgs Generate pylint's messages.
diff --git a/doc/whatsnew/1.7.rst b/doc/whatsnew/1.7.rst
index 46063bb1d..0690ab9e5 100644
--- a/doc/whatsnew/1.7.rst
+++ b/doc/whatsnew/1.7.rst
@@ -631,7 +631,7 @@ Other Changes
which can redefine builtins, such as six.moves and future.builtins.
* A new option was added, ``ignore-patterns``, which is used for building a
- blacklist of directories and files matching the regex patterns, similar to the
+ ignore list of directories and files matching the regex patterns, similar to the
``ignore`` option.
diff --git a/examples/pylintrc b/examples/pylintrc
index e5995bbae..211796fa9 100644
--- a/examples/pylintrc
+++ b/examples/pylintrc
@@ -8,12 +8,11 @@ extension-pkg-whitelist=
# Specify a score threshold to be exceeded before program exits with error.
fail-under=10
-# Add files or directories to the blacklist. They should be base names, not
-# paths.
+# Files or directories to be skipped. They should be base names, not paths.
ignore=CVS
-# Add files or directories matching the regex patterns to the blacklist. The
-# regex matches against base names, not paths.
+# Files or directories matching the regex patterns are skipped. The regex
+# matches against base names, not paths.
ignore-patterns=
# Python code to execute, usually for sys.path manipulation such as
diff --git a/man/pylint.1 b/man/pylint.1
index b08a0be78..d823428b5 100644
--- a/man/pylint.1
+++ b/man/pylint.1
@@ -47,9 +47,9 @@ In Python 3 porting mode, all checkers will be disabled and only messages emitte
.IP "--verbose, -v"
In verbose mode, extra non-checker-related info will be displayed.
.IP "--ignore=<file>[,<file>...]"
-Add files or directories to the blacklist. They should be base names, not paths. [default: CVS]
+Files or directories to be skipped. They should be base names, not paths. [default: CVS]
.IP "--ignore-patterns=<pattern>[,<pattern>...]"
-Add files or directories matching the regex patterns to the blacklist. The regex matches against base names, not paths. [default: none]
+Files or directories matching the regex patterns are skipped. The regex matches against base names, not paths. [default: none]
.IP "--persistent=<y_or_n>"
Pickle collected data for later comparisons. [default: yes]
.IP "--load-plugins=<modules>"
diff --git a/man/pyreverse.1 b/man/pyreverse.1
index 11631d3da..d14454e5b 100644
--- a/man/pyreverse.1
+++ b/man/pyreverse.1
@@ -38,7 +38,7 @@ show help message and exit
.IP "-p<name>, --project=<name>"
set project name to <name> if not using \-c option. (default:'No Name')
.IP "--ignore=<file[,file...]>"
-add files or directories to the blacklist. They should be base names, not
+files or directories to be skipped. They should be base names, not
paths. [current: CVS]
.IP "-f<mode>, --filter-mode=<mode>"
filter attributes and functions according to <mode>. You can combine
diff --git a/pylint/lint/pylinter.py b/pylint/lint/pylinter.py
index 3ce5f53b3..502109347 100644
--- a/pylint/lint/pylinter.py
+++ b/pylint/lint/pylinter.py
@@ -164,7 +164,7 @@ class PyLinter(
"metavar": "<file>[,<file>...]",
"dest": "black_list",
"default": ("CVS",),
- "help": "Add files or directories to the blacklist. "
+ "help": "Files or directories to be skipped. "
"They should be base names, not paths.",
},
),
@@ -175,8 +175,8 @@ class PyLinter(
"metavar": "<pattern>[,<pattern>...]",
"dest": "black_list_re",
"default": (),
- "help": "Add files or directories matching the regex patterns to the"
- " blacklist. The regex matches against base names, not paths.",
+ "help": "Files or directories matching the regex patterns are"
+ " skipped. The regex matches against base names, not paths.",
},
),
(
diff --git a/pylint/pyreverse/main.py b/pylint/pyreverse/main.py
index a71de203d..0ea625587 100644
--- a/pylint/pyreverse/main.py
+++ b/pylint/pyreverse/main.py
@@ -141,9 +141,9 @@ this disables -f values",
{
"type": "csv",
"metavar": "<file[,file...]>",
- "dest": "black_list",
+ "dest": "ignore_list",
"default": ("CVS",),
- "help": "Add files or directories to the blacklist. They "
+ "help": "Files or directories to be skipped. They "
"should be base names, not paths.",
},
),
@@ -210,7 +210,7 @@ class Run(ConfigurationMixIn):
project = project_from_files(
args,
project_name=self.config.project,
- black_list=self.config.black_list,
+ black_list=self.config.ignore_list,
)
linker = Linker(project, tag=True)
handler = DiadefsHandler(self.config)
diff --git a/pylint/utils/__init__.py b/pylint/utils/__init__.py
index 88a6140b1..fb50bbf7e 100644
--- a/pylint/utils/__init__.py
+++ b/pylint/utils/__init__.py
@@ -46,7 +46,7 @@ from pylint.utils.file_state import FileState
from pylint.utils.utils import (
HAS_ISORT_5,
IsortDriver,
- _basename_in_blacklist_re,
+ _basename_in_ignore_list_re,
_check_csv,
_format_option_value,
_splitstrip,
@@ -69,7 +69,7 @@ __all__ = [
"ASTWalker",
"HAS_ISORT_5",
"IsortDriver",
- "_basename_in_blacklist_re",
+ "_basename_in_ignore_list_re",
"_check_csv",
"_format_option_value",
"_splitstrip",
diff --git a/pylint/utils/utils.py b/pylint/utils/utils.py
index 35a74bfcd..0b4351722 100644
--- a/pylint/utils/utils.py
+++ b/pylint/utils/utils.py
@@ -97,17 +97,17 @@ def tokenize_module(module):
return list(tokenize.tokenize(readline))
-def _basename_in_blacklist_re(base_name, black_list_re):
- """Determines if the basename is matched in a regex blacklist
+def _basename_in_ignore_list_re(base_name, ignore_list_re):
+ """Determines if the basename is matched in a regex ignorelist
:param str base_name: The basename of the file
- :param list black_list_re: A collection of regex patterns to match against.
- Successful matches are blacklisted.
+ :param list ignore_list_re: A collection of regex patterns to match against.
+ Successful matches are ignored.
- :returns: `True` if the basename is blacklisted, `False` otherwise.
+ :returns: `True` if the basename is ignored, `False` otherwise.
:rtype: bool
"""
- for file_pattern in black_list_re:
+ for file_pattern in ignore_list_re:
if file_pattern.match(base_name):
return True
return False
@@ -136,7 +136,7 @@ def get_python_path(filepath):
return None
-def expand_modules(files_or_modules, black_list, black_list_re):
+def expand_modules(files_or_modules, ignore_list, ignore_list_re):
"""take a list of files/modules/packages and return the list of tuple
(file, module name) which have to be actually checked
"""
@@ -145,9 +145,9 @@ def expand_modules(files_or_modules, black_list, black_list_re):
path = sys.path.copy()
for something in files_or_modules:
- if os.path.basename(something) in black_list:
+ if os.path.basename(something) in ignore_list:
continue
- if _basename_in_blacklist_re(os.path.basename(something), black_list_re):
+ if _basename_in_ignore_list_re(os.path.basename(something), ignore_list_re):
continue
module_path = get_python_path(something)
@@ -211,12 +211,12 @@ def expand_modules(files_or_modules, black_list, black_list_re):
)
if has_init or is_namespace or is_directory:
for subfilepath in modutils.get_module_files(
- os.path.dirname(filepath), black_list, list_all=is_namespace
+ os.path.dirname(filepath), ignore_list, list_all=is_namespace
):
if filepath == subfilepath:
continue
- if _basename_in_blacklist_re(
- os.path.basename(subfilepath), black_list_re
+ if _basename_in_ignore_list_re(
+ os.path.basename(subfilepath), ignore_list_re
):
continue
diff --git a/pylintrc b/pylintrc
index c75c3fa02..47b7d28cc 100644
--- a/pylintrc
+++ b/pylintrc
@@ -7,7 +7,7 @@
# pygtk.require().
#init-hook=
-# Add files or directories to the blacklist. They should be base names, not
+# Files or directories to be skipped. They should be base names, not
# paths.
ignore=CVS
diff --git a/tests/utils/unittest_utils.py b/tests/utils/unittest_utils.py
index 34b525926..1887af466 100644
--- a/tests/utils/unittest_utils.py
+++ b/tests/utils/unittest_utils.py
@@ -22,16 +22,16 @@ import re
from pylint.utils import utils
-def test__basename_in_blacklist_re_match():
+def test__basename_in_ignore_list_re_match():
patterns = [re.compile(".*enchilada.*"), re.compile("unittest_.*")]
- assert utils._basename_in_blacklist_re("unittest_utils.py", patterns)
- assert utils._basename_in_blacklist_re("cheese_enchiladas.xml", patterns)
+ assert utils._basename_in_ignore_list_re("unittest_utils.py", patterns)
+ assert utils._basename_in_ignore_list_re("cheese_enchiladas.xml", patterns)
-def test__basename_in_blacklist_re_nomatch():
+def test__basename_in_ignore_list_re_nomatch():
patterns = [re.compile(".*enchilada.*"), re.compile("unittest_.*")]
- assert not utils._basename_in_blacklist_re("test_utils.py", patterns)
- assert not utils._basename_in_blacklist_re("enchilad.py", patterns)
+ assert not utils._basename_in_ignore_list_re("test_utils.py", patterns)
+ assert not utils._basename_in_ignore_list_re("enchilad.py", patterns)
def test_decoding_stream_unknown_encoding():