running test inspections by language + inspection language fixes

This commit is contained in:
Dmitry Avdeev
2011-12-28 17:43:10 +04:00
parent e405e12a21
commit f710215221
4 changed files with 26 additions and 6 deletions
@@ -40,12 +40,16 @@ public abstract class InspectionToolWrapper<T extends InspectionProfileEntry, E
protected final E myEP;
protected InspectionToolWrapper(E ep) {
myEP = ep;
this(null, ep);
}
protected InspectionToolWrapper(T tool) {
this(tool, null);
}
protected InspectionToolWrapper(@Nullable T tool, @Nullable E ep) {
myEP = ep;
myTool = tool;
myEP = null;
}
@NotNull
@@ -51,6 +51,10 @@ public final class LocalInspectionToolWrapper extends InspectionToolWrapper<Loca
super(ep);
}
public LocalInspectionToolWrapper(@Nullable LocalInspectionTool tool, @Nullable LocalInspectionEP ep) {
super(tool, ep);
}
public void processFile(PsiFile file, final boolean filterSuppressed, final InspectionManager manager) {
processFile(file, filterSuppressed, manager, false);
}
@@ -68,6 +68,7 @@ import com.intellij.openapi.editor.markup.GutterIconRenderer;
import com.intellij.openapi.editor.markup.RangeHighlighter;
import com.intellij.openapi.extensions.ExtensionPoint;
import com.intellij.openapi.extensions.ExtensionPointName;
import com.intellij.openapi.extensions.Extensions;
import com.intellij.openapi.extensions.ExtensionsArea;
import com.intellij.openapi.fileEditor.*;
import com.intellij.openapi.fileEditor.impl.text.TextEditorProvider;
@@ -152,6 +153,7 @@ public class CodeInsightTestFixtureImpl extends BaseFixture implements CodeInsig
@NonNls private static final String XXX = "XXX";
private final FileTreeAccessFilter myJavaFilesFilter = new FileTreeAccessFilter();
private boolean myAllowDirt;
private final Map<String, LocalInspectionEP> myExtensions = new HashMap<String, LocalInspectionEP>();
public CodeInsightTestFixtureImpl(IdeaProjectTestFixture projectFixture, TempDirTestFixture tempDirTestFixture) {
myProjectFixture = projectFixture;
@@ -1024,6 +1026,10 @@ public class CodeInsightTestFixtureImpl extends BaseFixture implements CodeInsig
DaemonCodeAnalyzerSettings.getInstance().setImportHintEnabled(false);
ensureIndexesUpToDate(getProject());
((StartupManagerImpl)StartupManagerEx.getInstanceEx(getProject())).runPostStartupActivities();
LocalInspectionEP[] extensions = Extensions.getExtensions(LocalInspectionEP.LOCAL_INSPECTION);
for (LocalInspectionEP extension : extensions) {
myExtensions.put(extension.shortName, extension);
}
}
@Override
@@ -1057,9 +1063,15 @@ public class CodeInsightTestFixtureImpl extends BaseFixture implements CodeInsig
HighlightDisplayKey.register(shortName, tool.getDisplayName(), id);
}
myAvailableTools.put(shortName, tool);
myAvailableLocalTools.put(shortName, tool instanceof LocalInspectionTool ?
new LocalInspectionToolWrapper((LocalInspectionTool)tool) :
(InspectionTool)tool);
InspectionTool inspectionTool;
if (tool instanceof LocalInspectionTool) {
LocalInspectionEP ep = myExtensions.get(tool.getShortName());
inspectionTool = new LocalInspectionToolWrapper((LocalInspectionTool)tool, ep);
}
else {
inspectionTool = (InspectionTool)tool;
}
myAvailableLocalTools.put(shortName, inspectionTool);
}
private void configureInspections(final InspectionProfileEntry[] tools) {
+1 -1
View File
@@ -430,7 +430,7 @@
<localInspection language="JAVA" suppressId="deprecation" shortName="Deprecation" displayName="Deprecated API usage" groupName=""
enabledByDefault="true" level="WARNING"
implementationClass="com.intellij.codeInspection.deprecation.DeprecationInspection"/>
<localInspection language="JAVA" shortName="DeprecatedClassUsageInspection" displayName="Deprecated API usage in XML" groupName="XML"
<localInspection language="XML" shortName="DeprecatedClassUsageInspection" displayName="Deprecated API usage in XML" groupName="XML"
enabledByDefault="true" level="WARNING" implementationClass="com.intellij.util.xml.DeprecatedClassUsageInspection"/>
<localInspection language="JAVA" shortName="EqualsAndHashcode" bundle="messages.InspectionsBundle" key="inspection.equals.hashcode.display.name"
groupName="" enabledByDefault="false" level="WARNING"