Uploaded image for project: 'SonarQube'
  1. SonarQube
  2. SONAR-15238

Improve Kotlin analysis: prevent developers from doing mistakes with “coroutines”

    XMLWordPrintable

    Details

    • Type: New Feature
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 9.1
    • Component/s: None
    • Edition:
      Community
    • Production Notes:
      None

      Description

      We enhanced our Kotlin analyzer by adding 12 rules to help you avoid mistakes when using the coroutines library.

      The coroutines library for Kotlin is the most used libraries according to 2020 JetBrains survey. As we want to help a maximum of developers, providing rules dedicated to coroutines was a natural choice.

      Here are all the rules dedicated to coroutines:

      • S6314: Flow intermediate operation results should not be left unused
      • S6306: Coroutine usage should adhere to structured concurrency principles
      • S6307 1: Suspending functions should be main-safe
      • S6310: Dispatchers should be injectable
      • S6311: Suspending functions should not be called on a different dispatcher
      • S6313: ViewModel classes should create coroutines
      • S6315 1: The return value of functions returning “Deferred” should be used
      • S6316: Kotlin coroutines api for timeouts should be used
      • S6312: Extension functions on CoroutineScopes should not be declared as “suspend”
      • S6309: Functions returning Flow/Channel should not be suspending
      • S6305: “MutableStateFlow” and “MutableSharedFlow” should not be exposed
      • S6318: “suspend” modifier should not be redundant

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              belen.pruvost Belén Pruvost
              Reporter:
              sonarqube.tech SonarQube Technical user
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: