C++20 coroutines and false positives removal

Hello C and C++ folks.

We are happy to come to you with some cutting-edge new rules and improvements.

We added a set of new rules focusing on C++20 coroutines:
S6184: Coroutines should not have too many lines of code
S6192: Cyclomatic Complexity of coroutines should not be too high
S6193: Coroutine names should comply with a naming convention
S6194: Cognitive Complexity of coroutines should not be too high
S6365: Use symmetric transfer to switch execution between coroutines
S6366: Use conditional suspension to resume current coroutine
S6367: Thread local variables should not be used in coroutines
S6369: Coroutine should have co_return on each execution path or provide return_void
S6372: “await_suspend” should accept type-erased “coroutine_handle” when it uses it in a generic way
S6391: Coroutines should not take const references as parameters

We also groomed a few preexisting rules to make them even less noisy and more accurate. All the details are available in the release notes.

All this is already available on SonarCloud.io and will be available with SonarQube 9.3 starting from Developer Edition and in SonarLint soon.


1 Like