Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inlined typealias for legacy LintError #1684

Merged
merged 1 commit into from
Jun 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/workflows/build_and_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ jobs:
uses: codecov/codecov-action@v3
with:
fail_ci_if_error: false
token: ${{ secrets.CODECOV_TOKEN }}

run_diktat_from_CLI:
name: Run diktat via CLI
Expand Down Expand Up @@ -302,6 +303,7 @@ jobs:
uses: codecov/codecov-action@v3
with:
fail_ci_if_error: false
token: ${{ secrets.CODECOV_TOKEN }}

report:
name: Publish JUnit test results
Expand Down

This file was deleted.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import org.cqfn.diktat.ruleset.constants.Warnings.TYPEALIAS_NAME_INCORRECT_CASE
import org.cqfn.diktat.ruleset.rules.chapter1.IdentifierNaming
import org.cqfn.diktat.util.LintTestBase

import com.pinterest.ktlint.core.LintError
import org.cqfn.diktat.api.DiktatError
import generated.WarningNames
import org.junit.jupiter.api.Tag
import org.junit.jupiter.api.Test
Expand All @@ -26,7 +26,7 @@ class MethodNamingWarnTest : LintTestBase(::IdentifierNaming) {
}
}
""".trimIndent()
lintMethod(code, LintError(2, 15, ruleId, "${FUNCTION_NAME_INCORRECT_CASE.warnText()} methODTREE", true))
lintMethod(code, DiktatError(2, 15, ruleId, "${FUNCTION_NAME_INCORRECT_CASE.warnText()} methODTREE", true))
}

@Test
Expand All @@ -40,7 +40,7 @@ class MethodNamingWarnTest : LintTestBase(::IdentifierNaming) {
}
}
""".trimIndent()
lintMethod(code, LintError(2, 9, ruleId, "${FUNCTION_NAME_INCORRECT_CASE.warnText()} method_two", true))
lintMethod(code, DiktatError(2, 9, ruleId, "${FUNCTION_NAME_INCORRECT_CASE.warnText()} method_two", true))
}

@Test
Expand All @@ -55,8 +55,8 @@ class MethodNamingWarnTest : LintTestBase(::IdentifierNaming) {
}
""".trimIndent()
lintMethod(code,
LintError(1, 12, ruleId, "${FUNCTION_NAME_INCORRECT_CASE.warnText()} methODTREE", true),
LintError(2, 9, ruleId, "${FUNCTION_NAME_INCORRECT_CASE.warnText()} TEST", true)
DiktatError(1, 12, ruleId, "${FUNCTION_NAME_INCORRECT_CASE.warnText()} methODTREE", true),
DiktatError(2, 9, ruleId, "${FUNCTION_NAME_INCORRECT_CASE.warnText()} TEST", true)
)
}

Expand All @@ -70,7 +70,7 @@ class MethodNamingWarnTest : LintTestBase(::IdentifierNaming) {
}
}
""".trimIndent()
lintMethod(code, LintError(2, 9, ruleId, "${FUNCTION_NAME_INCORRECT_CASE.warnText()} methODTREE", true))
lintMethod(code, DiktatError(2, 9, ruleId, "${FUNCTION_NAME_INCORRECT_CASE.warnText()} methODTREE", true))
}

@Test
Expand All @@ -83,7 +83,7 @@ class MethodNamingWarnTest : LintTestBase(::IdentifierNaming) {
}
}
""".trimIndent()
lintMethod(code, LintError(2, 9, ruleId, "${FUNCTION_NAME_INCORRECT_CASE.warnText()} methODTREE", true))
lintMethod(code, DiktatError(2, 9, ruleId, "${FUNCTION_NAME_INCORRECT_CASE.warnText()} methODTREE", true))
}

@Test
Expand All @@ -95,7 +95,7 @@ class MethodNamingWarnTest : LintTestBase(::IdentifierNaming) {
typealias relatedClasses = List<Pair<String, String>>
}
""".trimIndent()
lintMethod(code, LintError(2, 15, ruleId, "${TYPEALIAS_NAME_INCORRECT_CASE.warnText()} relatedClasses", true))
lintMethod(code, DiktatError(2, 15, ruleId, "${TYPEALIAS_NAME_INCORRECT_CASE.warnText()} relatedClasses", true))
}

@Test
Expand All @@ -119,6 +119,6 @@ class MethodNamingWarnTest : LintTestBase(::IdentifierNaming) {
return false
}
""".trimIndent()
lintMethod(code, LintError(1, 5, ruleId, "${FUNCTION_BOOLEAN_PREFIX.warnText()} someBooleanCheck", true))
lintMethod(code, DiktatError(1, 5, ruleId, "${FUNCTION_BOOLEAN_PREFIX.warnText()} someBooleanCheck", true))
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import org.cqfn.diktat.ruleset.rules.chapter1.PackageNaming
import org.cqfn.diktat.util.LintTestBase
import org.cqfn.diktat.util.TEST_FILE_NAME

import com.pinterest.ktlint.core.LintError
import org.cqfn.diktat.api.DiktatError
import generated.WarningNames
import org.junit.jupiter.api.Tag
import org.junit.jupiter.api.Test
Expand Down Expand Up @@ -50,7 +50,7 @@ class PackageNamingWarnTest : LintTestBase(::PackageNaming) {
""".trimIndent(),
tempDir = tempDir,
fileName = TEST_FILE_NAME,
LintError(1, 1, ruleId, "${PACKAGE_NAME_MISSING.warnText()} $TEST_FILE_NAME", true),
DiktatError(1, 1, ruleId, "${PACKAGE_NAME_MISSING.warnText()} $TEST_FILE_NAME", true),
rulesConfigList = rulesConfigList
)
}
Expand All @@ -72,7 +72,7 @@ class PackageNamingWarnTest : LintTestBase(::PackageNaming) {
""".trimIndent(),
tempDir = tempDir,
fileName = TEST_FILE_NAME,
LintError(1, 37, ruleId, "${PACKAGE_NAME_MISSING.warnText()} $TEST_FILE_NAME", true),
DiktatError(1, 37, ruleId, "${PACKAGE_NAME_MISSING.warnText()} $TEST_FILE_NAME", true),
rulesConfigList = rulesConfigList
)
}
Expand Down Expand Up @@ -111,7 +111,7 @@ class PackageNamingWarnTest : LintTestBase(::PackageNaming) {
class TestPackageName { }

""".trimIndent(),
LintError(1, 35, ruleId, "${PACKAGE_NAME_INCORRECT_CASE.warnText()} SPECIALTEST", true),
DiktatError(1, 35, ruleId, "${PACKAGE_NAME_INCORRECT_CASE.warnText()} SPECIALTEST", true),
rulesConfigList = rulesConfigList
)
}
Expand All @@ -132,7 +132,7 @@ class PackageNamingWarnTest : LintTestBase(::PackageNaming) {
class TestPackageName { }

""".trimIndent(),
LintError(1, 9, ruleId, "${PACKAGE_NAME_INCORRECT_PREFIX.warnText()} org.cqfn.diktat", true),
DiktatError(1, 9, ruleId, "${PACKAGE_NAME_INCORRECT_PREFIX.warnText()} org.cqfn.diktat", true),
rulesConfigList = rulesConfigList
)
}
Expand All @@ -153,7 +153,7 @@ class PackageNamingWarnTest : LintTestBase(::PackageNaming) {
class TestPackageName { }

""".trimIndent(),
LintError(1, 32, ruleId, "${INCORRECT_PACKAGE_SEPARATOR.warnText()} test_", true),
DiktatError(1, 32, ruleId, "${INCORRECT_PACKAGE_SEPARATOR.warnText()} test_", true),
rulesConfigList = rulesConfigList
)
}
Expand All @@ -174,7 +174,7 @@ class PackageNamingWarnTest : LintTestBase(::PackageNaming) {
class TestPackageName { }

""".trimIndent(),
LintError(1, 32, ruleId, "${PACKAGE_NAME_INCORRECT_SYMBOLS.warnText()} testш"),
DiktatError(1, 32, ruleId, "${PACKAGE_NAME_INCORRECT_SYMBOLS.warnText()} testш"),
rulesConfigList = rulesConfigList
)
}
Expand Down Expand Up @@ -235,7 +235,7 @@ class PackageNamingWarnTest : LintTestBase(::PackageNaming) {
""".trimIndent(),
tempDir = tempDir,
fileName = "diktat/diktat-rules/src/main/kotlin/org/cqfn/diktat/domain/BlaBla.kt",
LintError(1, 9, ruleId, "${PACKAGE_NAME_INCORRECT_PATH.warnText()} org.cqfn.diktat.main.kotlin.org.cqfn.diktat.domain", true),
DiktatError(1, 9, ruleId, "${PACKAGE_NAME_INCORRECT_PATH.warnText()} org.cqfn.diktat.main.kotlin.org.cqfn.diktat.domain", true),
rulesConfigList = rulesConfigSourceDirectories
)
}
Expand Down Expand Up @@ -276,7 +276,7 @@ class PackageNamingWarnTest : LintTestBase(::PackageNaming) {
""".trimIndent(),
tempDir = tempDir,
fileName = "diktat/diktat-rules/src/test/kotlin/org/cqfn/diktat/domain/BlaBla.kt",
LintError(1, 9, ruleId, "${PACKAGE_NAME_INCORRECT_PATH.warnText()} org.cqfn.diktat.test.kotlin.org.cqfn.diktat.domain", true),
DiktatError(1, 9, ruleId, "${PACKAGE_NAME_INCORRECT_PATH.warnText()} org.cqfn.diktat.test.kotlin.org.cqfn.diktat.domain", true),
rulesConfigList = rulesConfigSourceDirectories
)
}
Expand All @@ -299,7 +299,7 @@ class PackageNamingWarnTest : LintTestBase(::PackageNaming) {
""".trimIndent(),
tempDir = tempDir,
fileName = "diktat/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter1/EnumValueCaseTest.kt",
LintError(1, 9, ruleId, "${PACKAGE_NAME_INCORRECT_PATH.warnText()} org.cqfn.diktat.ruleset.chapter1", true),
DiktatError(1, 9, ruleId, "${PACKAGE_NAME_INCORRECT_PATH.warnText()} org.cqfn.diktat.ruleset.chapter1", true),
rulesConfigList = rulesConfigList
)
}
Expand Down Expand Up @@ -353,7 +353,7 @@ class PackageNamingWarnTest : LintTestBase(::PackageNaming) {
""".trimMargin(),
tempDir = tempDir,
fileName = "project/src/$it/kotlin/org/cqfn/diktat/example/Example.kt",
LintError(1, 9, ruleId, "${PACKAGE_NAME_INCORRECT_PATH.warnText()} org.cqfn.diktat.example", true),
DiktatError(1, 9, ruleId, "${PACKAGE_NAME_INCORRECT_PATH.warnText()} org.cqfn.diktat.example", true),
rulesConfigList = rulesConfigList
)
}
Expand All @@ -368,7 +368,7 @@ class PackageNamingWarnTest : LintTestBase(::PackageNaming) {
""".trimMargin(),
tempDir = tempDir,
fileName = "project/src/myProjectMain/kotlin/org/cqfn/diktat/example/Example.kt",
LintError(1, 9, ruleId, "${PACKAGE_NAME_INCORRECT_PATH.warnText()} org.cqfn.diktat.myProjectMain.kotlin.org.cqfn.diktat.example", true),
DiktatError(1, 9, ruleId, "${PACKAGE_NAME_INCORRECT_PATH.warnText()} org.cqfn.diktat.myProjectMain.kotlin.org.cqfn.diktat.example", true),
rulesConfigList = rulesConfigList
)
}
Expand All @@ -382,8 +382,8 @@ class PackageNamingWarnTest : LintTestBase(::PackageNaming) {
""".trimMargin(),
tempDir = tempDir,
fileName = "project/src/main/kotlin/org/cqfn/diktat/example/Example.kt",
LintError(1, 9, ruleId, "${PACKAGE_NAME_INCORRECT_PREFIX.warnText()} ", true),
LintError(1, 9, ruleId, "${PACKAGE_NAME_INCORRECT_PATH.warnText()} org.cqfn.diktat.example", true),
DiktatError(1, 9, ruleId, "${PACKAGE_NAME_INCORRECT_PREFIX.warnText()} ", true),
DiktatError(1, 9, ruleId, "${PACKAGE_NAME_INCORRECT_PATH.warnText()} org.cqfn.diktat.example", true),
rulesConfigList = rulesConfigListEmptyDomainName
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import org.cqfn.diktat.ruleset.constants.Warnings.IF_ELSE_COMMENTS
import org.cqfn.diktat.ruleset.rules.chapter2.kdoc.CommentsFormatting
import org.cqfn.diktat.util.LintTestBase

import com.pinterest.ktlint.core.LintError
import org.cqfn.diktat.api.DiktatError
import generated.WarningNames
import org.intellij.lang.annotations.Language
import org.junit.jupiter.api.Tag
Expand Down Expand Up @@ -51,7 +51,7 @@ class CommentsFormattingTest : LintTestBase(::CommentsFormatting) {
""".trimMargin()

lintMethod(code,
LintError(6, 51, ruleId, "${Warnings.COMMENT_WHITE_SPACE.warnText()} There should be 2 space(s) before comment text, but there are too many in // comment", true))
DiktatError(6, 51, ruleId, "${Warnings.COMMENT_WHITE_SPACE.warnText()} There should be 2 space(s) before comment text, but there are too many in // comment", true))
}

@Test
Expand All @@ -68,7 +68,7 @@ class CommentsFormattingTest : LintTestBase(::CommentsFormatting) {
""".trimMargin()

lintMethod(code,
LintError(3, 22, ruleId, "${Warnings.COMMENT_WHITE_SPACE.warnText()} There should be 2 space(s) before comment text, but there are too many in // asdasd", true))
DiktatError(3, 22, ruleId, "${Warnings.COMMENT_WHITE_SPACE.warnText()} There should be 2 space(s) before comment text, but there are too many in // asdasd", true))
}

@Test
Expand Down Expand Up @@ -138,8 +138,8 @@ class CommentsFormattingTest : LintTestBase(::CommentsFormatting) {
""".trimMargin()

lintMethod(code,
LintError(4, 5, ruleId, "${Warnings.COMMENT_WHITE_SPACE.warnText()} There should be 1 space(s) before comment token in //First Comment", true),
LintError(11, 5, ruleId, "${Warnings.COMMENT_WHITE_SPACE.warnText()} There should be 1 space(s) before comment token in /* Comment */", true))
DiktatError(4, 5, ruleId, "${Warnings.COMMENT_WHITE_SPACE.warnText()} There should be 1 space(s) before comment token in //First Comment", true),
DiktatError(11, 5, ruleId, "${Warnings.COMMENT_WHITE_SPACE.warnText()} There should be 1 space(s) before comment token in /* Comment */", true))
}

@Test
Expand Down Expand Up @@ -220,7 +220,7 @@ class CommentsFormattingTest : LintTestBase(::CommentsFormatting) {
""".trimMargin()

lintMethod(code,
LintError(2, 1, ruleId, "${Warnings.WRONG_NEWLINES_AROUND_KDOC.warnText()} // Some comment", true))
DiktatError(2, 1, ruleId, "${Warnings.WRONG_NEWLINES_AROUND_KDOC.warnText()} // Some comment", true))
}

@Test
Expand All @@ -243,9 +243,9 @@ class CommentsFormattingTest : LintTestBase(::CommentsFormatting) {
""".trimMargin()

lintMethod(code,
LintError(2, 1, ruleId, "${Warnings.WRONG_NEWLINES_AROUND_KDOC.warnText()} /* Some comment */", true),
LintError(6, 1, ruleId, "${Warnings.WRONG_NEWLINES_AROUND_KDOC.warnText()} /**...", true),
LintError(8, 3, ruleId, "${Warnings.WRONG_NEWLINES_AROUND_KDOC.warnText()} redundant blank line after /**...", true))
DiktatError(2, 1, ruleId, "${Warnings.WRONG_NEWLINES_AROUND_KDOC.warnText()} /* Some comment */", true),
DiktatError(6, 1, ruleId, "${Warnings.WRONG_NEWLINES_AROUND_KDOC.warnText()} /**...", true),
DiktatError(8, 3, ruleId, "${Warnings.WRONG_NEWLINES_AROUND_KDOC.warnText()} redundant blank line after /**...", true))
}

@Test
Expand Down Expand Up @@ -278,7 +278,7 @@ class CommentsFormattingTest : LintTestBase(::CommentsFormatting) {
""".trimMargin()

lintMethod(code,
LintError(5, 13, ruleId, "${Warnings.COMMENT_WHITE_SPACE.warnText()} There should be 2 space(s) before comment text, but are none in // This is a comment", true))
DiktatError(5, 13, ruleId, "${Warnings.COMMENT_WHITE_SPACE.warnText()} There should be 2 space(s) before comment text, but are none in // This is a comment", true))
}

@Test
Expand Down Expand Up @@ -349,7 +349,7 @@ class CommentsFormattingTest : LintTestBase(::CommentsFormatting) {
""".trimMargin()

lintMethod(code,
LintError(6, 8, ruleId, "${IF_ELSE_COMMENTS.warnText()} // Bad Comment", true))
DiktatError(6, 8, ruleId, "${IF_ELSE_COMMENTS.warnText()} // Bad Comment", true))
}

@Test
Expand All @@ -372,7 +372,7 @@ class CommentsFormattingTest : LintTestBase(::CommentsFormatting) {
""".trimMargin()

lintMethod(code,
LintError(6, 8, ruleId, "${IF_ELSE_COMMENTS.warnText()} /* Some comment */", true))
DiktatError(6, 8, ruleId, "${IF_ELSE_COMMENTS.warnText()} /* Some comment */", true))
}

@Test
Expand All @@ -394,7 +394,7 @@ class CommentsFormattingTest : LintTestBase(::CommentsFormatting) {
""".trimMargin()

lintMethod(code,
LintError(6, 8, ruleId, "${IF_ELSE_COMMENTS.warnText()} /* Some comment */", true))
DiktatError(6, 8, ruleId, "${IF_ELSE_COMMENTS.warnText()} /* Some comment */", true))
}

@Test
Expand Down Expand Up @@ -439,7 +439,7 @@ class CommentsFormattingTest : LintTestBase(::CommentsFormatting) {
""".trimMargin()

lintMethod(code,
LintError(8, 18, ruleId, "${Warnings.FIRST_COMMENT_NO_BLANK_LINE.warnText()} // Bad Comment", true))
DiktatError(8, 18, ruleId, "${Warnings.FIRST_COMMENT_NO_BLANK_LINE.warnText()} // Bad Comment", true))
}

@Test
Expand Down Expand Up @@ -473,7 +473,7 @@ class CommentsFormattingTest : LintTestBase(::CommentsFormatting) {
""".trimMargin()

lintMethod(code,
LintError(1, 2, ruleId, "${Warnings.COMMENT_WHITE_SPACE.warnText()} There should be 0 space(s) before comment text, but are 1 in /*...", true))
DiktatError(1, 2, ruleId, "${Warnings.COMMENT_WHITE_SPACE.warnText()} There should be 0 space(s) before comment text, but are 1 in /*...", true))
}

@Test
Expand Down
Loading