Clarification kotlin:S1125 Android Studio

Please provide

  • Operating system: Windows 10
  • SonarLint plugin version:
  • Is connected mode used: No
    • Connected to SonarCloud or SonarQube (and which version):

And a thorough description of the problem / question:

We created an extension function for checking the new notification permission for Android 13

fun hasNotificationPermission(context: Context): Boolean {
        ContextCompat.checkSelfPermission(context, POST_NOTIFICATION) ==
        true // Android 12 and below has no runtime permission thus return true

The SonarLint warn us with S1125 Redundant Boolean literals should be removed from expressions to improve readability.. But looking at the code I don’t think there is a redundant happening here?

The code will only check if permission is granted or not when it is running on Android 13, else it will always return true for Android 12 and below. Is this a false positive?