void (final int tokenStart, String indent) { int lastLF = indent.lastIndexOf('\n'); String lastLineIndent = indent.substring(lastLF+1); int spaces = 0; int tabs = 0; final int length = lastLineIndent.length(); for (int i = 0; i < length; i++) { final char c = lastLineIndent.charAt(i); if (c == ' ') spaces++; else if (c == '\t') tabs++; } final int problemStart = tokenStart + lastLF + 1; if (spaces > 0 && tabs > 0) { reportProblem(PyPsiBundle.message("INSP.inconsistent.indentation.mix.tabs.spaces"), problemStart, length); // don't know which one is correct => don't complain about inconsistent indentation on subsequent lines which use // either tabs or spaces myLastSpaces = 0; myLastTabs = 0; } else { if (spaces > 0 && myLastTabs > 0) { reportProblem(PyPsiBundle.message("INSP.inconsistent.indentation.previous.line.used.tabs.this.line.uses.spaces"), problemStart, length); } else if (tabs > 0 && myLastSpaces > 0) { reportProblem(PyPsiBundle.message("INSP.inconsistent.indentation.previous.line.used.spaces.this.line.uses.tabs"), problemStart, length); } if (spaces > 0 || tabs > 0) { myLastTabs = tabs; myLastSpaces = spaces; } } }