InvenTree/InvenTree/common
Matthias Mair eb79bd1743
refactor: refactor unnecessary `else` / `elif` when `if` block has a `return` statement (#5735)
The use of `else` or `elif` becomes redundant and can be dropped if the last statement under the leading `if` / `elif` block is a `return` statement.
In the case of an `elif` after `return`, it can be written as a separate `if` block.
For `else` blocks after `return`, the statements can be shifted out of `else`. Please refer to the examples below for reference.

Refactoring the code this way can improve code-readability and make it easier to maintain.

Co-authored-by: deepsource-autofix[bot] <62050782+deepsource-autofix[bot]@users.noreply.github.com>
2023-10-18 09:06:54 +11:00
..
fixtures fix endline 2022-05-20 13:35:07 +02:00
migrations increased settings value from 200 to 2000 (#5403) 2023-08-06 21:47:14 +10:00
__init__.py startapp common 2019-09-03 08:30:14 +10:00
admin.py refactor: refactor unnecessary `else` / `elif` when `if` block has a `return` statement (#5735) 2023-10-18 09:06:54 +11:00
api.py refactor: refactor unnecessary `else` / `elif` when `if` block has a `return` statement (#5735) 2023-10-18 09:06:54 +11:00
apps.py Prevent write of SERVER_RESTART_REQUIRED setting when importing dataset (#3249) 2022-06-24 20:42:55 +10:00
files.py Fix common spelling mistakes (#4956) 2023-06-04 00:04:52 +10:00
forms.py Fix common spelling mistakes (#4956) 2023-06-04 00:04:52 +10:00
models.py refactor: refactor unnecessary `else` / `elif` when `if` block has a `return` statement (#5735) 2023-10-18 09:06:54 +11:00
notifications.py refactor: remove blank lines after docstring (#5736) 2023-10-18 07:28:57 +11:00
serializers.py refactor: remove blank lines after docstring (#5736) 2023-10-18 07:28:57 +11:00
settings.py refactor: remove blank lines after docstring (#5736) 2023-10-18 07:28:57 +11:00
tasks.py Add flake8-logging linting (#5620) 2023-09-28 14:53:22 +10:00
test_notifications.py Fix common spelling mistakes (#4956) 2023-06-04 00:04:52 +10:00
test_tasks.py Docstring checks in QC checks (#3089) 2022-06-02 01:37:39 +10:00
test_views.py Docstring checks in QC checks (#3089) 2022-06-02 01:37:39 +10:00
tests.py refactor: remove blank lines after docstring (#5736) 2023-10-18 07:28:57 +11:00
urls.py Docstring checks in QC checks (#3089) 2022-06-02 01:37:39 +10:00
views.py refactor: refactor unnecessary `else` / `elif` when `if` block has a `return` statement (#5735) 2023-10-18 09:06:54 +11:00