Show lint diagnostics even if there're errors in the file (KT-12022)

It also affects working with KotlinChangeLocalityDetector. Right after error is fixed in local context file is still reported as having errors and diagnostics are not counted.

 #KT-12022 Fixed
This commit is contained in:
Nikolay Krasko
2016-09-01 21:50:23 +03:00
parent 795fef20d7
commit 67f353903e
4 changed files with 27 additions and 0 deletions
+6
View File
@@ -125,6 +125,12 @@ These artifacts include extensions for the types available in the latter JDKs, s
- [`KT-13155`](https://youtrack.jetbrains.com/issue/KT-13155) Implement "Introduce Type Parameter" refactoring
#### Android Lint
###### Issues fixed
- [`KT-12022`](https://youtrack.jetbrains.com/issue/KT-12022) Report lint warnings even when file contains errors
## 1.0.4
### Compiler
@@ -62,6 +62,12 @@ import static com.android.tools.klint.detector.api.TextFormat.RAW;
public class AndroidLintExternalAnnotator extends ExternalAnnotator<State, State> {
static final boolean INCLUDE_IDEA_SUPPRESS_ACTIONS = false;
@Nullable
@Override
public State collectInformation(@NotNull PsiFile file, @NotNull Editor editor, boolean hasErrors) {
return collectInformation(file);
}
@Override
public State collectInformation(@NotNull PsiFile file) {
final Module module = ModuleUtilCore.findModuleForPsiElement(file);
@@ -119,6 +119,12 @@ public class KotlinLintTestGenerated extends AbstractKotlinLintTest {
doTest(fileName);
}
@TestMetadata("showDiagnosticsWhenFileIsRed.kt")
public void testShowDiagnosticsWhenFileIsRed() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("plugins/uast-kotlin/testData/lint/showDiagnosticsWhenFileIsRed.kt");
doTest(fileName);
}
@TestMetadata("sqlite.kt")
public void testSqlite() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("plugins/uast-kotlin/testData/lint/sqlite.kt");
@@ -0,0 +1,9 @@
// INSPECTION_CLASS: org.jetbrains.android.inspections.klint.AndroidLintInspectionToolProvider$AndroidKLintSQLiteStringInspection
import android.database.sqlite.SQLiteDatabase
fun test(db: SQLiteDatabase) {
val <warning descr="[UNUSED_VARIABLE] Variable 'a' is never used">a</warning>: String = <error descr="[CONSTANT_EXPECTED_TYPE_MISMATCH] The integer literal does not conform to the expected type String">1</error>
db.<warning descr="Using column type STRING; did you mean to use TEXT? (STRING is a numeric type and its value can be adjusted; for example,strings that look like integers can drop leading zeroes. See issue explanation for details.)">execSQL("CREATE TABLE COMPANY(NAME STRING)")</warning>
}