Make sure to read this post before raising a thread here:
Then tell us:
- What language is this for? Python
- Which rule? Remove this unexpected named argument ‘loop_factory’.sonarlint(python:S930)
- Why do you believe it’s a false-positive/false-negative? Python 3.12 asyncio.run() has a named argument
loop_factory
- Are you using
- SonarCloud? Yes (no idea what version, but we see the error today, yesterday and as far back as several weeks ago if memory serves)
- SonarLint - which IDE/version? Yes
- How can we reproduce the problem? Give us a self-contained snippet of code (formatted text, no screenshots)
import asyncio
async def foo():
pass
asyncio.run(foo(), loop_factory=None)
this gives no false positive outside of my project, but does give the false positive inside the project. sonarlint complains about foo() needing a comment explaining the pass both inside and outside the project.
The only sonarqube related project configuration I can think of is sonarproject.properties which I can’t fully share but contains this line:
sonar.python.version=3.12
(and later we tried upping it to 3.13 just in case, same problem)
which suggests to me that it should use python 3.12 to determine what named arguments are used by functions in the stdlib. I wouldn’t be surprised if something is wrong with our configuration but we’re stuck as to what that might be.
EDIT: simplified the reproduction code, I complicated it further before I realised that I only got the false positive inside of our project.