Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove nnecessary elif / else block after raise andcontinue #73

Merged
merged 7 commits into from
Jun 3, 2022
Merged

Remove nnecessary elif / else block after raise andcontinue #73

merged 7 commits into from
Jun 3, 2022

Conversation

ThibFrgsGmz
Copy link
Contributor

Originating Project/Creator
Affected Component
Affected Architectures(s)
Related Issue(s) (void)
Has Unit Tests (y/n) n
Builds Without Errors (y/n) Let CI run
Unit Tests Pass (y/n) Let CI run
Documentation Included (y/n) n

Change Description

This PR introduces the following changes:

  • Removal of unnecessary else/elif used after raise
  • Removal of an unnecessary elif / else block after continue

Rationale

  • The use of 'else' or 'elif' becomes redundant and can be dropped if the last statement under the main 'if/elif' block is a 'continue' statement. In case of an 'elif' after 'continue', it can be written as a separate 'if' block. For 'else' blocks after 'continue', the statements can be moved out of the 'else' block.

  • The 'raise' statement disrupts the control flow, as it allows to exit the block. It is recommended to check other conditions with another 'if' statement and to get rid of 'else' statements, which are useless.

Testing/Review Recommendations

(void)

Future Work

(void)

ThibFrgsGmz and others added 7 commits May 22, 2022 17:56
As said by @LeStarch, None is also falsey so no need to leave the check here
The 'raise' statement disrupts the control flow, as it allows to exit the block. It is recommended to check other conditions with another 'if' statement and to get rid of 'else' statements, which are useless.
The use of 'else' or 'elif' becomes redundant and can be dropped if the last statement under the main 'if/elif' block is a 'continue' statement. In case of an 'elif' after 'continue', it can be written as a separate 'if' block. For 'else' blocks after 'continue', the statements can be moved out of the 'else' block.
@LeStarch LeStarch closed this May 31, 2022
@LeStarch LeStarch reopened this May 31, 2022
@LeStarch LeStarch merged commit 11fe7e7 into nasa:devel Jun 3, 2022
@ThibFrgsGmz ThibFrgsGmz deleted the feat/rm_useless_else_elif branch July 20, 2022 21:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants