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

[GCI69] Do not call a function when declaring a for-type loop - False positive #96

Open
MP-Aubay opened this issue Jan 16, 2025 · 0 comments

Comments

@MP-Aubay
Copy link

Describe the bug
I think there is a false positive for the rule GCI69 when using Iterator.

To Reproduce
Steps to reproduce the behavior:

The code that triggered the issue :

for (Iterator<String> iterator = getKeys().iterator(); iterator.hasNext();) {
    //code using iterator.next()
}

Expected behavior
The issue should not be triggered, because it is not possible to externalize the call to hasNext().

Software Versions

  • SonarQube Version: 9.9.3
  • Plugin Version: 1.3.0
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