use of com.intellij.codeInspection.ex.InspectionToolWrapper in project intellij-community by JetBrains.
the class RunInspectionAction method copyToolWithSettings.
private static InspectionToolWrapper copyToolWithSettings(@NotNull final InspectionToolWrapper tool) {
final Element options = new Element("copy");
tool.getTool().writeSettings(options);
final InspectionToolWrapper copiedTool = tool.createCopy();
try {
copiedTool.getTool().readSettings(options);
} catch (InvalidDataException e) {
throw new RuntimeException(e);
}
return copiedTool;
}
use of com.intellij.codeInspection.ex.InspectionToolWrapper in project intellij-community by JetBrains.
the class HighlightStressTest method configureLocalInspectionTools.
@NotNull
@Override
protected LocalInspectionTool[] configureLocalInspectionTools() {
if ("RandomEditingForUnused".equals(getTestName(false))) {
return new LocalInspectionTool[] { new UnusedImportLocalInspection() };
}
List<InspectionToolWrapper> all = InspectionToolRegistrar.getInstance().createTools();
List<LocalInspectionTool> locals = new ArrayList<>();
for (InspectionToolWrapper tool : all) {
if (tool instanceof LocalInspectionToolWrapper) {
LocalInspectionTool e = ((LocalInspectionToolWrapper) tool).getTool();
locals.add(e);
}
}
return locals.toArray(new LocalInspectionTool[locals.size()]);
}
use of com.intellij.codeInspection.ex.InspectionToolWrapper in project intellij-community by JetBrains.
the class EntryPointsNode method createDummyWrapper.
private static InspectionToolWrapper createDummyWrapper(@NotNull GlobalInspectionContextImpl context) {
InspectionToolWrapper toolWrapper = new GlobalInspectionToolWrapper(new DummyEntryPointsEP());
toolWrapper.initialize(context);
return toolWrapper;
}
use of com.intellij.codeInspection.ex.InspectionToolWrapper in project go-lang-idea-plugin by go-lang-plugin-org.
the class GoPerformanceTest method doInspectionTest.
private void doInspectionTest(@NotNull InspectionProfileEntry tool, long expected) {
VirtualFile sourceDir = installTestData("docker");
if (sourceDir == null)
return;
// noinspection ConstantConditions
AnalysisScope scope = new AnalysisScope(getPsiManager().findDirectory(sourceDir));
scope.invalidate();
InspectionManagerEx inspectionManager = (InspectionManagerEx) InspectionManager.getInstance(getProject());
InspectionToolWrapper wrapper = InspectionToolRegistrar.wrapTool(tool);
GlobalInspectionContextForTests globalContext = CodeInsightTestFixtureImpl.createGlobalContextForTool(scope, getProject(), inspectionManager, wrapper);
PlatformTestUtil.startPerformanceTest(getTestName(true), (int) expected, () -> InspectionTestUtil.runTool(wrapper, scope, globalContext)).cpuBound().usesAllCPUCores().assertTiming();
InspectionTestUtil.compareToolResults(globalContext, wrapper, false, new File(getTestDataPath(), wrapper.getShortName()).getPath());
}
use of com.intellij.codeInspection.ex.InspectionToolWrapper in project android by JetBrains.
the class AndroidLintInspectionBase method getInspectionShortNameByIssue.
public static String getInspectionShortNameByIssue(@NotNull Project project, @NotNull Issue issue) {
synchronized (ISSUE_MAP_LOCK) {
if (ourIssue2InspectionShortName == null) {
ourIssue2InspectionShortName = new HashMap<>();
final InspectionProfile profile = InspectionProjectProfileManager.getInstance(project).getCurrentProfile();
for (InspectionToolWrapper e : profile.getInspectionTools(null)) {
final String shortName = e.getShortName();
if (shortName.startsWith(LINT_INSPECTION_PREFIX)) {
final InspectionProfileEntry entry = e.getTool();
if (entry instanceof AndroidLintInspectionBase) {
final Issue s = ((AndroidLintInspectionBase) entry).getIssue();
ourIssue2InspectionShortName.put(s, shortName);
}
}
}
}
return ourIssue2InspectionShortName.get(issue);
}
}
Aggregations