Reports a method with three or more negation operators ! or !=.

Such methods may be confusing.

Example:


  void doSmth(int a, int b, boolean flag1, boolean flag2) {
    if (!flag && !flag2) {
      if (a != b) {
        doOther();
      }
    }
  }

Without negations, the method becomes easier to understand:


  void doSmth(int a, int b, boolean flag1, boolean flag2) {
    if (flag1 || flag2 || a == b) return;
    doOther();
  }

Configure the inspection: