summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog2
-rw-r--r--pylint/checkers/strings.py17
-rw-r--r--tests/functional/b/bad_continuation.py2
-rw-r--r--tests/functional/i/implicit_str_concat.py (renamed from tests/functional/i/implicit_str_concat_in_sequence.py)10
-rw-r--r--tests/functional/i/implicit_str_concat.txt5
-rw-r--r--tests/functional/i/implicit_str_concat_in_sequence.txt5
-rwxr-xr-xtests/functional/i/implicit_str_concat_in_sequence_multiline.txt1
-rw-r--r--tests/functional/i/implicit_str_concat_latin1.py (renamed from tests/functional/i/implicit_str_concat_in_sequence_latin1.py)0
-rw-r--r--tests/functional/i/implicit_str_concat_latin1.txt (renamed from tests/functional/i/implicit_str_concat_in_sequence_latin1.txt)0
-rwxr-xr-xtests/functional/i/implicit_str_concat_multiline.py (renamed from tests/functional/i/implicit_str_concat_in_sequence_multiline.py)2
-rwxr-xr-xtests/functional/i/implicit_str_concat_multiline.rc (renamed from tests/functional/i/implicit_str_concat_in_sequence_multiline.rc)0
-rwxr-xr-xtests/functional/i/implicit_str_concat_multiline.txt1
-rw-r--r--tests/functional/i/implicit_str_concat_utf8.py (renamed from tests/functional/i/implicit_str_concat_in_sequence_utf8.py)0
-rw-r--r--tests/functional/i/implicit_str_concat_utf8.txt (renamed from tests/functional/i/implicit_str_concat_in_sequence_utf8.txt)0
14 files changed, 23 insertions, 22 deletions
diff --git a/ChangeLog b/ChangeLog
index 4e79c294d..e01b5234b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -15,6 +15,8 @@ Release date: TBA
Close #3030
+* ``implicit-str-concat-in-sequence`` was renamed ``implicit-str-concat``
+
* The ``json`` reporter no longer bypasses ``redirect_stdout``. Close #3227
* Move ``NoFileError``, ``OutputLine``, ``FunctionalTestReporter``,
diff --git a/pylint/checkers/strings.py b/pylint/checkers/strings.py
index 95373d8aa..abdf2e8ef 100644
--- a/pylint/checkers/strings.py
+++ b/pylint/checkers/strings.py
@@ -589,12 +589,13 @@ class StringConstantChecker(BaseTokenChecker):
"Used when an escape like \\u is encountered in a byte "
"string where it has no effect.",
),
- "W1403": (
+ "W1404": (
"Implicit string concatenation found in %s",
- "implicit-str-concat-in-sequence",
+ "implicit-str-concat",
"String literals are implicitly concatenated in a "
"literal iterable definition : "
"maybe a comma is missing ?",
+ {"old_names": [("W1403", "implicit-str-concat-in-sequence")]},
),
}
options = (
@@ -605,7 +606,7 @@ class StringConstantChecker(BaseTokenChecker):
"type": "yn",
"metavar": "<y_or_n>",
"help": "This flag controls whether the "
- "implicit-str-concat-in-sequence should generate a warning "
+ "implicit-str-concat should generate a warning "
"on implicit string concatenation in sequences defined over "
"several lines.",
},
@@ -652,15 +653,15 @@ class StringConstantChecker(BaseTokenChecker):
start = (start[0], len(line[: start[1]].encode(encoding)))
self.string_tokens[start] = (str_eval(token), next_token)
- @check_messages("implicit-str-concat-in-sequence")
+ @check_messages("implicit-str-concat")
def visit_list(self, node):
self.check_for_concatenated_strings(node.elts, "list")
- @check_messages("implicit-str-concat-in-sequence")
+ @check_messages("implicit-str-concat")
def visit_set(self, node):
self.check_for_concatenated_strings(node.elts, "set")
- @check_messages("implicit-str-concat-in-sequence")
+ @check_messages("implicit-str-concat")
def visit_tuple(self, node):
self.check_for_concatenated_strings(node.elts, "tuple")
@@ -690,9 +691,7 @@ class StringConstantChecker(BaseTokenChecker):
or self.config.check_str_concat_over_line_jumps
):
self.add_message(
- "implicit-str-concat-in-sequence",
- line=elt.lineno,
- args=(iterable_type,),
+ "implicit-str-concat", line=elt.lineno, args=(iterable_type,)
)
def process_string_token(self, token, start_row):
diff --git a/tests/functional/b/bad_continuation.py b/tests/functional/b/bad_continuation.py
index 1c73a1122..8468f770b 100644
--- a/tests/functional/b/bad_continuation.py
+++ b/tests/functional/b/bad_continuation.py
@@ -1,5 +1,5 @@
"""Regression test case for bad-continuation."""
-# pylint: disable=print-statement,implicit-str-concat-in-sequence,using-constant-test,missing-docstring,wrong-import-position
+# pylint: disable=print-statement,implicit-str-concat,using-constant-test,missing-docstring,wrong-import-position
# Various alignment for brackets
from __future__ import print_function
diff --git a/tests/functional/i/implicit_str_concat_in_sequence.py b/tests/functional/i/implicit_str_concat.py
index 0050e7f95..9d4a908f5 100644
--- a/tests/functional/i/implicit_str_concat_in_sequence.py
+++ b/tests/functional/i/implicit_str_concat.py
@@ -1,14 +1,14 @@
#pylint: disable=bad-continuation,invalid-name,missing-docstring
# Basic test with a list
-TEST_LIST1 = ['a' 'b'] # [implicit-str-concat-in-sequence]
+TEST_LIST1 = ['a' 'b'] # [implicit-str-concat]
# Testing with unicode strings in a tuple, with a comma AFTER concatenation
-TEST_LIST2 = (u"a" u"b", u"c") # [implicit-str-concat-in-sequence]
+TEST_LIST2 = (u"a" u"b", u"c") # [implicit-str-concat]
# Testing with raw strings in a set, with a comma BEFORE concatenation
-TEST_LIST3 = {r'''a''', r'''b''' r'''c'''} # [implicit-str-concat-in-sequence]
+TEST_LIST3 = {r'''a''', r'''b''' r'''c'''} # [implicit-str-concat]
# Testing that only ONE warning is generated when string concatenation happens
# in the middle of a list
-TEST_LIST4 = ["""a""", """b""" """c""", """d"""] # [implicit-str-concat-in-sequence]
+TEST_LIST4 = ["""a""", """b""" """c""", """d"""] # [implicit-str-concat]
# The following shouldn't raise a warning because it is a function call
print('a', 'bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb' 'ccc')
@@ -23,7 +23,7 @@ TEST_LIST6 = ('bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb \
ccc')
# But we should emit when there is an actual juxtaposition
-# +1: [implicit-str-concat-in-sequence]
+# +1: [implicit-str-concat]
TEST_LIST7 = ('a' 'bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb \
ccc')
diff --git a/tests/functional/i/implicit_str_concat.txt b/tests/functional/i/implicit_str_concat.txt
new file mode 100644
index 000000000..65792a9fc
--- /dev/null
+++ b/tests/functional/i/implicit_str_concat.txt
@@ -0,0 +1,5 @@
+implicit-str-concat:4::Implicit string concatenation found in list
+implicit-str-concat:6::Implicit string concatenation found in tuple
+implicit-str-concat:8::Implicit string concatenation found in set
+implicit-str-concat:11::Implicit string concatenation found in list
+implicit-str-concat:27::Implicit string concatenation found in assignment
diff --git a/tests/functional/i/implicit_str_concat_in_sequence.txt b/tests/functional/i/implicit_str_concat_in_sequence.txt
deleted file mode 100644
index c28c3b46b..000000000
--- a/tests/functional/i/implicit_str_concat_in_sequence.txt
+++ /dev/null
@@ -1,5 +0,0 @@
-implicit-str-concat-in-sequence:4::Implicit string concatenation found in list
-implicit-str-concat-in-sequence:6::Implicit string concatenation found in tuple
-implicit-str-concat-in-sequence:8::Implicit string concatenation found in set
-implicit-str-concat-in-sequence:11::Implicit string concatenation found in list
-implicit-str-concat-in-sequence:27::Implicit string concatenation found in assignment
diff --git a/tests/functional/i/implicit_str_concat_in_sequence_multiline.txt b/tests/functional/i/implicit_str_concat_in_sequence_multiline.txt
deleted file mode 100755
index b37cf624b..000000000
--- a/tests/functional/i/implicit_str_concat_in_sequence_multiline.txt
+++ /dev/null
@@ -1 +0,0 @@
-implicit-str-concat-in-sequence:3::Implicit string concatenation found in tuple \ No newline at end of file
diff --git a/tests/functional/i/implicit_str_concat_in_sequence_latin1.py b/tests/functional/i/implicit_str_concat_latin1.py
index 44a2a94cb..44a2a94cb 100644
--- a/tests/functional/i/implicit_str_concat_in_sequence_latin1.py
+++ b/tests/functional/i/implicit_str_concat_latin1.py
diff --git a/tests/functional/i/implicit_str_concat_in_sequence_latin1.txt b/tests/functional/i/implicit_str_concat_latin1.txt
index e69de29bb..e69de29bb 100644
--- a/tests/functional/i/implicit_str_concat_in_sequence_latin1.txt
+++ b/tests/functional/i/implicit_str_concat_latin1.txt
diff --git a/tests/functional/i/implicit_str_concat_in_sequence_multiline.py b/tests/functional/i/implicit_str_concat_multiline.py
index 0f8d1fcdf..7bc6dfb83 100755
--- a/tests/functional/i/implicit_str_concat_in_sequence_multiline.py
+++ b/tests/functional/i/implicit_str_concat_multiline.py
@@ -1,4 +1,4 @@
#pylint: disable=bad-continuation,missing-docstring
-TEST_TUPLE = ('a', 'b' # [implicit-str-concat-in-sequence]
+TEST_TUPLE = ('a', 'b' # [implicit-str-concat]
'c')
diff --git a/tests/functional/i/implicit_str_concat_in_sequence_multiline.rc b/tests/functional/i/implicit_str_concat_multiline.rc
index e5b344774..e5b344774 100755
--- a/tests/functional/i/implicit_str_concat_in_sequence_multiline.rc
+++ b/tests/functional/i/implicit_str_concat_multiline.rc
diff --git a/tests/functional/i/implicit_str_concat_multiline.txt b/tests/functional/i/implicit_str_concat_multiline.txt
new file mode 100755
index 000000000..62bb09c75
--- /dev/null
+++ b/tests/functional/i/implicit_str_concat_multiline.txt
@@ -0,0 +1 @@
+implicit-str-concat:3::Implicit string concatenation found in tuple
diff --git a/tests/functional/i/implicit_str_concat_in_sequence_utf8.py b/tests/functional/i/implicit_str_concat_utf8.py
index fa996e90c..fa996e90c 100644
--- a/tests/functional/i/implicit_str_concat_in_sequence_utf8.py
+++ b/tests/functional/i/implicit_str_concat_utf8.py
diff --git a/tests/functional/i/implicit_str_concat_in_sequence_utf8.txt b/tests/functional/i/implicit_str_concat_utf8.txt
index e69de29bb..e69de29bb 100644
--- a/tests/functional/i/implicit_str_concat_in_sequence_utf8.txt
+++ b/tests/functional/i/implicit_str_concat_utf8.txt