pylint-dev/pylint

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

已關閉

#6,663 建立於 2022年5月22日

 (9 則留言) (0 個反應) (0 位負責人)Python (1,059 個分叉)batch import
False Positive 🦟Good first issueMinor 💅

倉庫指標

星標
 (4,978 顆星)
PR 合併指標
 (PR 指標待抓取)

描述

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

貢獻者指南