diff options
author | Dani Alcala <112832187+clavedeluna@users.noreply.github.com> | 2022-10-07 14:46:20 -0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-10-07 19:46:20 +0200 |
commit | 0d62f67d86c482bd3703e0a75b0f4eb1c8b0e0ee (patch) | |
tree | ad67cda87da77d8e42693529ae4da2bff31efde9 | |
parent | 0e26e30d948e0b0c361654a1f3ec39ab5c391028 (diff) | |
download | pylint-git-0d62f67d86c482bd3703e0a75b0f4eb1c8b0e0ee.tar.gz |
Add docs for consider-using-assignment-expr and confusing-with-statement (#7573)
Co-authored-by: Pierre Sassoulas <pierre.sassoulas@gmail.com>
Co-authored-by: Vladyslav Krylasov <vladyslav.krylasov@gmail.com>
7 files changed, 14 insertions, 4 deletions
diff --git a/doc/data/messages/c/confusing-with-statement/bad.py b/doc/data/messages/c/confusing-with-statement/bad.py new file mode 100644 index 000000000..d84288058 --- /dev/null +++ b/doc/data/messages/c/confusing-with-statement/bad.py @@ -0,0 +1,2 @@ +with open('file.txt', 'w') as fh1, fh2: # [confusing-with-statement] + pass diff --git a/doc/data/messages/c/confusing-with-statement/details.rst b/doc/data/messages/c/confusing-with-statement/details.rst deleted file mode 100644 index ab8204529..000000000 --- a/doc/data/messages/c/confusing-with-statement/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/confusing-with-statement/good.py b/doc/data/messages/c/confusing-with-statement/good.py index c40beb573..e8b39d500 100644 --- a/doc/data/messages/c/confusing-with-statement/good.py +++ b/doc/data/messages/c/confusing-with-statement/good.py @@ -1 +1,3 @@ -# This is a placeholder for correct code for this message. +with open('file.txt', 'w', encoding="utf8") as fh1: + with open('file.txt', 'w', encoding="utf8") as fh2: + pass diff --git a/doc/data/messages/c/consider-using-assignment-expr/bad.py b/doc/data/messages/c/consider-using-assignment-expr/bad.py new file mode 100644 index 000000000..a700537fa --- /dev/null +++ b/doc/data/messages/c/consider-using-assignment-expr/bad.py @@ -0,0 +1,4 @@ +apples = 2 + +if apples: # [consider-using-assignment-expr] + print("God apples!") diff --git a/doc/data/messages/c/consider-using-assignment-expr/details.rst b/doc/data/messages/c/consider-using-assignment-expr/details.rst deleted file mode 100644 index ab8204529..000000000 --- a/doc/data/messages/c/consider-using-assignment-expr/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-assignment-expr/good.py b/doc/data/messages/c/consider-using-assignment-expr/good.py index c40beb573..a1e402701 100644 --- a/doc/data/messages/c/consider-using-assignment-expr/good.py +++ b/doc/data/messages/c/consider-using-assignment-expr/good.py @@ -1 +1,2 @@ -# This is a placeholder for correct code for this message. +if apples := 2: + print("God apples!") diff --git a/doc/data/messages/c/consider-using-assignment-expr/pylintrc b/doc/data/messages/c/consider-using-assignment-expr/pylintrc new file mode 100644 index 000000000..14b316d48 --- /dev/null +++ b/doc/data/messages/c/consider-using-assignment-expr/pylintrc @@ -0,0 +1,3 @@ +[MAIN] +py-version=3.8 +load-plugins=pylint.extensions.code_style |