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
commita46d366a4e33cbc8008e58853d78222cf781a170 (patch)
treef673adfef518ffcab696011dd7d1a79dea088302
parent12beaa0d3fa050b68dff092520966c63d2f0e437 (diff)
downloadpylint-git-a46d366a4e33cbc8008e58853d78222cf781a170.tar.gz
Rename blacklisted-name to disallowed-name
In the base checker, change the 'blacklisted-name' message to 'disallowed-name'. For backward compatibility, blacklisted-name is an old_name for disallowed-name.
-rw-r--r--pylint/checkers/base.py27
-rw-r--r--tests/functional/a/async_functions.py2
-rw-r--r--tests/functional/a/async_functions.txt2
-rw-r--r--tests/functional/b/blacklisted_name.py2
-rw-r--r--tests/functional/b/blacklisted_name.txt2
-rw-r--r--tests/functional/c/comparison_with_callable.py2
-rw-r--r--tests/functional/c/consider/consider_using_sys_exit.py2
-rw-r--r--tests/functional/i/inconsistent/inconsistent_returns.py2
-rw-r--r--tests/functional/l/logical_tautology.py2
-rw-r--r--tests/functional/m/messages_managed_by_id.py3
-rw-r--r--tests/functional/m/misplaced_format_function.py2
-rw-r--r--tests/functional/n/name/name_good_bad_names_regex.py4
-rw-r--r--tests/functional/n/name/name_good_bad_names_regex.txt4
-rw-r--r--tests/functional/r/recursion/recursion_error_2899.py2
-rw-r--r--tests/functional/r/recursion/recursion_error_2906.py2
-rw-r--r--tests/functional/s/subprocess_popen_preexec_fn.py2
-rw-r--r--tests/functional/s/subprocess_run_check35.py2
-rw-r--r--tests/functional/u/unused/unused_import_assigned_to.py2
18 files changed, 37 insertions, 29 deletions
diff --git a/pylint/checkers/base.py b/pylint/checkers/base.py
index 1c30acddf..b9dde439b 100644
--- a/pylint/checkers/base.py
+++ b/pylint/checkers/base.py
@@ -1724,17 +1724,22 @@ def _create_naming_options():
class NameChecker(_BasicChecker):
msgs = {
- "C0102": (
- 'Disallowed name "%s"',
- "blacklisted-name",
- "Used when the name matches bad-names or bad-names-rgxs- (unauthorized names).",
- ),
"C0103": (
'%s name "%s" doesn\'t conform to %s',
"invalid-name",
"Used when the name doesn't conform to naming rules "
"associated to its type (constant, variable, class...).",
),
+ "C0104": (
+ 'Disallowed name "%s"',
+ "disallowed-name",
+ "Used when the name matches bad-names or bad-names-rgxs- (unauthorized names).",
+ {
+ "old_names": [
+ ("C0102", "blacklisted-name"),
+ ]
+ },
+ ),
"C0144": (
'%s name "%s" contains a non-ASCII unicode character',
"non-ascii-name",
@@ -1888,7 +1893,7 @@ class NameChecker(_BasicChecker):
return regexps, hints
- @utils.check_messages("blacklisted-name", "invalid-name", "non-ascii-name")
+ @utils.check_messages("disallowed-name", "invalid-name", "non-ascii-name")
def visit_module(self, node):
self._check_name("module", node.name.split(".")[-1], node)
self._bad_names = {}
@@ -1914,7 +1919,7 @@ class NameChecker(_BasicChecker):
self._raise_name_warning(*args)
@utils.check_messages(
- "blacklisted-name", "invalid-name", "assign-to-new-keyword", "non-ascii-name"
+ "disallowed-name", "invalid-name", "assign-to-new-keyword", "non-ascii-name"
)
def visit_classdef(self, node):
self._check_assign_to_new_keyword_violation(node.name, node)
@@ -1924,7 +1929,7 @@ class NameChecker(_BasicChecker):
self._check_name("attr", attr, anodes[0])
@utils.check_messages(
- "blacklisted-name", "invalid-name", "assign-to-new-keyword", "non-ascii-name"
+ "disallowed-name", "invalid-name", "assign-to-new-keyword", "non-ascii-name"
)
def visit_functiondef(self, node):
# Do not emit any warnings if the method is just an implementation
@@ -1953,13 +1958,13 @@ class NameChecker(_BasicChecker):
visit_asyncfunctiondef = visit_functiondef
- @utils.check_messages("blacklisted-name", "invalid-name", "non-ascii-name")
+ @utils.check_messages("disallowed-name", "invalid-name", "non-ascii-name")
def visit_global(self, node):
for name in node.names:
self._check_name("const", name, node)
@utils.check_messages(
- "blacklisted-name", "invalid-name", "assign-to-new-keyword", "non-ascii-name"
+ "disallowed-name", "invalid-name", "assign-to-new-keyword", "non-ascii-name"
)
def visit_assignname(self, node):
"""check module level assigned names"""
@@ -2060,7 +2065,7 @@ class NameChecker(_BasicChecker):
return
if self._name_disallowed_by_regex(name=name):
self.stats["badname_" + node_type] += 1
- self.add_message("blacklisted-name", node=node, args=name)
+ self.add_message("disallowed-name", node=node, args=name)
return
regexp = self._name_regexps[node_type]
match = regexp.match(name)
diff --git a/tests/functional/a/async_functions.py b/tests/functional/a/async_functions.py
index 2f2252de8..3e634341c 100644
--- a/tests/functional/a/async_functions.py
+++ b/tests/functional/a/async_functions.py
@@ -58,6 +58,6 @@ async def func(a, a, b=[]):
return a, b
-# +1: [empty-docstring, blacklisted-name]
+# +1: [empty-docstring, disallowed-name]
async def foo():
""
diff --git a/tests/functional/a/async_functions.txt b/tests/functional/a/async_functions.txt
index 6eb64e253..cb5324868 100644
--- a/tests/functional/a/async_functions.txt
+++ b/tests/functional/a/async_functions.txt
@@ -7,5 +7,5 @@ too-many-return-statements:26:0:complex_function:Too many return statements (10/
dangerous-default-value:57:0:func:Dangerous default value [] as argument
duplicate-argument-name:57:15:func:Duplicate argument name a in function definition
duplicate-argument-name:57:18:func:Duplicate argument name a in function definition
-blacklisted-name:62:0:foo:Disallowed name "foo"
+disallowed-name:62:0:foo:Disallowed name "foo"
empty-docstring:62:0:foo:Empty function docstring
diff --git a/tests/functional/b/blacklisted_name.py b/tests/functional/b/blacklisted_name.py
index b62c6d276..84067e3ff 100644
--- a/tests/functional/b/blacklisted_name.py
+++ b/tests/functional/b/blacklisted_name.py
@@ -1,4 +1,4 @@
# pylint: disable=missing-docstring
-def baz(): # [blacklisted-name]
+def baz(): # [disallowed-name]
pass
diff --git a/tests/functional/b/blacklisted_name.txt b/tests/functional/b/blacklisted_name.txt
index 160bb6b9f..747d71a95 100644
--- a/tests/functional/b/blacklisted_name.txt
+++ b/tests/functional/b/blacklisted_name.txt
@@ -1 +1 @@
-blacklisted-name:3:0:baz:Disallowed name "baz"
+disallowed-name:3:0:baz:Disallowed name "baz"
diff --git a/tests/functional/c/comparison_with_callable.py b/tests/functional/c/comparison_with_callable.py
index ea7024c1b..b676844ae 100644
--- a/tests/functional/c/comparison_with_callable.py
+++ b/tests/functional/c/comparison_with_callable.py
@@ -1,4 +1,4 @@
-# pylint: disable = blacklisted-name, missing-docstring, useless-return, misplaced-comparison-constant, invalid-name, no-self-use, line-too-long, useless-object-inheritance
+# pylint: disable = disallowed-name, missing-docstring, useless-return, misplaced-comparison-constant, invalid-name, no-self-use, line-too-long, useless-object-inheritance
def foo():
return None
diff --git a/tests/functional/c/consider/consider_using_sys_exit.py b/tests/functional/c/consider/consider_using_sys_exit.py
index 4cec44847..524cf004d 100644
--- a/tests/functional/c/consider/consider_using_sys_exit.py
+++ b/tests/functional/c/consider/consider_using_sys_exit.py
@@ -1,4 +1,4 @@
-# pylint: disable=missing-docstring, invalid-name, blacklisted-name, redefined-builtin, unused-variable
+# pylint: disable=missing-docstring, invalid-name, disallowed-name, redefined-builtin, unused-variable
import sys
def foo():
diff --git a/tests/functional/i/inconsistent/inconsistent_returns.py b/tests/functional/i/inconsistent/inconsistent_returns.py
index 9997e9a2c..fef090fc4 100644
--- a/tests/functional/i/inconsistent/inconsistent_returns.py
+++ b/tests/functional/i/inconsistent/inconsistent_returns.py
@@ -1,5 +1,5 @@
#pylint: disable=missing-docstring, no-else-return, no-else-break, invalid-name, unused-variable, superfluous-parens, try-except-raise
-#pylint: disable=blacklisted-name
+#pylint: disable=disallowed-name
"""Testing inconsistent returns"""
import math
import sys
diff --git a/tests/functional/l/logical_tautology.py b/tests/functional/l/logical_tautology.py
index 89ea4de91..be133ba87 100644
--- a/tests/functional/l/logical_tautology.py
+++ b/tests/functional/l/logical_tautology.py
@@ -1,5 +1,5 @@
"""Check for logical tautology, when a value is compared against itself."""
-# pylint: disable=missing-docstring, blacklisted-name, singleton-comparison, too-many-return-statements, inconsistent-return-statements, no-else-return, too-many-branches, literal-comparison
+# pylint: disable=missing-docstring, disallowed-name, singleton-comparison, too-many-return-statements, inconsistent-return-statements, no-else-return, too-many-branches, literal-comparison
def foo():
arg = 786
diff --git a/tests/functional/m/messages_managed_by_id.py b/tests/functional/m/messages_managed_by_id.py
index 67b74ec88..ba5f90c1f 100644
--- a/tests/functional/m/messages_managed_by_id.py
+++ b/tests/functional/m/messages_managed_by_id.py
@@ -9,3 +9,6 @@ def toto(): #pylint: disable=C0102,R1711
# +1: [missing-function-docstring]
def test_enabled_by_id_msg(): #pylint: enable=C0111
pass
+
+def baz(): #pylint: disable=blacklisted-name
+ return 1
diff --git a/tests/functional/m/misplaced_format_function.py b/tests/functional/m/misplaced_format_function.py
index 3520dc70b..7bcabfc03 100644
--- a/tests/functional/m/misplaced_format_function.py
+++ b/tests/functional/m/misplaced_format_function.py
@@ -1,6 +1,6 @@
"""Test that format function is used only with string."""
-# pylint: disable=invalid-name, pointless-string-statement, line-too-long, no-member, blacklisted-name, undefined-variable, missing-docstring, too-few-public-methods
+# pylint: disable=invalid-name, pointless-string-statement, line-too-long, no-member, disallowed-name, undefined-variable, missing-docstring, too-few-public-methods
print('value: {}').format(123) # [misplaced-format-function]
print("value: {}").format(123) # [misplaced-format-function]
diff --git a/tests/functional/n/name/name_good_bad_names_regex.py b/tests/functional/n/name/name_good_bad_names_regex.py
index 35f88b7a8..75208c1eb 100644
--- a/tests/functional/n/name/name_good_bad_names_regex.py
+++ b/tests/functional/n/name/name_good_bad_names_regex.py
@@ -2,7 +2,7 @@
__version__ = "1.0"
ignored_SOME_CONSTANT = 42
-explicit_bad_some_constant = 42 # [blacklisted-name]
+explicit_bad_some_constant = 42 # [disallowed-name]
snake_case_bad_SOME_CONSTANT = 42 # [invalid-name]
@@ -16,5 +16,5 @@ class my_class:
return self._my_secret_x * 2
-def disallowed_2_snake_case(): # [blacklisted-name]
+def disallowed_2_snake_case(): # [disallowed-name]
pass
diff --git a/tests/functional/n/name/name_good_bad_names_regex.txt b/tests/functional/n/name/name_good_bad_names_regex.txt
index 4bced1323..537c42983 100644
--- a/tests/functional/n/name/name_good_bad_names_regex.txt
+++ b/tests/functional/n/name/name_good_bad_names_regex.txt
@@ -1,3 +1,3 @@
-blacklisted-name:5:0::Disallowed name "explicit_bad_some_constant"
+disallowed-name:5:0::Disallowed name "explicit_bad_some_constant"
invalid-name:7:0::"Constant name ""snake_case_bad_SOME_CONSTANT"" doesn't conform to snake_case naming style ('([^\\W\\dA-Z][^\\WA-Z]*|__.*__)$' pattern)"
-blacklisted-name:19:0:disallowed_2_snake_case:Disallowed name "disallowed_2_snake_case"
+disallowed-name:19:0:disallowed_2_snake_case:Disallowed name "disallowed_2_snake_case"
diff --git a/tests/functional/r/recursion/recursion_error_2899.py b/tests/functional/r/recursion/recursion_error_2899.py
index aa01f2aca..27ee2875c 100644
--- a/tests/functional/r/recursion/recursion_error_2899.py
+++ b/tests/functional/r/recursion/recursion_error_2899.py
@@ -1,4 +1,4 @@
-# pylint: disable=global-statement,missing-docstring,blacklisted-name
+# pylint: disable=global-statement,missing-docstring,disallowed-name
foo = "test"
diff --git a/tests/functional/r/recursion/recursion_error_2906.py b/tests/functional/r/recursion/recursion_error_2906.py
index 062109672..6b4b08d5f 100644
--- a/tests/functional/r/recursion/recursion_error_2906.py
+++ b/tests/functional/r/recursion/recursion_error_2906.py
@@ -1,5 +1,5 @@
"""Recursion error for https://github.com/PyCQA/pylint/issues/2906"""
-# pylint: disable=blacklisted-name,global-statement,invalid-name,missing-docstring
+# pylint: disable=disallowed-name,global-statement,invalid-name,missing-docstring
lst = []
diff --git a/tests/functional/s/subprocess_popen_preexec_fn.py b/tests/functional/s/subprocess_popen_preexec_fn.py
index e785abc76..070d25a8c 100644
--- a/tests/functional/s/subprocess_popen_preexec_fn.py
+++ b/tests/functional/s/subprocess_popen_preexec_fn.py
@@ -1,4 +1,4 @@
-# pylint: disable=blacklisted-name,no-value-for-parameter,missing-docstring
+# pylint: disable=disallowed-name,no-value-for-parameter,missing-docstring
import subprocess
diff --git a/tests/functional/s/subprocess_run_check35.py b/tests/functional/s/subprocess_run_check35.py
index f123fb20d..fc4d99d9b 100644
--- a/tests/functional/s/subprocess_run_check35.py
+++ b/tests/functional/s/subprocess_run_check35.py
@@ -1,4 +1,4 @@
-# pylint: disable=blacklisted-name,no-value-for-parameter,missing-docstring
+# pylint: disable=disallowed-name,no-value-for-parameter,missing-docstring
import subprocess
diff --git a/tests/functional/u/unused/unused_import_assigned_to.py b/tests/functional/u/unused/unused_import_assigned_to.py
index 81d3e2ce0..fb339bce7 100644
--- a/tests/functional/u/unused/unused_import_assigned_to.py
+++ b/tests/functional/u/unused/unused_import_assigned_to.py
@@ -1,5 +1,5 @@
# pylint: disable=missing-docstring, import-error, invalid-name
-# pylint: disable=too-few-public-methods, blacklisted-name, no-member, useless-object-inheritance
+# pylint: disable=too-few-public-methods, disallowed-name, no-member, useless-object-inheritance
import uuid