diff options
author | zenlyj <53538590+zenlyj@users.noreply.github.com> | 2022-12-22 03:00:33 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-12-21 20:00:33 +0100 |
commit | 71baf6a62617ee62aadc7513aae63c829cb8fda5 (patch) | |
tree | 4b010dad1cb17df26ea53e7c625751b964b5897e | |
parent | 42f3cfd8f29e65b520487d44a714937925da94d9 (diff) | |
download | pylint-git-71baf6a62617ee62aadc7513aae63c829cb8fda5.tar.gz |
Add documentation for ternary operation messages (#7970)
Co-authored-by: Pierre Sassoulas <pierre.sassoulas@gmail.com>
7 files changed, 13 insertions, 4 deletions
diff --git a/doc/data/messages/c/consider-ternary-expression/bad.py b/doc/data/messages/c/consider-ternary-expression/bad.py new file mode 100644 index 000000000..741784481 --- /dev/null +++ b/doc/data/messages/c/consider-ternary-expression/bad.py @@ -0,0 +1,5 @@ +x, y = input(), input()
+if x >= y: # [consider-ternary-expression]
+ maximum = x
+else:
+ maximum = y
diff --git a/doc/data/messages/c/consider-ternary-expression/details.rst b/doc/data/messages/c/consider-ternary-expression/details.rst deleted file mode 100644 index ab8204529..000000000 --- a/doc/data/messages/c/consider-ternary-expression/details.rst +++ /dev/null @@ -1 +0,0 @@ -You can help us make the doc better `by contributing <https://github.com/PyCQA/pylint/issues/5953>`_ ! diff --git a/doc/data/messages/c/consider-ternary-expression/good.py b/doc/data/messages/c/consider-ternary-expression/good.py index c40beb573..117324054 100644 --- a/doc/data/messages/c/consider-ternary-expression/good.py +++ b/doc/data/messages/c/consider-ternary-expression/good.py @@ -1 +1,2 @@ -# This is a placeholder for correct code for this message. +x, y = input(), input() +maximum = x if x >= y else y diff --git a/doc/data/messages/c/consider-ternary-expression/pylintrc b/doc/data/messages/c/consider-ternary-expression/pylintrc new file mode 100644 index 000000000..814b5ece4 --- /dev/null +++ b/doc/data/messages/c/consider-ternary-expression/pylintrc @@ -0,0 +1,2 @@ +[MAIN]
+load-plugins=pylint.extensions.consider_ternary_expression
diff --git a/doc/data/messages/c/consider-using-ternary/bad.py b/doc/data/messages/c/consider-using-ternary/bad.py new file mode 100644 index 000000000..39a790f86 --- /dev/null +++ b/doc/data/messages/c/consider-using-ternary/bad.py @@ -0,0 +1,2 @@ +x, y = 1, 2
+maximum = x >= y and x or y # [consider-using-ternary]
diff --git a/doc/data/messages/c/consider-using-ternary/details.rst b/doc/data/messages/c/consider-using-ternary/details.rst deleted file mode 100644 index ab8204529..000000000 --- a/doc/data/messages/c/consider-using-ternary/details.rst +++ /dev/null @@ -1 +0,0 @@ -You can help us make the doc better `by contributing <https://github.com/PyCQA/pylint/issues/5953>`_ ! diff --git a/doc/data/messages/c/consider-using-ternary/good.py b/doc/data/messages/c/consider-using-ternary/good.py index c40beb573..bcb8446bc 100644 --- a/doc/data/messages/c/consider-using-ternary/good.py +++ b/doc/data/messages/c/consider-using-ternary/good.py @@ -1 +1,2 @@ -# This is a placeholder for correct code for this message. +x, y = 1, 2 +maximum = x if x >= y else y |