summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Byrne <31762852+mbyrnepr2@users.noreply.github.com>2022-05-17 11:08:00 +0200
committerGitHub <noreply@github.com>2022-05-17 11:08:00 +0200
commit4405e13488c130c842db9006261e71cf2f578c8a (patch)
treea2d8838c5b1619e707cda0434eea2150ca12c23f
parent5ab99efdd62751d58b82287e8a05b44532441d8e (diff)
downloadpylint-git-4405e13488c130c842db9006261e71cf2f578c8a.tar.gz
Add documentation examples for `consider-using-get`. (#6630)
Co-authored-by: Pierre Sassoulas <pierre.sassoulas@gmail.com> Co-authored-by: Matus Valo <matusvalo@users.noreply.github.com>
-rw-r--r--doc/data/messages/c/consider-using-get/bad.py6
-rw-r--r--doc/data/messages/c/consider-using-get/good.py3
2 files changed, 9 insertions, 0 deletions
diff --git a/doc/data/messages/c/consider-using-get/bad.py b/doc/data/messages/c/consider-using-get/bad.py
new file mode 100644
index 000000000..b820c5698
--- /dev/null
+++ b/doc/data/messages/c/consider-using-get/bad.py
@@ -0,0 +1,6 @@
+knights = {"Gallahad": "the pure", "Robin": "the brave"}
+
+if "Gallahad" in knights: # [consider-using-get]
+ DESCRIPTION = knights["Gallahad"]
+else:
+ DESCRIPTION = ""
diff --git a/doc/data/messages/c/consider-using-get/good.py b/doc/data/messages/c/consider-using-get/good.py
new file mode 100644
index 000000000..eba9976af
--- /dev/null
+++ b/doc/data/messages/c/consider-using-get/good.py
@@ -0,0 +1,3 @@
+knights = {"Gallahad": "the pure", "Robin": "the brave"}
+
+description = knights.get("Gallahad", "")