public boolean allDirtyScopesAreNull(@NotNull Document document) {
    synchronized (myDocumentToStatusMap) {
      PsiFile file = PsiDocumentManager.getInstance(myProject).getPsiFile(document);
      if (!ProblemHighlightFilter.shouldHighlightFile(file)) return true;

      FileStatus status = myDocumentToStatusMap.get(document);
      return status != null
          && !status.defensivelyMarked
          && status.wolfPassFinished
          && status.allDirtyScopesAreNull();
    }
  }
 /**
  * @return null for processed file, whole file for untouched or entirely dirty file, range(usually
  *     code block) for dirty region (optimization)
  */
 @Nullable
 public TextRange getFileDirtyScope(@NotNull Document document, int passId) {
   synchronized (myDocumentToStatusMap) {
     PsiFile file = PsiDocumentManager.getInstance(myProject).getPsiFile(document);
     if (!ProblemHighlightFilter.shouldHighlightFile(file)) return null;
     FileStatus status = myDocumentToStatusMap.get(document);
     if (status == null) {
       return file == null ? null : file.getTextRange();
     }
     if (status.defensivelyMarked) {
       status.markWholeFileDirty(myProject);
       status.defensivelyMarked = false;
     }
     LOG.assertTrue(status.dirtyScopes.containsKey(passId), "Unknown pass " + passId);
     RangeMarker marker = status.dirtyScopes.get(passId);
     return marker == null
         ? null
         : marker.isValid()
             ? TextRange.create(marker)
             : new TextRange(0, document.getTextLength());
   }
 }