From 842c991b2040b212beb75fccfd769b8f5043d431 Mon Sep 17 00:00:00 2001 From: Mark Byrne Date: Wed, 25 May 2022 19:29:05 +0200 Subject: [PATCH] Added documentation examples for `consider-using-set-comprehension`. --- doc/data/messages/c/consider-using-set-comprehension/bad.py | 3 +++ doc/data/messages/c/consider-using-set-comprehension/good.py | 3 +++ 2 files changed, 6 insertions(+) create mode 100644 doc/data/messages/c/consider-using-set-comprehension/bad.py create mode 100644 doc/data/messages/c/consider-using-set-comprehension/good.py diff --git a/doc/data/messages/c/consider-using-set-comprehension/bad.py b/doc/data/messages/c/consider-using-set-comprehension/bad.py new file mode 100644 index 0000000000..657a211627 --- /dev/null +++ b/doc/data/messages/c/consider-using-set-comprehension/bad.py @@ -0,0 +1,3 @@ +NUMBERS = [1, 2, 2, 3, 4, 4] + +UNIQUE_EVEN_NUMBERS = set([number for number in NUMBERS if number % 2 == 0]) # [consider-using-set-comprehension] diff --git a/doc/data/messages/c/consider-using-set-comprehension/good.py b/doc/data/messages/c/consider-using-set-comprehension/good.py new file mode 100644 index 0000000000..4914fc2b00 --- /dev/null +++ b/doc/data/messages/c/consider-using-set-comprehension/good.py @@ -0,0 +1,3 @@ +NUMBERS = [1, 2, 2, 3, 4, 4] + +UNIQUE_EVEN_NUMBERS = {number for number in NUMBERS if number % 2 == 0}