mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IG: warn on the problematic whitespace, not the next statement (IDEA-246303)
GitOrigin-RevId: ebbae6d5e40b852c2312b415fa45261ea5023fa1
This commit is contained in:
committed by
intellij-monorepo-bot
parent
757f12945f
commit
898800322f
+1
-1
@@ -1572,7 +1572,7 @@ explicit.array.to.string.problem.descriptor=Call to '#ref()' on array #loc
|
||||
implicit.array.to.string.method.call.problem.descriptor=Implicit call to 'toString()' on array returned by call to <code>#ref</code> #loc
|
||||
implicit.array.to.string.display.name=Call to 'toString()' on array
|
||||
implicit.array.to.string.quickfix=Wrap with ''{0}'' expression
|
||||
suspicious.indent.after.control.statement.problem.descriptor=<code>#ref</code> statement has suspicious indentation #loc
|
||||
suspicious.indent.after.control.statement.problem.descriptor=Suspicious indentation after ''{0}'' statement #loc
|
||||
suspicious.indent.after.control.statement.display.name=Suspicious indentation after control statement without braces
|
||||
unpredictable.big.decimal.constructor.call.display.name=Unpredictable BigDecimal constructor call
|
||||
unpredictable.big.decimal.constructor.call.problem.descriptor=Unpredictable <code>new #ref()</code> call #loc
|
||||
|
||||
+7
-5
@@ -18,7 +18,9 @@ public class SuspiciousIndentAfterControlStatementInspection extends BaseInspect
|
||||
@Override
|
||||
@NotNull
|
||||
protected String buildErrorString(Object... infos) {
|
||||
return InspectionGadgetsBundle.message("suspicious.indent.after.control.statement.problem.descriptor");
|
||||
final PsiStatement statement = (PsiStatement)infos[0];
|
||||
final PsiElement token = statement.getFirstChild();
|
||||
return InspectionGadgetsBundle.message("suspicious.indent.after.control.statement.problem.descriptor", token.getText());
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -97,7 +99,7 @@ public class SuspiciousIndentAfterControlStatementInspection extends BaseInspect
|
||||
final int statementIndent = getIndent(siblingText.substring(statementLineBreak + 1));
|
||||
final int bodyIndent = getIndent(text.substring(bodyLineBreak + 1));
|
||||
if (statementIndent == bodyIndent) {
|
||||
registerStatementError(body);
|
||||
registerErrorAtOffset(bodyWhiteSpace, bodyLineBreak + 1, bodyIndent, statement);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -125,12 +127,12 @@ public class SuspiciousIndentAfterControlStatementInspection extends BaseInspect
|
||||
final int bodyIndent = getIndent(text.substring(bodyLineBreak + 1));
|
||||
final int nextIndent = getIndent(nextText.substring(nextLineBreak + 1));
|
||||
if (lineBreakBeforeBody) {
|
||||
if (nextIndent == bodyIndent) {
|
||||
registerStatementError(nextStatement);
|
||||
if (nextIndent >= bodyIndent) {
|
||||
registerErrorAtOffset(nextWhiteSpace, nextLineBreak + 1, nextIndent, statement);
|
||||
}
|
||||
}
|
||||
else if (nextIndent > bodyIndent) {
|
||||
registerStatementError(nextStatement);
|
||||
registerErrorAtOffset(nextWhiteSpace, nextLineBreak + 1, nextIndent, statement);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+11
-5
@@ -9,7 +9,7 @@ public class SuspiciousIndentAfterControlStatement {
|
||||
case 1:
|
||||
if (j / 8 == 0)
|
||||
return "x";
|
||||
<warning descr="'case' statement has suspicious indentation">case</warning> 0:
|
||||
<warning descr="Suspicious indentation after 'if' statement"> </warning>case 0:
|
||||
if (j % 2 == 0)
|
||||
return "even";
|
||||
else
|
||||
@@ -23,9 +23,9 @@ public class SuspiciousIndentAfterControlStatement {
|
||||
void indent(int i) {
|
||||
if (i ==9)
|
||||
System.out.println("foo");
|
||||
<warning descr="'System.out.println(\"bar\")' statement has suspicious indentation">System.out.println("bar")</warning>;
|
||||
<warning descr="Suspicious indentation after 'if' statement"> </warning>System.out.println("bar");
|
||||
if (i == 10);
|
||||
<warning descr="'System.out.println(\"great\")' statement has suspicious indentation">System.out.println("great")</warning>;
|
||||
<warning descr="Suspicious indentation after 'if' statement"> </warning>System.out.println("great");
|
||||
|
||||
}
|
||||
|
||||
@@ -40,7 +40,7 @@ public class SuspiciousIndentAfterControlStatement {
|
||||
void m() {
|
||||
if (true)
|
||||
System.out.println();
|
||||
<warning descr="'class' statement has suspicious indentation">class</warning><error descr="Identifier expected"> </error> ;
|
||||
<warning descr="Suspicious indentation after 'if' statement"> </warning>class<error descr="Identifier expected"> </error> ;
|
||||
}
|
||||
|
||||
class Lol {
|
||||
@@ -88,7 +88,13 @@ public class SuspiciousIndentAfterControlStatement {
|
||||
|
||||
public void x(int i) {
|
||||
if (i == 3)
|
||||
<warning descr="'System.out.println(\"-->\")' statement has suspicious indentation">System.out.println("-->")</warning>;
|
||||
<warning descr="Suspicious indentation after 'if' statement"> </warning>System.out.println("-->");
|
||||
System.out.println(i);
|
||||
}
|
||||
|
||||
public void y(int i) {
|
||||
if (i == 42)
|
||||
System.out.println("answer");
|
||||
<warning descr="Suspicious indentation after 'if' statement"> </warning>System.out.println("question");
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user