Recipe Name:
Use isNotEqualTo instead of == isFalse
Description:
Use isNotEqualTo instead of == isFalse
Level:
warning
Language:
  • java
Tags:
  • AssertJ
  • framework specific
  • quality
Recipe
id: scw:assertj:idiomatic:isNotEqualTo-operator-false
version: 10
metadata:
  name: Use isNotEqualTo instead of == isFalse
  shortDescription: Use isNotEqualTo instead of == isFalse
  level: warning
  language: java
  enabled: true
  tags: AssertJ;framework specific;quality
search:
  methodcall:
    name: isFalse
    anyOf:
    - "on":
        methodcall:
          args:
            1:
              type: boolean
              value:
                is:
                  comparison:
                    operator: ==
          name: assertThat
          label: assertThatMethodCallDirect
          type: org.assertj.core.api.Assertions
    - "on":
        methodcall:
          name:
            matches: as|describedAs
          "on":
            methodcall:
              args:
                1:
                  type: boolean
                  value:
                    is:
                      comparison:
                        operator: ==
              name: assertThat
              label: assertThatMethodCallIndirect
              type: org.assertj.core.api.Assertions
availableFixes:
- name: Use idiomatic assertion
  actions:
  - modifyArguments:
      rewrite:
        1: '{{{ leftOperand }}}'
      target: label:assertThatMethodCallDirect
  - modifyArguments:
      rewrite:
        1: '{{{ leftOperand }}}'
      target: label:assertThatMethodCallIndirect
  - modifyArguments:
      applyIf:
        label:
          is:
            methodcall: {}
          labelName: assertThatMethodCallDirect
      insert:
        1: '{{{ qualifier.arguments.0.rightOperand }}}'
  - modifyArguments:
      applyIf:
        label:
          is:
            methodcall: {}
          labelName: assertThatMethodCallIndirect
      insert:
        1: '{{{ qualifier.qualifier.arguments.0.rightOperand }}}'
  - changeName:
      name: isNotEqualTo