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

False positive: Unread local variable used in Java assert #17531

Open
simonhir opened this issue Sep 20, 2024 · 1 comment
Open

False positive: Unread local variable used in Java assert #17531

simonhir opened this issue Sep 20, 2024 · 1 comment

Comments

@simonhir
Copy link

Description of the false positive

Variables that are only used in junit assert statements like assertEquals are marked as Unread local variable.

Code samples or links to source code

I.e. https://github.com/it-at-m/refarch/blob/e18859331d0f55b43aae3170f947b840df1fde9c/refarch-integrations/refarch-dms-integration/refarch-dms-integration-core/src/test/java/de/muenchen/refarch/integration/dms/adapter/out/fabasoft/FabasoftAdapterTest.java#L84-L86
where procedureResponse is marked as Unread local variable. This makes also no difference if Lombok val is used or the direct type.

Above code extracted for reference:

val procedureResponse = fabasoftAdapter.createFile(file, "user");
assertEquals(procedureResponse, "1234567890");

URL to the alert on GitHub code scanning (optional)

https://github.com/it-at-m/refarch/security/code-scanning/36
https://github.com/it-at-m/refarch/security/code-scanning/55 (same line but with direct type String)

@simonhir
Copy link
Author

Could be a duplicate of #11989 but not really sure.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant