diff options
author | Julthep Nandakwang <julthep@nandakwang.com> | 2022-07-08 01:36:12 +0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-07-07 20:36:12 +0200 |
commit | 3d1c72164e48b5112a616e4a0505b6af72b01859 (patch) | |
tree | f0fa1b38cc3d7a261aa460b9b6d688d58ad6e642 /doc/data/messages/t | |
parent | c0710af0a54d8bb6f16b115ee41ff353a9c6c2ec (diff) | |
download | pylint-git-3d1c72164e48b5112a616e4a0505b6af72b01859.tar.gz |
Add documentation examples for `too-many-return-statements` (#7070)
Co-authored-by: Vladyslav Krylasov <vladyslav.krylasov@gmail.com>
Co-authored-by: Daniƫl van Noord <13665637+DanielNoord@users.noreply.github.com>
Diffstat (limited to 'doc/data/messages/t')
3 files changed, 29 insertions, 2 deletions
diff --git a/doc/data/messages/t/too-many-return-statements/bad.py b/doc/data/messages/t/too-many-return-statements/bad.py new file mode 100644 index 000000000..e421d29a7 --- /dev/null +++ b/doc/data/messages/t/too-many-return-statements/bad.py @@ -0,0 +1,16 @@ +def to_string(x): # [too-many-return-statements] + # max of 6 by default, can be configured + if x == 1: + return 'This is one.' + if x == 2: + return 'This is two.' + if x == 3: + return 'This is three.' + if x == 4: + return 'This is four.' + if x == 5: + return 'This is five.' + if x == 6: + return 'This is six.' + if x == 7: + return 'This is seven.' diff --git a/doc/data/messages/t/too-many-return-statements/details.rst b/doc/data/messages/t/too-many-return-statements/details.rst deleted file mode 100644 index ab8204529..000000000 --- a/doc/data/messages/t/too-many-return-statements/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/t/too-many-return-statements/good.py b/doc/data/messages/t/too-many-return-statements/good.py index c40beb573..0c4032f53 100644 --- a/doc/data/messages/t/too-many-return-statements/good.py +++ b/doc/data/messages/t/too-many-return-statements/good.py @@ -1 +1,13 @@ -# This is a placeholder for correct code for this message. +NUMBERS_TO_STRINGS = { + 1: 'one', + 2: 'two', + 3: 'three', + 4: 'four', + 5: 'five', + 6: 'six', + 7: 'seven' +} + + +def to_string(x): + return f'This is {NUMBERS_TO_STRINGS.get(x)}.' |