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

Quality: Sonar S1155 "Collection.isEmpty()" should be used to test for emptiness #1079

Open
jlerbsc opened this issue Jan 16, 2024 · 0 comments

Comments

@jlerbsc
Copy link
Contributor

jlerbsc commented Jan 16, 2024

We noticed that you have 90 violations of the Sonar rule RSPEC-1940 "Boolean checks should not be inverted". When you call isEmpty(), it clearly communicates the code’s intention, which is to check if the collection is empty. Using size() == 0 for this purpose is less direct and makes the code slightly more complex.

With our code remediation solution you can correct these issues quickly and free of charge. You can find links and documentation here https://www.indepth.fr

org\biojava\nbio\core\alignment\SimpleAlignedSequence.java
@@ -411,5  +411,5 @@

	// combine sublocations into 1 Location
\-		if (sublocations.size() == 0) {
\+		if (sublocations.isEmpty()) {
		location = null;
@jlerbsc jlerbsc changed the title Suggestion: Sonar S1155 "Collection.isEmpty()" should be used to test for emptiness Quality: Sonar S1155 "Collection.isEmpty()" should be used to test for emptiness Jan 31, 2024
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

No branches or pull requests

1 participant