8000 Add `no-else-return`, `no-else-raise` & `logging-not-lazy` check by Ruchip16 · Pull Request #3884 · ansible/molecule · GitHub
[go: up one dir, main page]

Skip to content

Add no-else-return, no-else-raise & logging-not-lazy check - #3884

Merged
ssbarnea merged 1 commit into
mainfrom
fix
Apr 21, 2023
Merged

ssbarnea merged 1 commit into
mainfrom
fix

Conversation

@Ruchip16
Copy link
Copy Markdown
Contributor

The no-else-raise check ensures that there is no unnecessary else statement in the code block following a raise statement. As the raise statement causes an exception to be thrown, any code following the raise statement will not be executed, which makes the else block redundant and hence this check ensures that there is no else block after a raise statement. It helps to make our code readable amd modular.

The no-else-return is a linting error that usually appears when you have an else statement immediately following a return statement in a function. The check suggests that you should remove the "else" statement and de-indent the code inside it. This ensures that the code inside the "else" block is not executed unnecessarily and will also make the code more concise and easier to read.

The logging-not-lazy check ensures that using lazy % formatting, you can avoid the "logging-not-lazy" error and ensure that the logging messages are formatted correctly according to the logging conventions in Python.

@Ruchip16 Ruchip16 added the bug label Apr 21, 2023
@Ruchip16 Ruchip16 self-assigned this Apr 21, 2023
@Ruchip16
Ruchip16 requested review from a team as code owners April 21, 2023 08:58
@Ruchip16
Ruchip16 requested review from cidrblock, greg-hellings, jseguillon, priyamsahoo, ssbarnea and trishnaguha and removed request for a team April 21, 2023 08:58
@ssbarnea
ssbarnea merged commit 06d3fff into main Apr 21, 2023
@ssbarnea
ssbarnea deleted the fix branch April 21, 2023 09:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

0