Search in sources :

Example 11 with LocalInspectionTool

use of com.intellij.codeInspection.LocalInspectionTool in project intellij-community by JetBrains.

the class ConvertFieldToLocalTest method configureLocalInspectionTools.

@NotNull
@Override
protected LocalInspectionTool[] configureLocalInspectionTools() {
    final FieldCanBeLocalInspection inspection = new FieldCanBeLocalInspection();
    inspection.IGNORE_FIELDS_USED_IN_MULTIPLE_METHODS = false;
    return new LocalInspectionTool[] { inspection };
}
Also used : FieldCanBeLocalInspection(com.intellij.codeInspection.varScopeCanBeNarrowed.FieldCanBeLocalInspection) LocalInspectionTool(com.intellij.codeInspection.LocalInspectionTool) NotNull(org.jetbrains.annotations.NotNull)

Example 12 with LocalInspectionTool

use of com.intellij.codeInspection.LocalInspectionTool in project intellij-community by JetBrains.

the class UseBulkOperationInspectionTest method configureLocalInspectionTools.

@NotNull
@Override
protected LocalInspectionTool[] configureLocalInspectionTools() {
    UseBulkOperationInspection inspection = new UseBulkOperationInspection();
    inspection.USE_ARRAYS_AS_LIST = true;
    return new LocalInspectionTool[] { inspection };
}
Also used : UseBulkOperationInspection(com.intellij.codeInspection.bulkOperation.UseBulkOperationInspection) LocalInspectionTool(com.intellij.codeInspection.LocalInspectionTool) NotNull(org.jetbrains.annotations.NotNull)

Example 13 with LocalInspectionTool

use of com.intellij.codeInspection.LocalInspectionTool in project intellij-community by JetBrains.

the class RegExpInspectionTestCase method highlightTest.

protected void highlightTest(@Language("RegExp") String code) {
    final LocalInspectionTool inspection = getInspection();
    myFixture.enableInspections(inspection);
    final HighlightDisplayKey displayKey = HighlightDisplayKey.find(inspection.getShortName());
    if (displayKey != null) {
        final Project project = myFixture.getProject();
        final InspectionProfileImpl currentProfile = ProjectInspectionProfileManager.getInstance(project).getCurrentProfile();
        final HighlightDisplayLevel errorLevel = currentProfile.getErrorLevel(displayKey, null);
        if (errorLevel == HighlightDisplayLevel.DO_NOT_SHOW) {
            currentProfile.setErrorLevel(displayKey, HighlightDisplayLevel.WARNING, project);
        }
    }
    myFixture.configureByText(RegExpFileType.INSTANCE, code);
    myFixture.testHighlighting();
}
Also used : Project(com.intellij.openapi.project.Project) InspectionProfileImpl(com.intellij.codeInspection.ex.InspectionProfileImpl) HighlightDisplayLevel(com.intellij.codeHighlighting.HighlightDisplayLevel) HighlightDisplayKey(com.intellij.codeInsight.daemon.HighlightDisplayKey) LocalInspectionTool(com.intellij.codeInspection.LocalInspectionTool)

Example 14 with LocalInspectionTool

use of com.intellij.codeInspection.LocalInspectionTool in project intellij-community by JetBrains.

the class SuppressModuleInfoInspectionsTest method testModuleInfo.

public void testModuleInfo() {
    // need to set jdk version here because it is not set correctly in the mock jdk which causes problems in
    // com.intellij.codeInspection.JavaSuppressionUtil#canHave15Suppressions()
    IdeaTestUtil.setTestVersion(JavaSdkVersion.JDK_1_9, myFixture.getModule(), getTestRootDisposable());
    final LocalInspectionTool inspection = new JavaDocReferenceInspection();
    myFixture.enableInspections(inspection);
    myFixture.configureByFile("module-info.java");
    myFixture.testHighlighting();
    myFixture.launchAction(myFixture.findSingleIntention("Suppress for module declaration"));
    myFixture.checkResultByFile("module-info.after.java");
}
Also used : JavaDocReferenceInspection(com.intellij.codeInspection.javaDoc.JavaDocReferenceInspection) LocalInspectionTool(com.intellij.codeInspection.LocalInspectionTool)

Example 15 with LocalInspectionTool

use of com.intellij.codeInspection.LocalInspectionTool in project intellij-community by JetBrains.

the class JavadocInspectionQuickFixTest method configureLocalInspectionTools.

@NotNull
@Override
protected LocalInspectionTool[] configureLocalInspectionTools() {
    final JavaDocLocalInspection javaDocLocalInspection = new JavaDocLocalInspection();
    javaDocLocalInspection.TOP_LEVEL_CLASS_OPTIONS.REQUIRED_TAGS = "param";
    javaDocLocalInspection.TOP_LEVEL_CLASS_OPTIONS.ACCESS_JAVADOC_REQUIRED_FOR = "package";
    javaDocLocalInspection.METHOD_OPTIONS.ACCESS_JAVADOC_REQUIRED_FOR = "package";
    return new LocalInspectionTool[] { javaDocLocalInspection };
}
Also used : LocalInspectionTool(com.intellij.codeInspection.LocalInspectionTool) JavaDocLocalInspection(com.intellij.codeInspection.javaDoc.JavaDocLocalInspection) NotNull(org.jetbrains.annotations.NotNull)

Aggregations

LocalInspectionTool (com.intellij.codeInspection.LocalInspectionTool)29 NotNull (org.jetbrains.annotations.NotNull)11 ProblemsHolder (com.intellij.codeInspection.ProblemsHolder)4 HighlightDisplayLevel (com.intellij.codeHighlighting.HighlightDisplayLevel)3 LocalInspectionToolWrapper (com.intellij.codeInspection.ex.LocalInspectionToolWrapper)3 Project (com.intellij.openapi.project.Project)3 IOException (java.io.IOException)3 HighlightDisplayKey (com.intellij.codeInsight.daemon.HighlightDisplayKey)2 LocalInspectionToolSession (com.intellij.codeInspection.LocalInspectionToolSession)2 InspectionProfileImpl (com.intellij.codeInspection.ex.InspectionProfileImpl)2 InspectionToolWrapper (com.intellij.codeInspection.ex.InspectionToolWrapper)2 JavaLanguage (com.intellij.lang.java.JavaLanguage)2 PsiElementVisitor (com.intellij.psi.PsiElementVisitor)2 File (java.io.File)2 Language (org.intellij.lang.annotations.Language)2 Nls (org.jetbrains.annotations.Nls)2 NonNls (org.jetbrains.annotations.NonNls)2 com.intellij.codeHighlighting (com.intellij.codeHighlighting)1 EditorInfo (com.intellij.codeInsight.EditorInfo)1 CompletionContributor (com.intellij.codeInsight.completion.CompletionContributor)1