import java.io.File;
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.regex.Matcher;
private final String myCode;
private final String myDescription;
- public Problem(int line, int column, String code, String description) {
+ public Problem(int line, int column, @NotNull String code, @NotNull String description) {
myLine = line;
myColumn = column;
myCode = code;
myDescription = description;
}
+
+ public int getLine() {
+ return myLine;
+ }
+
+ public int getColumn() {
+ return myColumn;
+ }
+
+ @NotNull
+ public String getCode() {
+ return myCode;
+ }
+
+ @NotNull
+ public String getDescription() {
+ return myDescription;
+ }
}
public static class State {
problemElement = file.findElementAt(Math.max(0, offset - 1));
}
- if (ignoreDueToSettings(project, problem, problemElement)) {
+ if (ignoreDueToSettings(project, problem, problemElement) || ignoredDueToProblemSuppressors(project, problem, file, problemElement)) {
continue;
}
}
}
+ private static boolean ignoredDueToProblemSuppressors(@NotNull Project project,
+ @NotNull Problem problem,
+ @NotNull PsiFile file,
+ @Nullable PsiElement element) {
+ final Pep8ProblemSuppressor[] suppressors = Pep8ProblemSuppressor.EP_NAME.getExtensions();
+ return Arrays.stream(suppressors).anyMatch(p -> p.isProblemSuppressed(problem, file, element));
+ }
+
private static boolean crossesLineBoundary(@Nullable Document document, String text, TextRange problemRange) {
int start = problemRange.getStartOffset();
int end = problemRange.getEndOffset();