Reports any instance of for, while and do statements whose bodies are guaranteed to execute at most once. Normally, this is an indication of a bug.

Use the checkbox below to ignore foreach loops. These are sometimes used to perform an action only on the first item of an iterable in a compact way. For example:


  for (String s : stringIterable) {
    doSomethingOnFirstString(s);
    break;
  }