use of com.intellij.codeInspection.ex.InspectionToolWrapper in project intellij-community by JetBrains.
the class PyCompatibilityInspectionAdvertiser method isCompatibilityInspectionEnabled.
private static boolean isCompatibilityInspectionEnabled(@NotNull PsiElement anchor) {
final InspectionProfile profile = InspectionProfileManager.getInstance(anchor.getProject()).getCurrentProfile();
final InspectionToolWrapper tool = profile.getInspectionTool(getCompatibilityInspectionShortName(), anchor.getProject());
return tool != null && profile.isToolEnabled(HighlightDisplayKey.findById(tool.getID()), anchor);
}
use of com.intellij.codeInspection.ex.InspectionToolWrapper in project intellij-community by JetBrains.
the class PyCompatibilityInspectionAdvertiser method enableCompatibilityInspection.
private static void enableCompatibilityInspection(@NotNull Project project) {
final InspectionProfileImpl profile = InspectionProfileManager.getInstance(project).getCurrentProfile();
final InspectionToolWrapper tool = profile.getInspectionTool(getCompatibilityInspectionShortName(), project);
if (tool != null) {
profile.setToolEnabled(tool.getShortName(), true);
EditInspectionToolsSettingsAction.editToolSettings(project, profile, getCompatibilityInspectionShortName());
}
}
use of com.intellij.codeInspection.ex.InspectionToolWrapper in project intellij-community by JetBrains.
the class InspectionTestUtil method compareToolResults.
static void compareToolResults(@NotNull GlobalInspectionContextImpl context, boolean checkRange, @NotNull String testDir, @NotNull Collection<? extends InspectionToolWrapper> toolWrappers) {
final Element root = new Element("problems");
for (InspectionToolWrapper toolWrapper : toolWrappers) {
InspectionToolPresentation presentation = context.getPresentation(toolWrapper);
//e.g. dead code need check for reachables
presentation.updateContent();
presentation.exportResults(root, x -> false, x -> false);
}
try {
File file = new File(testDir + "/expected.xml");
compareWithExpected(JDOMUtil.loadDocument(file), new Document(root), checkRange);
} catch (Exception e) {
throw new RuntimeException(e);
}
}
use of com.intellij.codeInspection.ex.InspectionToolWrapper in project intellij-community by JetBrains.
the class SuppressForTestsScopeFix method addRemoveTestsScope.
private void addRemoveTestsScope(Project project, boolean add) {
final InspectionProfileImpl profile = InspectionProjectProfileManager.getInstance(project).getCurrentProfile();
final String shortName = myInspection.getShortName();
final InspectionToolWrapper tool = profile.getInspectionTool(shortName, project);
if (tool == null) {
return;
}
if (add) {
final NamedScope namedScope = NamedScopesHolder.getScope(project, "Tests");
final HighlightDisplayKey key = HighlightDisplayKey.find(shortName);
final HighlightDisplayLevel level = profile.getErrorLevel(key, namedScope, project);
profile.addScope(tool, namedScope, level, false, project);
} else {
profile.removeScope(shortName, "Tests", project);
}
profile.scopesChanged();
}
use of com.intellij.codeInspection.ex.InspectionToolWrapper in project intellij-community by JetBrains.
the class RedundantSuppressTest method setUp.
@Override
protected void setUp() throws Exception {
super.setUp();
myInspectionToolWrappers = new InspectionToolWrapper[] { new LocalInspectionToolWrapper(new JavaDocReferenceInspection()), new LocalInspectionToolWrapper(new I18nInspection()), new LocalInspectionToolWrapper(new RawUseOfParameterizedTypeInspection()), new GlobalInspectionToolWrapper(new EmptyMethodInspection()), new GlobalInspectionToolWrapper(new UnusedDeclarationInspection()) };
myWrapper = new GlobalInspectionToolWrapper(new RedundantSuppressInspection() {
@NotNull
@Override
protected InspectionToolWrapper[] getInspectionTools(PsiElement psiElement, @NotNull InspectionManager manager) {
return myInspectionToolWrappers;
}
});
}
Aggregations