Skip to content

Commit 34c6aed

Browse files
authored
Add compare-to-empty-string example (#6861)
1 parent 72e2e2a commit 34c6aed

File tree

4 files changed

+18
-2
lines changed

4 files changed

+18
-2
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
x = ""
2+
y = "hello"
3+
4+
if x == "": # [compare-to-empty-string]
5+
print("x is an empty string")
6+
7+
if y != "": # [compare-to-empty-string]
8+
print("y is not an empty string")

doc/data/messages/c/compare-to-empty-string/details.rst

-1
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -1 +1,8 @@
1-
# This is a placeholder for correct code for this message.
1+
x = ""
2+
y = "hello"
3+
4+
if not x:
5+
print("x is an empty string")
6+
7+
if y:
8+
print("y is not an empty string")
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[main]
2+
load-plugins=pylint.extensions.emptystring

0 commit comments

Comments
 (0)