forked from pylint-dev/pylint
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add
redundant-u-string-prefix
checker
This adds a checker for u-prefixes for strings, as used in Python 2. Closes pylint-dev#4102
- Loading branch information
1 parent
7d84a32
commit 64729a2
Showing
5 changed files
with
54 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
""""Checks for redundant u-prefixes for strings""" | ||
# pylint: disable=missing-function-docstring | ||
|
||
def print_good(): | ||
print("String") | ||
print(f"String{1 + 1}") | ||
|
||
|
||
def print_bad(): | ||
print(u"String") # [redundant-u-string-prefix] | ||
print(u'String') # [redundant-u-string-prefix] | ||
print([u"String", u"String2"]) # [redundant-u-string-prefix, redundant-u-string-prefix] | ||
print((u"String", u"String2")) # [redundant-u-string-prefix, redundant-u-string-prefix] | ||
print({1: u"String"}) # [redundant-u-string-prefix] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
redundant-u-string-prefix:10:10::The u prefix for strings is no longer necessary in Python >=3.0:HIGH | ||
redundant-u-string-prefix:11:10::The u prefix for strings is no longer necessary in Python >=3.0:HIGH | ||
redundant-u-string-prefix:12:11::The u prefix for strings is no longer necessary in Python >=3.0:HIGH | ||
redundant-u-string-prefix:12:22::The u prefix for strings is no longer necessary in Python >=3.0:HIGH | ||
redundant-u-string-prefix:13:11::The u prefix for strings is no longer necessary in Python >=3.0:HIGH | ||
redundant-u-string-prefix:13:22::The u prefix for strings is no longer necessary in Python >=3.0:HIGH | ||
redundant-u-string-prefix:14:14::The u prefix for strings is no longer necessary in Python >=3.0:HIGH |