-
Notifications
You must be signed in to change notification settings - Fork 80
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
Change: move assignments out of if
conditions (openvasd)
#890
Conversation
Dependency Review✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.Snapshot WarningsEnsure that dependencies are being submitted on PR branches and consider enabling retry-on-snapshot-warnings. See the documentation for more information and troubleshooting advice. OpenSSF Scorecard
Scanned Files |
🔍 Vulnerabilities of
|
digest | sha256:a7da860466cd3fb84f97e052d322143a7b457a4b724b9efb9a9f961535fa5bb0 |
vulnerabilities | |
size | 70 MB |
packages | 204 |
📦 Base Image debian:testing-20250203-slim
also known as |
|
digest | sha256:7b210de05a39d3a5c4534343349eb918a99af2ac570953ae2505b6116f6403a0 |
vulnerabilities |
Description
Description
Description
Description
Description
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Description
Description
Description
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Description
Description
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Description
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Description
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Description
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Description
Description
Description
Description
Description
Description
Description
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Description
Description
Description
Description
Description
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Description
Description
Description
Description
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Description
Description
Description
Description
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Description
Description
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Description
Description
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Description
Description
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Description
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Description
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Description
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Description
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
What
Move assignment statements out of
if
conditions where possible. Sobecomes
I'm starting with
openvasd/
because we've been working there recently.Why
Putting the
=
in the condition is error prone because it's easy to read the=
as==
.Having the
=
in the condition is also harder to read because an extra pair of parens is required around the=
statement.This change also makes some duplicate variable inits obvious. Eg in
ret
is being assigned OK just to be assigned again on the next line.So I've removed these inits where the duplicate init happens soon after. I understand people are trying to be careful but I think these redundant inits should all be removed. They add extra code and they make it look like the first init is actually required. If your function is so big that people might use the var before it is initialized, then you should split it into smaller functions.