pylint-dev/pylint

False positive for `implicit-str-concat` when some but not all strings are raw

Closed

#6,663 opened on May 22, 2022

 (9 comments) (0 reactions) (0 assignees)Python (1,059 forks)batch import
False Positive 🦟Good first issueMinor 💅

Repository metrics

Stars
 (4,978 stars)
PR merge metrics
 (Avg merge 12h 9m) (29 merged PRs in 30d)

Description

Bug description

I don't think implicit-str-concat is a useful warning when the reason for breaking and restarting the string is to start or stop treating a portion of a string as a raw string. (As I understand it, we're trying to catch someone forgetting a comma between arguments.)

For instance, this string needs to escape \o but not \n:

import unittest

class MyTest(unittest.TestCase):
    def testColors(self):
        self.assertEqual(
            self.string_output(),
            r'\override Stem.color = "darkgreen"' '\n'
        )

Configuration

No response

Command used

pylint a.py

Pylint output

************* Module a
a.py:7: [W1404(implicit-str-concat), ] Implicit string concatenation found in call

---------------------------------------------------------------------
Your code has been rated at 7.50/10 (previous run: -40.00/10, +47.50)

Expected behavior

no msg

Pylint version

pylint 2.14.0-b1
astroid 2.12.0-dev0
Python 3.10.1 (v3.10.1:2cd268a3a9, Dec  6 2021, 14:28:59) [Clang 13.0.0 (clang-1300.0.29.3)]

OS / Environment

No response

Additional dependencies

No response

Contributor guide