optimization: filter inspection by language more correct in tests

Provide correct EP for inspection tools even with inconsistent tool.getShortName() and shortName="" in plugin.xml.
That allows obtaining correct tool.getLanguage(), and avoid running irrelevant inspections.
E.g. CheckDtdRef inspection doesn't run in java-only tests anymore.

GitOrigin-RevId: 188e9d55686ca084611c5c89cb899874dd078010
This commit is contained in:
Alexey Kudravtsev
2024-02-25 04:17:10 +01:00
committed by intellij-monorepo-bot
parent 7248824100
commit dfc5db43aa
36 changed files with 258 additions and 204 deletions

View File

@@ -4,6 +4,7 @@ package org.intellij.lang.regexp.inspection;
import com.intellij.codeHighlighting.HighlightDisplayLevel;
import com.intellij.codeInsight.daemon.HighlightDisplayKey;
import com.intellij.codeInspection.InspectionProfileEntry;
import com.intellij.codeInspection.InspectionWrapperUtil;
import com.intellij.codeInspection.InspectionsBundle;
import com.intellij.codeInspection.LocalInspectionTool;
import com.intellij.codeInspection.ex.InspectionProfileImpl;
@@ -55,6 +56,6 @@ public abstract class RegExpInspectionTestCase extends BasePlatformTestCase {
protected final void quickfixAllTest(@Language("RegExp") String before, @Language("RegExp") String after) {
InspectionProfileEntry inspection = getInspection();
quickfixTest(before, after, InspectionsBundle.message("fix.all.inspection.problems.in.file", inspection.getDisplayName()));
quickfixTest(before, after, InspectionsBundle.message("fix.all.inspection.problems.in.file", InspectionWrapperUtil.wrapTool(inspection).getDisplayName()));
}
}

View File

@@ -126,9 +126,9 @@ public class LossyConversion {
public void withSuppression() {
byte b = 0;
//not highlighted
b += <warning descr="Implicit cast from 'double' to 'byte' in compound assignment can be lossy">1.1</warning>;
b -= <warning descr="Implicit cast from 'double' to 'byte' in compound assignment can be lossy">2.2</warning>;
b *= <warning descr="Implicit cast from 'double' to 'byte' in compound assignment can be lossy">3.3</warning>;
b /= <warning descr="Implicit cast from 'double' to 'byte' in compound assignment can be lossy">4.4</warning>;
b += 1.1;
b -= 2.2;
b *= 3.3;
b /= 4.4;
}
}

View File

@@ -18,6 +18,7 @@ abstract class ObsoleteApiUsageInspectionTestBase : JvmInspectionTestBase() {
void f() {}
}""".trimIndent()
)
enableWarnings()
}
override fun getProjectDescriptor(): LightProjectDescriptor = object : ProjectDescriptor(LanguageLevel.HIGHEST, true) { }

View File

@@ -1,10 +1,13 @@
package com.intellij.jvm.analysis.testFramework
import com.intellij.codeHighlighting.HighlightDisplayLevel
import com.intellij.codeInsight.intention.IntentionAction
import com.intellij.codeInspection.InspectionProfileEntry
import com.intellij.codeInspection.InspectionsBundle
import com.intellij.codeInspection.ex.InspectionToolRegistrar
import com.intellij.codeInspection.ex.QuickFixWrapper
import com.intellij.pom.java.LanguageLevel
import com.intellij.profile.codeInspection.ProjectInspectionProfileManager
import com.intellij.testFramework.InspectionTestUtil
import com.intellij.testFramework.LightProjectDescriptor
import com.intellij.testFramework.fixtures.JavaCodeInsightTestFixture
@@ -20,6 +23,12 @@ abstract class JvmInspectionTestBase : LightJvmCodeInsightFixtureTestCase() {
myFixture.enableInspections(inspection)
}
protected fun enableWarnings() {
val profile = ProjectInspectionProfileManager.getInstance(project).currentProfile
val toolWrapper = InspectionToolRegistrar.wrapTool(inspection)
profile.setErrorLevel(toolWrapper.displayKey!!, HighlightDisplayLevel.WARNING, project)
}
override fun getProjectDescriptor(): LightProjectDescriptor = ProjectDescriptor(LanguageLevel.HIGHEST)
protected fun JavaCodeInsightTestFixture.testHighlighting(

View File

@@ -0,0 +1,30 @@
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.codeInspection;
import com.intellij.codeInspection.ex.GlobalInspectionToolWrapper;
import com.intellij.codeInspection.ex.InspectionToolWrapper;
import com.intellij.codeInspection.ex.LocalInspectionToolWrapper;
import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.NotNull;
@ApiStatus.Internal
public class InspectionWrapperUtil {
@NotNull
public static InspectionToolWrapper<?,?> wrapTool(@NotNull InspectionProfileEntry profileEntry) {
if (profileEntry instanceof LocalInspectionTool local) {
LocalInspectionToolWrapper wrapper = new LocalInspectionToolWrapper(local);
if (local.myNameProvider == null) {
local.myNameProvider = wrapper.getExtension();
}
return wrapper;
}
else if (profileEntry instanceof GlobalInspectionTool global) {
GlobalInspectionToolWrapper wrapper = new GlobalInspectionToolWrapper(global);
if (global.myNameProvider == null) {
global.myNameProvider = wrapper.getExtension();
}
return wrapper;
}
else throw new RuntimeException("unknown inspection class: " + profileEntry + "; " + profileEntry.getClass());
}
}

View File

@@ -33,11 +33,7 @@ class InspectionToolRegistrar : InspectionToolsSupplier() {
@ApiStatus.Internal
@JvmStatic
fun wrapTool(profileEntry: InspectionProfileEntry): InspectionToolWrapper<*, *> {
return when (profileEntry) {
is LocalInspectionTool -> LocalInspectionToolWrapper(profileEntry)
is GlobalInspectionTool -> GlobalInspectionToolWrapper(profileEntry)
else -> throw RuntimeException("unknown inspection class: " + profileEntry + "; " + profileEntry.javaClass)
}
return InspectionWrapperUtil.wrapTool(profileEntry)
}
}

View File

@@ -11,7 +11,7 @@ import org.jetbrains.annotations.Nullable;
public class LocalInspectionToolWrapper extends InspectionToolWrapper<LocalInspectionTool, LocalInspectionEP> {
/** This should be used in tests primarily */
public LocalInspectionToolWrapper(@NotNull LocalInspectionTool tool) {
super(tool, LocalInspectionEP.LOCAL_INSPECTION.getByKey(tool.getShortName(), LocalInspectionToolWrapper.class, InspectionEP::getShortName));
super(tool, findInspectionEP(tool));
}
public LocalInspectionToolWrapper(@NotNull LocalInspectionEP ep) {
@@ -78,4 +78,14 @@ public class LocalInspectionToolWrapper extends InspectionToolWrapper<LocalInspe
}
return toolWrapper;
}
private static LocalInspectionEP findInspectionEP(@NotNull LocalInspectionTool tool) {
LocalInspectionEP byKey = LocalInspectionEP.LOCAL_INSPECTION.getByKey(tool.getShortName(), LocalInspectionToolWrapper.class, InspectionEP::getShortName);
if (byKey != null) {
return byKey;
}
// sometimes tool.getShortName() is inconsistent with `shortName="xxx"` in plugin.xml. For example: CheckDtdReferencesInspection
// revert to brute force search among all extensions in this case
return LocalInspectionEP.LOCAL_INSPECTION.findFirstSafe(ep -> tool.getClass().getName().equals(ep.implementationClass));
}
}

View File

@@ -115,7 +115,7 @@ inline fun <T> runInInitMode(runnable: () -> T): T {
fun disableInspections(project: Project, vararg inspections: InspectionProfileEntry) {
val profile = InspectionProjectProfileManager.getInstance(project).currentProfile
for (inspection in inspections) {
profile.setToolEnabled(inspection.shortName, false)
profile.setToolEnabled(InspectionToolRegistrar.wrapTool(inspection).shortName, false)
}
}

View File

@@ -16,7 +16,7 @@ class MarkdownSupportTest : GrazieTestBase() {
}
fun `test replacement with markup inside`() {
myFixture.configureByText("a.md", "Please, <caret><warning>gather </warning>[<warning>up</warning> the](url) documentation.")
myFixture.configureByText("a.md", "Please, <caret><GRAMMAR_ERROR descr=\"GATHER_UP\">gather </GRAMMAR_ERROR>[<GRAMMAR_ERROR descr=\"GATHER_UP\">up</GRAMMAR_ERROR> the](url) documentation.")
myFixture.checkHighlighting()
myFixture.launchAction(myFixture.findSingleIntention("gather"))
myFixture.checkResult("Please, gather[ the](url) documentation.") // the result could be different, but the markup should still be preserved

View File

@@ -10,6 +10,8 @@ import java.nio.charset.StandardCharsets
class PropertiesSupportTest : GrazieTestBase() {
fun `test grammar check in file`() {
EncodingProjectManager.getInstance(project).setDefaultCharsetForPropertiesFiles(null, StandardCharsets.UTF_8)
EncodingProjectManager.getInstance(project).setNative2AsciiForPropertiesFiles(null, false)
UIUtil.dispatchAllInvocationEvents()
runHighlightTestForFile("ide/language/properties/Example.properties")
}

View File

@@ -1,6 +1,6 @@
class C {
/**
* @param a<warning descr="UNLIKELY_OPENING_PUNCTUATION"><caret>:</warning>here is some English text producing an error. And here's another sentence.
* @param a<GRAMMAR_ERROR descr="UNLIKELY_OPENING_PUNCTUATION"><caret>:</GRAMMAR_ERROR>here is some English text producing an error. And here's another sentence.
*/
void foo(int a){}
}

View File

@@ -1,17 +1,17 @@
// Copyright 2000-2020 I are a incorrect comment that the developers can hardly do anything about.
class ForMultiLanguageSupport {
// er überprüfte die Rechnungen noch <TYPO descr="Typo: In word 'einal'">einal</TYPO>, um ganz <warning descr="COMPOUND_INFINITIV_RULE">sicher zu gehen</warning>.
// das ist <warning descr="FUEHR_FUER">führ</warning> Dich!
// das <TYPO descr="Typo: In word 'daert'">daert</TYPO> geschätzt fünf <warning descr="MANNSTUNDE">Mannstunden</warning>.
// er überprüfte die Rechnungen noch <TYPO descr="Typo: In word 'einal'">einal</TYPO>, um ganz <GRAMMAR_ERROR descr="COMPOUND_INFINITIV_RULE">sicher zu gehen</GRAMMAR_ERROR>.
// das ist <GRAMMAR_ERROR descr="FUEHR_FUER">führ</GRAMMAR_ERROR> Dich!
// das <TYPO descr="Typo: In word 'daert'">daert</TYPO> geschätzt fünf <GRAMMAR_ERROR descr="MANNSTUNDE">Mannstunden</GRAMMAR_ERROR>.
// Cover following cases
// a) initially missing
// b) initially missing
// My
// <warning descr="COMMA_WHICH">name</warning>
// <warning descr="COMMA_WHICH">which</warning> I occurred is
// <GRAMMAR_ERROR descr="COMMA_WHICH">name</GRAMMAR_ERROR>
// <GRAMMAR_ERROR descr="COMMA_WHICH">which</GRAMMAR_ERROR> I occurred is
// bad
@@ -50,14 +50,14 @@ class ForMultiLanguageSupport {
// // We have an "hours" value of 42, when...
// Test various properties of <TYPO>igamma</TYPO> & <TYPO>igammac</TYPO>. These are normalized
// Test various properties of <TYPO descr="Typo: In word 'igamma'">igamma</TYPO> & <TYPO descr="Typo: In word 'igammac'">igammac</TYPO>. These are normalized
// gamma integrals where
// <TYPO>igammac</TYPO>(a, x) = Gamma(a, x) / Gamma(a)
// <TYPO>igamma</TYPO>(a, x) = gamma(a, x) / Gamma(a)
// <TYPO descr="Typo: In word 'igammac'">igammac</TYPO>(a, x) = Gamma(a, x) / Gamma(a)
// <TYPO descr="Typo: In word 'igamma'">igamma</TYPO>(a, x) = gamma(a, x) / Gamma(a)
// value between hours and minutes (":" is used by default)
// Copyright refers to <warning descr="EN_A_VS_AN">an</warning> legal right bla-bla-bla, and we check for errors here.
// Copyright refers to <GRAMMAR_ERROR descr="EN_A_VS_AN">an</GRAMMAR_ERROR> legal right bla-bla-bla, and we check for errors here.
// Avoid false positives when chunking is disabled.
// Elements are converted to strings as the time goes by.

View File

@@ -47,11 +47,11 @@ class ExampleClassWithNoTypos<T> {
}
/**
* It is <warning descr="EN_A_VS_AN">an</warning> friend there
* It is <GRAMMAR_ERROR descr="EN_A_VS_AN">an</GRAMMAR_ERROR> friend there
*
* </unopenedTag>
*
* @param T the <warning descr="KIND_OF_A">type of a</warning> <TYPO descr="Typo: In word 'membr'">membr</TYPO> in this group.
* @param T the <GRAMMAR_ERROR descr="KIND_OF_A">type of a</GRAMMAR_ERROR> <TYPO descr="Typo: In word 'membr'">membr</TYPO> in this group.
*/
class ExampleClassWithTypos<T> {
@@ -60,36 +60,36 @@ class ExampleClassWithTypos<T> {
/**
* Creates an empty group.
*
* @param name the <warning descr="COMMA_WHICH">name which</warning> group
* @param name the <GRAMMAR_ERROR descr="COMMA_WHICH">name which</GRAMMAR_ERROR> group
*/
public ExampleClassWithTypos(String name) {
this.name = name;
}
/**
* It <warning descr="IT_VBZ">add</warning> a [member] to this <TYPO descr="Typo: In word 'grooup'">grooup</TYPO>.
* <warning descr="UPPERCASE_SENTENCE_START">second</warning> sentence.
* It <GRAMMAR_ERROR descr="IT_VBZ">add</GRAMMAR_ERROR> a [member] to this <TYPO descr="Typo: In word 'grooup'">grooup</TYPO>.
* <GRAMMAR_ERROR descr="UPPERCASE_SENTENCE_START">second</GRAMMAR_ERROR> sentence.
*
* @param member member to add. And another sentence.
* @return the new size of <warning descr="DT_DT">a the</warning> group. <warning descr="UPPERCASE_SENTENCE_START">and</warning> another sentence.
* @return the new size of <GRAMMAR_ERROR descr="DT_DT">a the</GRAMMAR_ERROR> group. <GRAMMAR_ERROR descr="UPPERCASE_SENTENCE_START">and</GRAMMAR_ERROR> another sentence.
*/
Integer badFunction(T member) {
return 1; // It <warning descr="IT_VBZ">are</warning> <TYPO descr="Typo: In word 'eror'">eror</TYPO> in the comment
return 1; // It <GRAMMAR_ERROR descr="IT_VBZ">are</GRAMMAR_ERROR> <TYPO descr="Typo: In word 'eror'">eror</TYPO> in the comment
}
}
/**
* В коробке лежало <warning descr="Sklonenije_NUM_NN">пять карандаша</warning>.
* А <warning descr="grammar_vse_li_noun">все ли ошибка</warning> найдены?
* Это случилось <warning descr="INVALID_DATE">31 ноября</warning> 2014 г.
* За весь вечер она <warning descr="ne_proronila_ni">не проронила и слово</warning>.
* Собрание состоится в <warning descr="RU_COMPOUNDS">конференц зале</warning>.
* <warning descr="WORD_REPEAT_RULE">Он он</warning> ошибка.
* В коробке лежало <GRAMMAR_ERROR descr="Sklonenije_NUM_NN">пять карандаша</GRAMMAR_ERROR>.
* А <GRAMMAR_ERROR descr="grammar_vse_li_noun">все ли ошибка</GRAMMAR_ERROR> найдены?
* Это случилось <GRAMMAR_ERROR descr="INVALID_DATE">31 ноября</GRAMMAR_ERROR> 2014 г.
* За весь вечер она <GRAMMAR_ERROR descr="ne_proronila_ni">не проронила и слово</GRAMMAR_ERROR>.
* Собрание состоится в <GRAMMAR_ERROR descr="RU_COMPOUNDS">конференц зале</GRAMMAR_ERROR>.
* <GRAMMAR_ERROR descr="WORD_REPEAT_RULE">Он он</GRAMMAR_ERROR> ошибка.
*/
class ForMultiLanguageSupport {
// er überprüfte die Rechnungen noch <TYPO descr="Typo: In word 'einal'">einal</TYPO>, um ganz <warning descr="COMPOUND_INFINITIV_RULE">sicher zu gehen</warning>.
// das ist <warning descr="FUEHR_FUER">führ</warning> Dich!
// das <TYPO descr="Typo: In word 'daert'">daert</TYPO> geschätzt fünf <warning descr="MANNSTUNDE">Mannstunden</warning>.
// er überprüfte die Rechnungen noch <TYPO descr="Typo: In word 'einal'">einal</TYPO>, um ganz <GRAMMAR_ERROR descr="COMPOUND_INFINITIV_RULE">sicher zu gehen</GRAMMAR_ERROR>.
// das ist <GRAMMAR_ERROR descr="FUEHR_FUER">führ</GRAMMAR_ERROR> Dich!
// das <TYPO descr="Typo: In word 'daert'">daert</TYPO> geschätzt fünf <GRAMMAR_ERROR descr="MANNSTUNDE">Mannstunden</GRAMMAR_ERROR>.
/**
* @throws Exception wenn ein Fehler auftritt

View File

@@ -1,2 +1,2 @@
// Public field within private class can be written/read via reflection even without setAccessible hacks
// <caret><warning descr="COMMA_COMPOUND_SENTENCE">so</warning> we don't analyze such fields to reduce false-positives
// <caret><GRAMMAR_ERROR descr="COMMA_COMPOUND_SENTENCE">so</GRAMMAR_ERROR> we don't analyze such fields to reduce false-positives

View File

@@ -1,8 +1,8 @@
class Main {
public static void main(String[] args) {
String oneTypo = "It is <warning descr="EN_A_VS_AN">an</warning> friend of human";
String oneTypo = "It is <GRAMMAR_ERROR descr="EN_A_VS_AN">an</GRAMMAR_ERROR> friend of human";
String oneSpellcheckTypo = "It is <TYPO descr="Typo: In word 'frend'">frend</TYPO> of human";
String fewTypos = "It <warning descr="IT_VBZ">are</warning> working for <warning descr="MUCH_COUNTABLE">much</warning> warnings";
String fewTypos = "It <GRAMMAR_ERROR descr="IT_VBZ">are</GRAMMAR_ERROR> working for <GRAMMAR_ERROR descr="MUCH_COUNTABLE">much</GRAMMAR_ERROR> warnings";
String ignoreTemplate = "It is ${1} friend";
String notIgnoreOtherMistakes = "It is friend. But I have a ${1} here";
String typoInTextBlock = """
@@ -10,14 +10,14 @@ class Main {
<TYPO descr="Typo: In word 'onsectetur'">onsectetur</TYPO>...
""";
System.out.println("It is <warning descr="EN_A_VS_AN">an</warning> friend of human");
System.out.println("It is <GRAMMAR_ERROR descr="EN_A_VS_AN">an</GRAMMAR_ERROR> friend of human");
System.out.println("It is <TYPO descr="Typo: In word 'frend'">frend</TYPO> of human");
System.out.println("It <warning descr="IT_VBZ">are</warning> working for <warning descr="MUCH_COUNTABLE">much</warning> warnings");
System.out.println("It <GRAMMAR_ERROR descr="IT_VBZ">are</GRAMMAR_ERROR> working for <GRAMMAR_ERROR descr="MUCH_COUNTABLE">much</GRAMMAR_ERROR> warnings");
System.out.println("It is ${1} friend");
System.out.println("It is friend. But I have a ${1} here");
System.out.println("The path is ../data/test.avi");
}
String gitCherryPickPattern = "(cherry picked from "; // hard-coding the string git outputs
String nonGitCherryPick = "I'd like to <warning descr="EN_COMPOUNDS">cherry pick</warning> this";
String nonGitCherryPick = "I'd like to <GRAMMAR_ERROR descr="EN_COMPOUNDS">cherry pick</GRAMMAR_ERROR> this";
}

View File

@@ -1,2 +1,2 @@
// this is <warning descr="EN_A_VS_AN">an</warning> multiline comment (with
// this is <GRAMMAR_ERROR descr="EN_A_VS_AN">an</GRAMMAR_ERROR> multiline comment (with
// parentheses)

View File

@@ -29,12 +29,12 @@ class ExampleClassWithNoTypos {
}
/**
* It is <warning descr="EN_A_VS_AN">an</warning> friend of human
* It is <GRAMMAR_ERROR descr="EN_A_VS_AN">an</GRAMMAR_ERROR> friend of human
*/
class ExampleClassWithTypos {
/**
* Creates an empty group
* @param {String} name the <warning descr="COMMA_WHICH">name which</warning> group
* @param {String} name the <GRAMMAR_ERROR descr="COMMA_WHICH">name which</GRAMMAR_ERROR> group
*/
constructor(name) {
/** @private */
@@ -42,27 +42,27 @@ class ExampleClassWithTypos {
}
/**
* It <warning descr="IT_VBZ">add</warning> a [member] to this <TYPO descr="Typo: In word 'grooup'">grooup</TYPO>.
* It <GRAMMAR_ERROR descr="IT_VBZ">add</GRAMMAR_ERROR> a [member] to this <TYPO descr="Typo: In word 'grooup'">grooup</TYPO>.
* @param {String} member member to add
* @return {Number} the new size <warning descr="DT_DT">a the</warning> group.
* @return {Number} the new size <GRAMMAR_ERROR descr="DT_DT">a the</GRAMMAR_ERROR> group.
*/
badFunction(member) {
return 1; // It <warning descr="IT_VBZ">are</warning> <TYPO descr="Typo: In word 'eror'">eror</TYPO> in the comment
return 1; // It <GRAMMAR_ERROR descr="IT_VBZ">are</GRAMMAR_ERROR> <TYPO descr="Typo: In word 'eror'">eror</TYPO> in the comment
}
}
/**
* В коробке лежало <warning descr="Sklonenije_NUM_NN">пять карандаша</warning>.
* А <warning descr="grammar_vse_li_noun">все ли ошибка</warning> найдены?
* Это случилось <warning descr="INVALID_DATE">31 ноября</warning> 2014 г.
* За весь вечер она <warning descr="ne_proronila_ni">не проронила и слово</warning>.
* Собрание состоится в <warning descr="RU_COMPOUNDS">конференц зале</warning>.
* <warning descr="WORD_REPEAT_RULE">Он он</warning> ошибка.
* В коробке лежало <GRAMMAR_ERROR descr="Sklonenije_NUM_NN">пять карандаша</GRAMMAR_ERROR>.
* А <GRAMMAR_ERROR descr="grammar_vse_li_noun">все ли ошибка</GRAMMAR_ERROR> найдены?
* Это случилось <GRAMMAR_ERROR descr="INVALID_DATE">31 ноября</GRAMMAR_ERROR> 2014 г.
* За весь вечер она <GRAMMAR_ERROR descr="ne_proronila_ni">не проронила и слово</GRAMMAR_ERROR>.
* Собрание состоится в <GRAMMAR_ERROR descr="RU_COMPOUNDS">конференц зале</GRAMMAR_ERROR>.
* <GRAMMAR_ERROR descr="WORD_REPEAT_RULE">Он он</GRAMMAR_ERROR> ошибка.
*/
class ForMultiLanguageSupport {
// er überprüfte die Rechnungen noch <TYPO descr="Typo: In word 'einal'">einal</TYPO>, um ganz <warning descr="COMPOUND_INFINITIV_RULE">sicher zu gehen</warning>.
// das ist <warning descr="FUEHR_FUER">führ</warning> Dich!
// das <TYPO descr="Typo: In word 'daert'">daert</TYPO> geschätzt fünf <warning descr="MANNSTUNDE">Mannstunden</warning>.
// er überprüfte die Rechnungen noch <TYPO descr="Typo: In word 'einal'">einal</TYPO>, um ganz <GRAMMAR_ERROR descr="COMPOUND_INFINITIV_RULE">sicher zu gehen</GRAMMAR_ERROR>.
// das ist <GRAMMAR_ERROR descr="FUEHR_FUER">führ</GRAMMAR_ERROR> Dich!
// das <TYPO descr="Typo: In word 'daert'">daert</TYPO> geschätzt fünf <GRAMMAR_ERROR descr="MANNSTUNDE">Mannstunden</GRAMMAR_ERROR>.
}
module.exports = ExampleClassWithNoTypos;

View File

@@ -4,17 +4,17 @@ function formatName(user) {
const user = {
firstName: '<TYPO descr="Typo: In word 'eror'">eror</TYPO>',
lastName: 'it <warning descr="IT_VBZ">are</warning> bad'
lastName: 'it <GRAMMAR_ERROR descr="IT_VBZ">are</GRAMMAR_ERROR> bad'
};
const element = (
<h1>
{ (a, b) -> a + "it <warning descr="IT_VBZ">are</warning> <TYPO descr="Typo: In word 'eror'">eror</TYPO>. And here are some correct English words to make the language detector work." + user }
First sentence. it <warning descr="IT_VBZ">are</warning> bad,
{ (a, b) -> a + "it <GRAMMAR_ERROR descr="IT_VBZ">are</GRAMMAR_ERROR> <TYPO descr="Typo: In word 'eror'">eror</TYPO>. And here are some correct English words to make the language detector work." + user }
First sentence. it <GRAMMAR_ERROR descr="IT_VBZ">are</GRAMMAR_ERROR> bad,
<p>
it is <TYPO descr="Typo: In word 'frend'">frend</TYPO> of human
</p>
<warning descr="PRP_VBG">It working</warning> for <warning descr="MUCH_COUNTABLE">much</warning> warnings, {formatName(user)}!
<GRAMMAR_ERROR descr="PRP_VBG">It working</GRAMMAR_ERROR> for <GRAMMAR_ERROR descr="MUCH_COUNTABLE">much</GRAMMAR_ERROR> warnings, {formatName(user)}!
</h1>
);

View File

@@ -1,17 +1,17 @@
var oneTypo = "It is <warning descr="EN_A_VS_AN">an</warning> friend of human";
var oneTypo = "It is <GRAMMAR_ERROR descr="EN_A_VS_AN">an</GRAMMAR_ERROR> friend of human";
var oneSpellcheckTypo = "It is <TYPO descr="Typo: In word 'frend'">frend</TYPO> of human";
var fewTypos = "It <warning descr="IT_VBZ">are</warning> working for <warning descr="MUCH_COUNTABLE">much</warning> warnings";
var fewTypos = "It <GRAMMAR_ERROR descr="IT_VBZ">are</GRAMMAR_ERROR> working for <GRAMMAR_ERROR descr="MUCH_COUNTABLE">much</GRAMMAR_ERROR> warnings";
var ignoreTemplate = "It is ${fewTypos} friend";
var notIgnoreOtherMistakes = "It is friend. But I have a ${1} here";
var oneTypo = 'It is <warning descr="EN_A_VS_AN">an</warning> friend of human';
var oneTypo = 'It is <GRAMMAR_ERROR descr="EN_A_VS_AN">an</GRAMMAR_ERROR> friend of human';
var oneSpellcheckTypo = 'It is <TYPO descr="Typo: In word 'frend'">frend</TYPO> of human';
var fewTypos = 'It <warning descr="IT_VBZ">are</warning> working for <warning descr="MUCH_COUNTABLE">much</warning> warnings';
var fewTypos = 'It <GRAMMAR_ERROR descr="IT_VBZ">are</GRAMMAR_ERROR> working for <GRAMMAR_ERROR descr="MUCH_COUNTABLE">much</GRAMMAR_ERROR> warnings';
var ignoreTemplate = 'It is ${fewTypos} friend';
var notIgnoreOtherMistakes = 'It is friend. But I have a ${1} here';
console.log("It is <warning descr="EN_A_VS_AN">an</warning> friend of human");
console.log("It is <GRAMMAR_ERROR descr="EN_A_VS_AN">an</GRAMMAR_ERROR> friend of human");
console.log("It is <TYPO descr="Typo: In word 'frend'">frend</TYPO> of human");
console.log("It <warning descr="IT_VBZ">are</warning> working for <warning descr="MUCH_COUNTABLE">much</warning> warnings");
console.log("It <GRAMMAR_ERROR descr="IT_VBZ">are</GRAMMAR_ERROR> working for <GRAMMAR_ERROR descr="MUCH_COUNTABLE">much</GRAMMAR_ERROR> warnings");
console.log("It is ${fewTypos} friend");
console.log("It is friend. But I have a ${1} here");

View File

@@ -1,17 +1,17 @@
var oneTypo = "It is <warning descr="EN_A_VS_AN">an</warning> friend of human";
var oneTypo = "It is <GRAMMAR_ERROR descr="EN_A_VS_AN">an</GRAMMAR_ERROR> friend of human";
var oneSpellcheckTypo = "It is <TYPO descr="Typo: In word 'frend'">frend</TYPO> of human";
var fewTypos = "It <warning descr="IT_VBZ">are</warning> working for <warning descr="MUCH_COUNTABLE">much</warning> warnings";
var fewTypos = "It <GRAMMAR_ERROR descr="IT_VBZ">are</GRAMMAR_ERROR> working for <GRAMMAR_ERROR descr="MUCH_COUNTABLE">much</GRAMMAR_ERROR> warnings";
var ignoreTemplate = "It is ${fewTypos} friend";
var notIgnoreOtherMistakes = "It is friend. But I have a ${1} here";
var oneTypo = 'It is <warning descr="EN_A_VS_AN">an</warning> friend of human';
var oneTypo = 'It is <GRAMMAR_ERROR descr="EN_A_VS_AN">an</GRAMMAR_ERROR> friend of human';
var oneSpellcheckTypo = 'It is <TYPO descr="Typo: In word 'frend'">frend</TYPO> of human';
var fewTypos = 'It <warning descr="IT_VBZ">are</warning> working for <warning descr="MUCH_COUNTABLE">much</warning> warnings';
var fewTypos = 'It <GRAMMAR_ERROR descr="IT_VBZ">are</GRAMMAR_ERROR> working for <GRAMMAR_ERROR descr="MUCH_COUNTABLE">much</GRAMMAR_ERROR> warnings';
var ignoreTemplate = 'It is ${fewTypos} friend';
var notIgnoreOtherMistakes = 'It is friend. But I have a ${1} here';
console.log("It is <warning descr="EN_A_VS_AN">an</warning> friend of human");
console.log("It is <GRAMMAR_ERROR descr="EN_A_VS_AN">an</GRAMMAR_ERROR> friend of human");
console.log("It is <TYPO descr="Typo: In word 'frend'">frend</TYPO> of human");
console.log("It <warning descr="IT_VBZ">are</warning> working for <warning descr="MUCH_COUNTABLE">much</warning> warnings");
console.log("It <GRAMMAR_ERROR descr="IT_VBZ">are</GRAMMAR_ERROR> working for <GRAMMAR_ERROR descr="MUCH_COUNTABLE">much</GRAMMAR_ERROR> warnings");
console.log("It is ${fewTypos} friend");
console.log("It is friend. But I have a ${1} here");

View File

@@ -17,9 +17,9 @@
"onclick": "CloseDoc()"
},
{
"value": "В моей коробке лежало <warning descr="Sklonenije_NUM_NN">пять карандаша</warning>.",
"onclick": "А <warning descr="grammar_vse_li_noun">все ли ошибка</warning> найдены?",
"de": "er überprüfte die Rechnungen noch <TYPO descr="Typo: In word 'einal'">einal</TYPO>, <warning descr="COMPOUND_INFINITIV_RULE">sicher zu gehen</warning>"
"value": "В моей коробке лежало <GRAMMAR_ERROR descr="Sklonenije_NUM_NN">пять карандаша</GRAMMAR_ERROR>.",
"onclick": "А <GRAMMAR_ERROR descr="grammar_vse_li_noun">все ли ошибка</GRAMMAR_ERROR> найдены?",
"de": "er überprüfte die Rechnungen noch <TYPO descr="Typo: In word 'einal'">einal</TYPO>, <GRAMMAR_ERROR descr="COMPOUND_INFINITIV_RULE">sicher zu gehen</GRAMMAR_ERROR>"
}
]
}

View File

@@ -12,46 +12,46 @@ Of course, it has an `inline` fragment.
Even big fragment with injected code.
```html
<tag>This is <warning descr="EN_A_VS_AN">a</warning> error in article, making this paragraph so damn big!</tag>
<tag>This is <GRAMMAR_ERROR descr="EN_A_VS_AN">a</GRAMMAR_ERROR> error in article, making this paragraph so damn big!</tag>
```
## Now <warning descr="EN_A_VS_AN">an</warning> bad part
## Now <GRAMMAR_ERROR descr="EN_A_VS_AN">an</GRAMMAR_ERROR> bad part
It <warning descr="IT_VBZ">are</warning> written not many good .
It <GRAMMAR_ERROR descr="IT_VBZ">are</GRAMMAR_ERROR> written not many good .
Of <warning descr="MISSING_COMMA_AFTER_INTRODUCTORY_PHRASE">course</warning> it has <TYPO descr="Typo: In word 'errosr'">errosr</TYPO> in lists:
Of <GRAMMAR_ERROR descr="MISSING_COMMA_AFTER_INTRODUCTORY_PHRASE">course</GRAMMAR_ERROR> it has <TYPO descr="Typo: In word 'errosr'">errosr</TYPO> in lists:
* so much <TYPO descr="Typo: In word 'errorsss'">errorsss</TYPO>!
* even here it is <warning descr="EN_A_VS_AN">an</warning> friend of human
* even here it is <GRAMMAR_ERROR descr="EN_A_VS_AN">an</GRAMMAR_ERROR> friend of human
<warning descr="UPPERCASE_SENTENCE_START">once</warning> more we have an inline fragment and it is `a` friend.
<GRAMMAR_ERROR descr="UPPERCASE_SENTENCE_START">once</GRAMMAR_ERROR> more we have an inline fragment and it is `a` friend.
We immediately need to start the drafting of the Longview turbine contract<warning descr="COMMA_COMPOUND_SENTENCE"> and</warning> I'd like to see if we are close enough to get that started.
We immediately need to start the drafting of the Longview turbine contract<GRAMMAR_ERROR descr="COMMA_COMPOUND_SENTENCE"> and</GRAMMAR_ERROR> I'd like to see if we are close enough to get that started.
It is <warning descr="EN_A_VS_AN">an</warning> friend of human
It is <GRAMMAR_ERROR descr="EN_A_VS_AN">an</GRAMMAR_ERROR> friend of human
And we've got error in injected code!
```kotlin
val b = "It is friend."
```
It's a <warning descr="A_GOOGLE">react</warning> method. (An LT warning here)
It's a <GRAMMAR_ERROR descr="A_GOOGLE">react</GRAMMAR_ERROR> method. (An LT warning here)
It's a *react* method. (Fine, as it's emphasized)
Defined field String name = "John<warning descr="EN_QUOTES">"</warning>
System.out.println(<warning descr="EN_QUOTES">"</warning>Hello <warning descr="EN_QUOTES">"</warning> + name)
foo(<warning descr="THE_PUNCT">a,</warning> <warning descr="THE_PUNCT">the,</warning> an)
Defined field String name = "John<GRAMMAR_ERROR descr="EN_QUOTES">"</GRAMMAR_ERROR>
System.out.println(<GRAMMAR_ERROR descr="EN_QUOTES">"</GRAMMAR_ERROR>Hello <GRAMMAR_ERROR descr="EN_QUOTES">"</GRAMMAR_ERROR> + name)
foo(<GRAMMAR_ERROR descr="THE_PUNCT">a,</GRAMMAR_ERROR> <GRAMMAR_ERROR descr="THE_PUNCT">the,</GRAMMAR_ERROR> an)
## Немного русского
В коробке лежало <warning descr="Sklonenije_NUM_NN">пять карандаша</warning>.
А <warning descr="grammar_vse_li_noun">все ли ошибка</warning> найдены?
Это случилось <warning descr="INVALID_DATE">31 ноября</warning> 2014 г.
За весь вечер она <warning descr="ne_proronila_ni">не проронила и слово</warning>.
Собрание состоится в <warning descr="RU_COMPOUNDS">конференц зале</warning>.
<warning descr="WORD_REPEAT_RULE">Он он</warning> ошибка.
В коробке лежало <GRAMMAR_ERROR descr="Sklonenije_NUM_NN">пять карандаша</GRAMMAR_ERROR>.
А <GRAMMAR_ERROR descr="grammar_vse_li_noun">все ли ошибка</GRAMMAR_ERROR> найдены?
Это случилось <GRAMMAR_ERROR descr="INVALID_DATE">31 ноября</GRAMMAR_ERROR> 2014 г.
За весь вечер она <GRAMMAR_ERROR descr="ne_proronila_ni">не проронила и слово</GRAMMAR_ERROR>.
Собрание состоится в <GRAMMAR_ERROR descr="RU_COMPOUNDS">конференц зале</GRAMMAR_ERROR>.
<GRAMMAR_ERROR descr="WORD_REPEAT_RULE">Он он</GRAMMAR_ERROR> ошибка.
Я предлагаю в&nbsp;своём приложении создавать что-нибудь.
Er überprüfte die Rechnungen noch <TYPO descr="Typo: In word 'einal'">einal</TYPO>, um ganz <warning descr="COMPOUND_INFINITIV_RULE">sicher zu gehen</warning>.
das ist <warning descr="FUEHR_FUER">führ</warning> Dich!
das <TYPO descr="Typo: In word 'daert'">daert</TYPO> geschätzt fünf <warning descr="MANNSTUNDE">Mannstunden</warning>.
Er überprüfte die Rechnungen noch <TYPO descr="Typo: In word 'einal'">einal</TYPO>, um ganz <GRAMMAR_ERROR descr="COMPOUND_INFINITIV_RULE">sicher zu gehen</GRAMMAR_ERROR>.
das ist <GRAMMAR_ERROR descr="FUEHR_FUER">führ</GRAMMAR_ERROR> Dich!
das <TYPO descr="Typo: In word 'daert'">daert</TYPO> geschätzt fünf <GRAMMAR_ERROR descr="MANNSTUNDE">Mannstunden</GRAMMAR_ERROR>.

View File

@@ -1,9 +1,9 @@
В коробке лежало <warning descr="Sklonenije_NUM_NN">пять карандаша</warning>.
А <warning descr="grammar_vse_li_noun">все ли ошибка</warning> найдены?
Это случилось <warning descr="INVALID_DATE">31 ноября</warning> 2014 г.
За весь вечер она <warning descr="ne_proronila_ni">не проронила и слово</warning>.
Собрание состоится в <warning descr="RU_COMPOUNDS">конференц зале</warning>.
<warning descr="WORD_REPEAT_RULE">Он он</warning> ошибка.
В коробке лежало <GRAMMAR_ERROR descr="Sklonenije_NUM_NN">пять карандаша</GRAMMAR_ERROR>.
А <GRAMMAR_ERROR descr="grammar_vse_li_noun">все ли ошибка</GRAMMAR_ERROR> найдены?
Это случилось <GRAMMAR_ERROR descr="INVALID_DATE">31 ноября</GRAMMAR_ERROR> 2014 г.
За весь вечер она <GRAMMAR_ERROR descr="ne_proronila_ni">не проронила и слово</GRAMMAR_ERROR>.
Собрание состоится в <GRAMMAR_ERROR descr="RU_COMPOUNDS">конференц зале</GRAMMAR_ERROR>.
<GRAMMAR_ERROR descr="WORD_REPEAT_RULE">Он он</GRAMMAR_ERROR> ошибка.
Ignoring code-like constructs:
Defined field String name = "John"

View File

@@ -1,22 +1,22 @@
one.typo=It is <warning descr="EN_A_VS_AN">an</warning> friend of human
one.typo=It is <GRAMMAR_ERROR descr="EN_A_VS_AN">an</GRAMMAR_ERROR> friend of human
one.spellcheck.typo=It is <TYPO descr="Typo: In word 'frend'">frend</TYPO> of human
few.typos=It <warning descr="IT_VBZ">are</warning> working for <warning descr="MUCH_COUNTABLE">much</warning> warnings
few.typos=It <GRAMMAR_ERROR descr="IT_VBZ">are</GRAMMAR_ERROR> working for <GRAMMAR_ERROR descr="MUCH_COUNTABLE">much</GRAMMAR_ERROR> warnings
ignore.template=It is {0} friend
not.<TYPO descr="Typo: In word 'ignre'">ignre</TYPO>.other.mistakes=It is friend. But I have a {0} here
about.box.build.date=, built on {0}
ru.text.err1=В моей коробке лежало <warning descr="Sklonenije_NUM_NN">пять карандаша</warning>.
ru.text.err2=А <warning descr="grammar_vse_li_noun">все ли ошибка</warning> найдены?
ru.text.err3=Это случилось <warning descr="INVALID_DATE">31 ноября</warning> 2014 г.
ru.text.err4=За весь вечер она <warning descr="ne_proronila_ni">не проронила и слово</warning>.
ru.text.err5=Собрание состоится в <warning descr="RU_COMPOUNDS">конференц зале</warning>.
ru.text.err6=<warning descr="WORD_REPEAT_RULE">Он он</warning> здесь ошибка в тексте.
ru.text.err1=В моей коробке лежало <GRAMMAR_ERROR descr="Sklonenije_NUM_NN">пять карандаша</GRAMMAR_ERROR>.
ru.text.err2=А <GRAMMAR_ERROR descr="grammar_vse_li_noun">все ли ошибка</GRAMMAR_ERROR> найдены?
ru.text.err3=Это случилось <GRAMMAR_ERROR descr="INVALID_DATE">31 ноября</GRAMMAR_ERROR> 2014 г.
ru.text.err4=За весь вечер она <GRAMMAR_ERROR descr="ne_proronila_ni">не проронила и слово</GRAMMAR_ERROR>.
ru.text.err5=Собрание состоится в <GRAMMAR_ERROR descr="RU_COMPOUNDS">конференц зале</GRAMMAR_ERROR>.
ru.text.err6=<GRAMMAR_ERROR descr="WORD_REPEAT_RULE">Он он</GRAMMAR_ERROR> здесь ошибка в тексте.
ru.with.newline=Не удалось авторизоваться.\nПопробуйте ещё раз.
de.text.err1=Er überprüfte die Rechnungen noch <TYPO descr="Typo: In word 'einal'">einal</TYPO>, um ganz <warning descr="COMPOUND_INFINITIV_RULE">sicher zu gehen</warning>.
de.text.err2=das ist <warning descr="FUEHR_FUER">führ</warning> Dich!
de.text.err3=das <TYPO descr="Typo: In word 'daert'">daert</TYPO> geschätzt fünf <warning descr="MANNSTUNDE">Mannstunden</warning>.
de.text.err1=Er überprüfte die Rechnungen noch <TYPO descr="Typo: In word 'einal'">einal</TYPO>, um ganz <GRAMMAR_ERROR descr="COMPOUND_INFINITIV_RULE">sicher zu gehen</GRAMMAR_ERROR>.
de.text.err2=das ist <GRAMMAR_ERROR descr="FUEHR_FUER">führ</GRAMMAR_ERROR> Dich!
de.text.err3=das <TYPO descr="Typo: In word 'daert'">daert</TYPO> geschätzt fünf <GRAMMAR_ERROR descr="MANNSTUNDE">Mannstunden</GRAMMAR_ERROR>.
message.text.files.do.not.exist=<html><body>The following files don''t exist: <br>\
{0}The corresponding modules won''t be converted. Do you want to continue?</body></html>

View File

@@ -5,8 +5,8 @@
<title><TYPO descr="Typo: In word 'Ttle'">Ttle</TYPO></title>
</head>
<body>
<H1>Example <TYPO descr="Typo: In word 'hedder'">hedder</TYPO> with <warning descr="EN_A_VS_AN">a</warning> error, so what?</H1>\
<tag descr="<warning descr="UPPERCASE_SENTENCE_START">it</warning> <warning descr="IT_VBZ">are</warning> error in tag <TYPO descr="Typo: In word 'atributee'">atributee</TYPO>. And here are some correct English words to make the language detector work."></tag>
<H1>Example <TYPO descr="Typo: In word 'hedder'">hedder</TYPO> with <GRAMMAR_ERROR descr="EN_A_VS_AN">a</GRAMMAR_ERROR> error, so what?</H1>\
<tag descr="<GRAMMAR_ERROR descr="UPPERCASE_SENTENCE_START">it</GRAMMAR_ERROR> <GRAMMAR_ERROR descr="IT_VBZ">are</GRAMMAR_ERROR> error in tag <TYPO descr="Typo: In word 'atributee'">atributee</TYPO>. And here are some correct English words to make the language detector work."></tag>
Some widely used comparison methods (e.g. <code>String.compareTo</code>)
actually return values.
@@ -18,21 +18,21 @@ actually return values.
</pre>
<p>
В коробке лежало <warning descr="Sklonenije_NUM_NN">пять карандаша</warning>.
В коробке лежало <GRAMMAR_ERROR descr="Sklonenije_NUM_NN">пять карандаша</GRAMMAR_ERROR>.
В коробке лежало
пять карандашей.
А <warning descr="grammar_vse_li_noun">все ли ошибка</warning> найдены?
Это случилось <warning descr="INVALID_DATE">31 ноября</warning> 2014 г.
За весь вечер она <warning descr="ne_proronila_ni">не проронила и слово</warning>.
Собрание состоится в <warning descr="RU_COMPOUNDS">конференц зале</warning>.
<warning descr="WORD_REPEAT_RULE">Он он</warning> ошибка.
А <GRAMMAR_ERROR descr="grammar_vse_li_noun">все ли ошибка</GRAMMAR_ERROR> найдены?
Это случилось <GRAMMAR_ERROR descr="INVALID_DATE">31 ноября</GRAMMAR_ERROR> 2014 г.
За весь вечер она <GRAMMAR_ERROR descr="ne_proronila_ni">не проронила и слово</GRAMMAR_ERROR>.
Собрание состоится в <GRAMMAR_ERROR descr="RU_COMPOUNDS">конференц зале</GRAMMAR_ERROR>.
<GRAMMAR_ERROR descr="WORD_REPEAT_RULE">Он он</GRAMMAR_ERROR> ошибка.
Я&nbsp;предлагаю в&nbsp;своём приложении создавать что-нибудь.
</p>
<p>
Er überprüfte die Rechnungen noch <TYPO descr="Typo: In word 'einal'">einal</TYPO>, um ganz <warning descr="COMPOUND_INFINITIV_RULE">sicher zu gehen</warning>.
Das ist <warning descr="FUEHR_FUER">führ</warning> Dich!
Das <TYPO descr="Typo: In word 'daert'">daert</TYPO> geschätzt fünf <warning descr="MANNSTUNDE">Mannstunden</warning>.
Er überprüfte die Rechnungen noch <TYPO descr="Typo: In word 'einal'">einal</TYPO>, um ganz <GRAMMAR_ERROR descr="COMPOUND_INFINITIV_RULE">sicher zu gehen</GRAMMAR_ERROR>.
Das ist <GRAMMAR_ERROR descr="FUEHR_FUER">führ</GRAMMAR_ERROR> Dich!
Das <TYPO descr="Typo: In word 'daert'">daert</TYPO> geschätzt fünf <GRAMMAR_ERROR descr="MANNSTUNDE">Mannstunden</GRAMMAR_ERROR>.
</p>
<p>Use the <b>Ignore assignments in and returns from private methods</b> option to ignore assignments and returns in <code>private</code> methods.

View File

@@ -3,10 +3,10 @@
xsi:noNamespaceSchemaLocation="Example.xsd">
<orderperson><TYPO descr="Typo: In word 'johnn'">johnn</TYPO> Smith</orderperson>
<shipto>
<name>First sentence. <warning descr="UPPERCASE_SENTENCE_START">it</warning> <warning descr="EN_A_VS_AN">an</warning> friend. Last sentence.</name>
<name>First sentence. <GRAMMAR_ERROR descr="UPPERCASE_SENTENCE_START">it</GRAMMAR_ERROR> <GRAMMAR_ERROR descr="EN_A_VS_AN">an</GRAMMAR_ERROR> friend. Last sentence.</name>
<address>Some street 23</address>
</shipto>
<russian_with_newline>Не удалось авторизоваться.\nПопробуйте ещё раз. И <warning descr="Sklonenije_NUM_NN">пять карандаша</warning>.</russian_with_newline>
<russian_with_newline>Не удалось авторизоваться.\nПопробуйте ещё раз. И <GRAMMAR_ERROR descr="Sklonenije_NUM_NN">пять карандаша</GRAMMAR_ERROR>.</russian_with_newline>
<code>
Defined field String name = "John"

View File

@@ -17,40 +17,40 @@ items:
# on multiple lines)
- part_no: E1628
'it are error here': It <warning descr="IT_VBZ">are</warning> error here
'it are error here': It <GRAMMAR_ERROR descr="IT_VBZ">are</GRAMMAR_ERROR> error here
size: 8
# It
# <warning descr="IT_VBZ">are</warning> bad price
# <GRAMMAR_ERROR descr="IT_VBZ">are</GRAMMAR_ERROR> bad price
price: 133.7
quantity:
- It <warning descr="IT_VBZ">are</warning> error here
- It <GRAMMAR_ERROR descr="IT_VBZ">are</GRAMMAR_ERROR> error here
- <TYPO descr="Typo: In word 'xcvxcv'">xcvxcv</TYPO>
bill-to: &id001
street: |
В большой коробке лежало <warning descr="Sklonenije_NUM_NN">пять карандаша</warning>.
А <warning descr="grammar_vse_li_noun">все ли ошибка</warning> найдены?
Это случилось <warning descr="INVALID_DATE">31 ноября</warning> 2014 г.
За весь вечер она <warning descr="ne_proronila_ni">не проронила и слово</warning>.
Собрание состоится в <warning descr="RU_COMPOUNDS">конференц зале</warning>.
В большой коробке лежало <GRAMMAR_ERROR descr="Sklonenije_NUM_NN">пять карандаша</GRAMMAR_ERROR>.
А <GRAMMAR_ERROR descr="grammar_vse_li_noun">все ли ошибка</GRAMMAR_ERROR> найдены?
Это случилось <GRAMMAR_ERROR descr="INVALID_DATE">31 ноября</GRAMMAR_ERROR> 2014 г.
За весь вечер она <GRAMMAR_ERROR descr="ne_proronila_ni">не проронила и слово</GRAMMAR_ERROR>.
Собрание состоится в <GRAMMAR_ERROR descr="RU_COMPOUNDS">конференц зале</GRAMMAR_ERROR>.
БОЛЬШИЕ БУКВЫ.
Актуальный плагин.
На конференции работали советы по секциям: химия, история.
city: "It <warning descr="IT_VBZ">are</warning> <TYPO descr="Typo: In word 'eror'">eror</TYPO>. And here are some correct English words to make the language detector work."
city: "It <GRAMMAR_ERROR descr="IT_VBZ">are</GRAMMAR_ERROR> <TYPO descr="Typo: In word 'eror'">eror</TYPO>. And here are some correct English words to make the language detector work."
ship-to: *id001
'Chapter 1': [Introduction, Event Types, It <warning descr="IT_VBZ">are</warning> error]
'Chapter 1': [Introduction, Event Types, It <GRAMMAR_ERROR descr="IT_VBZ">are</GRAMMAR_ERROR> error]
'Chapter 2': [Introduction, Helpers]
'symfony 1.0': { PHP: 5.0, Propel: 1.2 }
'symfony 1.2': { PHP: 5.2, Propel: 1.3 }
# it <warning descr="IT_VBZ">are</warning> bad <TYPO descr="Typo: In word 'eror'">eror</TYPO> in comments
# it <GRAMMAR_ERROR descr="IT_VBZ">are</GRAMMAR_ERROR> bad <TYPO descr="Typo: In word 'eror'">eror</TYPO> in comments
specialDelivery: >
Er überprüfte die Rechnungen noch <TYPO descr="Typo: In word 'einal'">einal</TYPO>, um ganz <warning descr="COMPOUND_INFINITIV_RULE">sicher zu gehen</warning>.
das ist <warning descr="FUEHR_FUER">führ</warning> Dich!
das <TYPO descr="Typo: In word 'daert'">daert</TYPO> geschätzt fünf <warning descr="MANNSTUNDE">Mannstunden</warning>.
Er überprüfte die Rechnungen noch <TYPO descr="Typo: In word 'einal'">einal</TYPO>, um ganz <GRAMMAR_ERROR descr="COMPOUND_INFINITIV_RULE">sicher zu gehen</GRAMMAR_ERROR>.
das ist <GRAMMAR_ERROR descr="FUEHR_FUER">führ</GRAMMAR_ERROR> Dich!
das <TYPO descr="Typo: In word 'daert'">daert</TYPO> geschätzt fünf <GRAMMAR_ERROR descr="MANNSTUNDE">Mannstunden</GRAMMAR_ERROR>.
# We usually recommend not to specify default resources and to leave this as a conscious
# choice for the user. This also increases chances charts run on environments with little

View File

@@ -11,6 +11,10 @@ import com.intellij.testFramework.LightProjectDescriptor
abstract class JUnit4ConverterInspectionTestBase : JvmInspectionTestBase() {
override val inspection = JUnit4ConverterInspection()
override fun setUp() {
super.setUp()
enableWarnings()
}
protected open class JUnitProjectDescriptor(languageLevel: LanguageLevel) : ProjectDescriptor(languageLevel) {
override fun configureModule(module: Module, model: ModifiableRootModel, contentEntry: ContentEntry) {

View File

@@ -22,24 +22,24 @@ class ExampleClassWithNoTypos<T>(val name: String) {
}
/**
* It is <warning descr="EN_A_VS_AN">an</warning> friend of human
* It is <GRAMMAR_ERROR descr="EN_A_VS_AN">an</GRAMMAR_ERROR> friend of human
*
* @param T the <warning descr="KIND_OF_A">type of a</warning> <TYPO descr="Typo: In word 'membr'">membr</TYPO> in this group.
* @property name the <warning descr="COMMA_WHICH">name which</warning> group. <warning descr="UPPERCASE_SENTENCE_START">and</warning> another sentence.
* @param T the <GRAMMAR_ERROR descr="KIND_OF_A">type of a</GRAMMAR_ERROR> <TYPO descr="Typo: In word 'membr'">membr</TYPO> in this group.
* @property name the <GRAMMAR_ERROR descr="COMMA_WHICH">name which</GRAMMAR_ERROR> group. <GRAMMAR_ERROR descr="UPPERCASE_SENTENCE_START">and</GRAMMAR_ERROR> another sentence.
* @constructor Creates an empty group.
*/
class ExampleClassWithTypos<T>(val name: String) {
/**
* <warning descr="UPPERCASE_SENTENCE_START">it</warning> <warning descr="IT_VBZ">add</warning> a [member] to this <TYPO descr="Typo: In word 'grooup'">grooup</TYPO>. And here are some correct English words to make the language detector work.
* <GRAMMAR_ERROR descr="UPPERCASE_SENTENCE_START">it</GRAMMAR_ERROR> <GRAMMAR_ERROR descr="IT_VBZ">add</GRAMMAR_ERROR> a [member] to this <TYPO descr="Typo: In word 'grooup'">grooup</TYPO>. And here are some correct English words to make the language detector work.
*
* @return the new size of <warning descr="DT_DT">a the</warning> group.
* @return the new size of <GRAMMAR_ERROR descr="DT_DT">a the</GRAMMAR_ERROR> group.
*/
fun badFunction(member: T): Int {
return 1 // It <warning descr="IT_VBZ">are</warning> <TYPO descr="Typo: In word 'eror'">eror</TYPO> comment. And here are some correct English words to make the language detector work.
return 1 // It <GRAMMAR_ERROR descr="IT_VBZ">are</GRAMMAR_ERROR> <TYPO descr="Typo: In word 'eror'">eror</TYPO> comment. And here are some correct English words to make the language detector work.
}
/**
* @param name1 It is <warning descr="EN_A_VS_AN">an</warning> friend of human
* @param name1 It is <GRAMMAR_ERROR descr="EN_A_VS_AN">an</GRAMMAR_ERROR> friend of human
* @param name2 It is an
* @return friend of human
*/
@@ -49,20 +49,20 @@ class ExampleClassWithTypos<T>(val name: String) {
// Just some
// text here
// just <warning descr="EN_A_VS_AN">an</warning> text here
// just <GRAMMAR_ERROR descr="EN_A_VS_AN">an</GRAMMAR_ERROR> text here
/**
* В коробке лежало <warning descr="Sklonenije_NUM_NN">пять карандаша</warning>.
* А <warning descr="grammar_vse_li_noun">все ли ошибка</warning> найдены?
* Это случилось <warning descr="INVALID_DATE">31 ноября</warning> 2014 г.
* За весь вечер она <warning descr="ne_proronila_ni">не проронила и слово</warning>.
* Собрание состоится в <warning descr="RU_COMPOUNDS">конференц зале</warning>.
* <warning descr="WORD_REPEAT_RULE">Он он</warning> ошибка.
* В коробке лежало <GRAMMAR_ERROR descr="Sklonenije_NUM_NN">пять карандаша</GRAMMAR_ERROR>.
* А <GRAMMAR_ERROR descr="grammar_vse_li_noun">все ли ошибка</GRAMMAR_ERROR> найдены?
* Это случилось <GRAMMAR_ERROR descr="INVALID_DATE">31 ноября</GRAMMAR_ERROR> 2014 г.
* За весь вечер она <GRAMMAR_ERROR descr="ne_proronila_ni">не проронила и слово</GRAMMAR_ERROR>.
* Собрание состоится в <GRAMMAR_ERROR descr="RU_COMPOUNDS">конференц зале</GRAMMAR_ERROR>.
* <GRAMMAR_ERROR descr="WORD_REPEAT_RULE">Он он</GRAMMAR_ERROR> ошибка.
*/
class ForMultiLanguageSupport {
// Er überprüfte die Rechnungen noch <TYPO descr="Typo: In word 'einal'">einal</TYPO>, um ganz <warning descr="COMPOUND_INFINITIV_RULE">sicher zu gehen</warning>.
// Das ist <warning descr="FUEHR_FUER">führ</warning> Dich!
// Das <TYPO descr="Typo: In word 'daert'">daert</TYPO> geschätzt fünf <warning descr="MANNSTUNDE">Mannstunden</warning>.
// Er überprüfte die Rechnungen noch <TYPO descr="Typo: In word 'einal'">einal</TYPO>, um ganz <GRAMMAR_ERROR descr="COMPOUND_INFINITIV_RULE">sicher zu gehen</GRAMMAR_ERROR>.
// Das ist <GRAMMAR_ERROR descr="FUEHR_FUER">führ</GRAMMAR_ERROR> Dich!
// Das <TYPO descr="Typo: In word 'daert'">daert</TYPO> geschätzt fünf <GRAMMAR_ERROR descr="MANNSTUNDE">Mannstunden</GRAMMAR_ERROR>.
}
/**
@@ -73,7 +73,7 @@ class ForMultiLanguageSupport {
* a && !b -> ...
* }
* ```
* * This is <warning descr="EN_A_VS_AN">a</warning> error.
* * This is <GRAMMAR_ERROR descr="EN_A_VS_AN">a</GRAMMAR_ERROR> error.
* ```
* An non-checked code fragment
* ```

View File

@@ -3,9 +3,9 @@
package ide.language.kotlin
object OneLine {
val oneTypo = "It is <warning descr="EN_A_VS_AN">an</warning> friend of human"
val oneTypo = "It is <GRAMMAR_ERROR descr="EN_A_VS_AN">an</GRAMMAR_ERROR> friend of human"
val oneSpellcheckTypo = "It is <TYPO descr="Typo: In word 'frend'">frend</TYPO> of human"
val fewTypos = "It <warning descr="IT_VBZ">are</warning> working for <warning descr="MUCH_COUNTABLE">much</warning> warnings"
val fewTypos = "It <GRAMMAR_ERROR descr="IT_VBZ">are</GRAMMAR_ERROR> working for <GRAMMAR_ERROR descr="MUCH_COUNTABLE">much</GRAMMAR_ERROR> warnings"
val ignoreTemplate = "It is ${1} friend"
val notIgnoreOtherMistakes = "It is friend. But I have a ${1} here"
@@ -13,14 +13,14 @@ object OneLine {
}
object MultiLine {
val oneTypo = """It is <warning descr="EN_A_VS_AN">an</warning> friend of human"""
val oneTypo = """It is <GRAMMAR_ERROR descr="EN_A_VS_AN">an</GRAMMAR_ERROR> friend of human"""
val oneSpellcheckTypo = """It is <TYPO descr="Typo: In word 'frend'">frend</TYPO> of human"""
val fewTypos = """It <warning descr="IT_VBZ">are</warning> working for <warning descr="MUCH_COUNTABLE">much</warning> warnings"""
val fewTypos = """It <GRAMMAR_ERROR descr="IT_VBZ">are</GRAMMAR_ERROR> working for <GRAMMAR_ERROR descr="MUCH_COUNTABLE">much</GRAMMAR_ERROR> warnings"""
val ignoreTemplate = """It is ${1} friend"""
val notIgnoreOtherMistakes = """It is friend. But I have a ${1} here"""
val marginPrefixAsPrefix = """It is
|<warning descr="EN_A_VS_AN">an</warning> friend of human"""
|<GRAMMAR_ERROR descr="EN_A_VS_AN">an</GRAMMAR_ERROR> friend of human"""
val marginPrefixInTheMiddle = """It is|friend of human"""
@@ -29,9 +29,9 @@ object MultiLine {
object InFunc {
fun a(b: String) {
a("It is <warning descr="EN_A_VS_AN">an</warning> friend of human")
a("It is <GRAMMAR_ERROR descr="EN_A_VS_AN">an</GRAMMAR_ERROR> friend of human")
a("It is <TYPO descr="Typo: In word 'frend'">frend</TYPO> of human")
a("It <warning descr="IT_VBZ">are</warning> working for <warning descr="MUCH_COUNTABLE">much</warning> warnings")
a("It <GRAMMAR_ERROR descr="IT_VBZ">are</GRAMMAR_ERROR> working for <GRAMMAR_ERROR descr="MUCH_COUNTABLE">much</GRAMMAR_ERROR> warnings")
a("It is ${1} friend")
a("It is friend. But I have a ${1} here")

View File

@@ -1,6 +1,6 @@
# It is <warning descr="EN_A_VS_AN">an</warning> friend of human
# It is <GRAMMAR_ERROR descr="EN_A_VS_AN">an</GRAMMAR_ERROR> friend of human
one = 1
# It
# <warning descr="IT_VBZ">are</warning> bad price
# <GRAMMAR_ERROR descr="IT_VBZ">are</GRAMMAR_ERROR> bad price
two = 2

View File

@@ -1,6 +1,7 @@
oneline_double_quoted_literal = "It <warning descr="IT_VBZ">are</warning> bad error in string literal"
oneline_single_quoted_literal = 'das ist <warning descr="FUEHR_FUER">führ</warning> Dich!'
multiline_double_quoted_literal = """Это случилось <warning descr="INVALID_DATE">31
ноября</warning> 2014 г."""
multiline_single_quoted_literal = '''В моей коробке лежало <warning descr="Sklonenije_NUM_NN">пять
карандаша</warning>.'''
oneline_double_quoted_literal = "It <GRAMMAR_ERROR descr="IT_VBZ">are</GRAMMAR_ERROR> bad error in string literal"
oneline_single_quoted_literal = 'das ist <GRAMMAR_ERROR descr="FUEHR_FUER">führ</GRAMMAR_ERROR> Dich!'
multiline_double_quoted_literal = """Это случилось <GRAMMAR_ERROR descr="INVALID_DATE">31
ноября</GRAMMAR_ERROR> 2014 г."""
multiline_single_quoted_literal = '''В моей коробке лежало <GRAMMAR_ERROR descr="Sklonenije_NUM_NN">пять
карандаша</GRAMMAR_ERROR>.'''

View File

@@ -1,4 +1,4 @@
# This is <warning descr="EN_A_VS_AN">a</warning> error
# This is <GRAMMAR_ERROR descr="EN_A_VS_AN">a</GRAMMAR_ERROR> error
# (in a multiline comment
# with parentheses)

View File

@@ -11,7 +11,7 @@ class ExampleClassWithNoTypos:
name (str): the name of this group. And another sentence.
Attributes:
name (str): the name of this group. <warning descr="UPPERCASE_SENTENCE_START">and</warning> another sentence. And here are some correct English words to make the language detector work.
name (str): the name of this group. <GRAMMAR_ERROR descr="UPPERCASE_SENTENCE_START">and</GRAMMAR_ERROR> another sentence. And here are some correct English words to make the language detector work.
"""
@@ -33,13 +33,13 @@ class ExampleClassWithNoTypos:
class ExampleClassWithTypos:
"""It <warning descr="IT_VBZ">are</warning> friend there. And here are some correct English words to make the language detector work.
"""It <GRAMMAR_ERROR descr="IT_VBZ">are</GRAMMAR_ERROR> friend there. And here are some correct English words to make the language detector work.
Args:
name (str): the <warning descr="COMMA_WHICH">name which</warning> group and some other English text
name (str): the <GRAMMAR_ERROR descr="COMMA_WHICH">name which</GRAMMAR_ERROR> group and some other English text
Attributes:
name (str): the <warning descr="COMMA_WHICH">name which</warning> group and some other English text
name (str): the <GRAMMAR_ERROR descr="COMMA_WHICH">name which</GRAMMAR_ERROR> group and some other English text
"""
@@ -48,32 +48,32 @@ class ExampleClassWithTypos:
def bad_function(self, member):
"""
It <warning descr="IT_VBZ">add</warning> a [member] to this <TYPO descr="Typo: In word 'grooup'">grooup</TYPO>. And here are some correct English words to make the language detector work.
It <GRAMMAR_ERROR descr="IT_VBZ">add</GRAMMAR_ERROR> a [member] to this <TYPO descr="Typo: In word 'grooup'">grooup</TYPO>. And here are some correct English words to make the language detector work.
Args:
member (str): member to add to the group.
Returns:
int: the new size of <warning descr="DT_DT">a the</warning> group. And here are some correct English words to make the language detector work.
int: the new size of <GRAMMAR_ERROR descr="DT_DT">a the</GRAMMAR_ERROR> group. And here are some correct English words to make the language detector work.
"""
return 1 # It <warning descr="IT_VBZ">are</warning> <TYPO descr="Typo: In word 'eror'">eror</TYPO> comment. And here are some correct English words to make the language detector work.
return 1 # It <GRAMMAR_ERROR descr="IT_VBZ">are</GRAMMAR_ERROR> <TYPO descr="Typo: In word 'eror'">eror</TYPO> comment. And here are some correct English words to make the language detector work.
class ForMultiLanguageSupport:
"""
В коробке лежало <warning descr="Sklonenije_NUM_NN">пять карандаша</warning>.
А <warning descr="grammar_vse_li_noun">все ли ошибка</warning> найдены?
Это случилось <warning descr="INVALID_DATE">31 ноября</warning> 2014 г.
За весь вечер она <warning descr="ne_proronila_ni">не проронила и слово</warning>.
Собрание состоится в <warning descr="RU_COMPOUNDS">конференц зале</warning>.
<warning descr="WORD_REPEAT_RULE">Он он</warning> ошибка.
В коробке лежало <GRAMMAR_ERROR descr="Sklonenije_NUM_NN">пять карандаша</GRAMMAR_ERROR>.
А <GRAMMAR_ERROR descr="grammar_vse_li_noun">все ли ошибка</GRAMMAR_ERROR> найдены?
Это случилось <GRAMMAR_ERROR descr="INVALID_DATE">31 ноября</GRAMMAR_ERROR> 2014 г.
За весь вечер она <GRAMMAR_ERROR descr="ne_proronila_ni">не проронила и слово</GRAMMAR_ERROR>.
Собрание состоится в <GRAMMAR_ERROR descr="RU_COMPOUNDS">конференц зале</GRAMMAR_ERROR>.
<GRAMMAR_ERROR descr="WORD_REPEAT_RULE">Он он</GRAMMAR_ERROR> ошибка.
"""
def __init__(self):
"""
Er überprüfte die Rechnungen noch <TYPO descr="Typo: In word 'einal'">einal</TYPO>, um ganz <warning descr="COMPOUND_INFINITIV_RULE">sicher zu gehen</warning>.
Das ist <warning descr="FUEHR_FUER">führ</warning> Dich!
Das <TYPO descr="Typo: In word 'daert'">daert</TYPO> geschätzt fünf <warning descr="MANNSTUNDE">Mannstunden</warning>.
Er überprüfte die Rechnungen noch <TYPO descr="Typo: In word 'einal'">einal</TYPO>, um ganz <GRAMMAR_ERROR descr="COMPOUND_INFINITIV_RULE">sicher zu gehen</GRAMMAR_ERROR>.
Das ist <GRAMMAR_ERROR descr="FUEHR_FUER">führ</GRAMMAR_ERROR> Dich!
Das <TYPO descr="Typo: In word 'daert'">daert</TYPO> geschätzt fünf <GRAMMAR_ERROR descr="MANNSTUNDE">Mannstunden</GRAMMAR_ERROR>.
"""
pass

View File

@@ -2,6 +2,6 @@ def f(user):
"""
:param user: user
Loose punctuation mark.
:param user: <warning descr="UPPERCASE_SENTENCE_START">user</warning>
:param user: <GRAMMAR_ERROR descr="UPPERCASE_SENTENCE_START">user</GRAMMAR_ERROR>
"""
pass

View File

@@ -1,18 +1,18 @@
# TODO add f-Strings support
oneTypo = "It is <warning descr="EN_A_VS_AN">an</warning> friend of human"
oneTypo = "It is <GRAMMAR_ERROR descr="EN_A_VS_AN">an</GRAMMAR_ERROR> friend of human"
oneSpellcheckTypo = "It is <TYPO descr="Typo: In word 'frend'">frend</TYPO> of human"
fewTypos = "It <warning descr="IT_VBZ">are</warning> working for <warning descr="MUCH_COUNTABLE">much</warning> warnings"
fewTypos = "It <GRAMMAR_ERROR descr="IT_VBZ">are</GRAMMAR_ERROR> working for <GRAMMAR_ERROR descr="MUCH_COUNTABLE">much</GRAMMAR_ERROR> warnings"
ignoreTemplate = "It is {} friend" % fewTypos
notIgnoreOtherMistakes = "It <warning descr="IT_VBZ">are</warning> friend. But I have a {1} here"
notIgnoreOtherMistakes = "It <GRAMMAR_ERROR descr="IT_VBZ">are</GRAMMAR_ERROR> friend. But I have a {1} here"
oneTypo = 'It is <warning descr="EN_A_VS_AN">an</warning> friend of human'
oneTypo = 'It is <GRAMMAR_ERROR descr="EN_A_VS_AN">an</GRAMMAR_ERROR> friend of human'
oneSpellcheckTypo = 'It is <TYPO descr="Typo: In word 'frend'">frend</TYPO> of human'
fewTypos = 'It <warning descr="IT_VBZ">are</warning> working for <warning descr="MUCH_COUNTABLE">much</warning> warnings'
fewTypos = 'It <GRAMMAR_ERROR descr="IT_VBZ">are</GRAMMAR_ERROR> working for <GRAMMAR_ERROR descr="MUCH_COUNTABLE">much</GRAMMAR_ERROR> warnings'
ignoreTemplate = 'It is {} friend' % fewTypos
notIgnoreOtherMistakes = 'It <warning descr="IT_VBZ">are</warning> friend. But I have a {1} here'
notIgnoreOtherMistakes = 'It <GRAMMAR_ERROR descr="IT_VBZ">are</GRAMMAR_ERROR> friend. But I have a {1} here'
print('It is <warning descr="EN_A_VS_AN">an</warning> friend of human')
print('It is <GRAMMAR_ERROR descr="EN_A_VS_AN">an</GRAMMAR_ERROR> friend of human')
print('It is <TYPO descr="Typo: In word 'frend'">frend</TYPO> of human')
print('It <warning descr="IT_VBZ">are</warning> working for <warning descr="MUCH_COUNTABLE">much</warning> warnings')
print('It <GRAMMAR_ERROR descr="IT_VBZ">are</GRAMMAR_ERROR> working for <GRAMMAR_ERROR descr="MUCH_COUNTABLE">much</GRAMMAR_ERROR> warnings')
print('It is {} friend' % fewTypos)
print('It <warning descr="IT_VBZ">are</warning> friend. But I have a {1} here')
print('It <GRAMMAR_ERROR descr="IT_VBZ">are</GRAMMAR_ERROR> friend. But I have a {1} here')