void (@NotNull PsiFile file) { super.visitFile(file); final FileType fileType = file.getFileType(); if (!(fileType instanceof LanguageFileType)) { return; } if (file.getViewProvider().getBaseLanguage() != file.getLanguage()) { // don't warn multiple times on files which have multiple views like PHP and JSP return; } final InjectedLanguageManager injectedLanguageManager = InjectedLanguageManager.getInstance(file.getProject()); if (injectedLanguageManager.isInjectedFragment(file)) { return; } final CodeStyleSettings settings = CodeStyle.getSettings(file); final CommonCodeStyleSettings.IndentOptions indentOptions = settings.getIndentOptionsByFile(file); final boolean useTabs = indentOptions.USE_TAB_CHARACTER; final boolean smartTabs = indentOptions.SMART_TABS; final Document document = PsiDocumentManager.getInstance(file.getProject()).getDocument(file); if (document == null) { return; } final int lineCount = document.getLineCount(); int previousLineIndent = 0; for (int i = 0; i < lineCount; i++) { final int startOffset = document.getLineStartOffset(i); final int endOffset = document.getLineEndOffset(i); final String line = document.getText(new TextRange(startOffset, endOffset)); boolean spaceSeen = false; for (int j = 0, length = line.length(); j < length; j++) { final char c = line.charAt(j); if (c == '\t') { if (useTabs) { if (smartTabs && spaceSeen) { if (registerError(file, startOffset, true)) { return; } } } else { if (registerError(file, startOffset, false)) { return; } } } else if (c == ' ') { if (useTabs) { if (!smartTabs) { if (registerError(file, startOffset, true)) { return; } } else if (!spaceSeen) { if (j < previousLineIndent) { if (registerError(file, startOffset, true)) { return; } } previousLineIndent = j; } } spaceSeen = true; } else { if (!spaceSeen) { previousLineIndent = j; } break; } } } }