refactor: refactor unnecessary else / elif when if block has a continue statement

The use of `else` or `elif` becomes redundant and can be dropped if the last statement under the leading `if` / `elif` block is a `continue` statement.
In the case of an `elif` after `continue`, it can be written as a separate `if` block.
For `else` blocks after `continue`, 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.
This commit is contained in:
deepsource-autofix[bot]
2024-01-14 14:18:37 +00:00
committed by GitHub
parent 784d54c4e2
commit 35453bc49e

View File

@@ -145,7 +145,7 @@ def main(config, debug: bool) -> None:
channel_info["name"] = input("Enter the channel name: ")
channel_whitelist.append(channel_info)
continue
elif choice == "6":
if choice == "6":
continue
channel_info["id"] = results[int(choice)][0]