Minor: cleanup warnings in codebase-tests
This commit is contained in:
committed by
Space Team
parent
c1a1986344
commit
3eeb867f56
Generated
+1
@@ -2,6 +2,7 @@
|
|||||||
<dictionary name="Nikolay.Krasko">
|
<dictionary name="Nikolay.Krasko">
|
||||||
<words>
|
<words>
|
||||||
<w>accessors</w>
|
<w>accessors</w>
|
||||||
|
<w>codeowners</w>
|
||||||
<w>coroutines</w>
|
<w>coroutines</w>
|
||||||
<w>crossinline</w>
|
<w>crossinline</w>
|
||||||
<w>fqname</w>
|
<w>fqname</w>
|
||||||
|
|||||||
@@ -17,7 +17,8 @@ class CodeConformanceTest : TestCase() {
|
|||||||
companion object {
|
companion object {
|
||||||
private val JAVA_FILE_PATTERN = Pattern.compile(".+\\.java")
|
private val JAVA_FILE_PATTERN = Pattern.compile(".+\\.java")
|
||||||
private val SOURCES_FILE_PATTERN = Pattern.compile(".+\\.(java|kt|js)")
|
private val SOURCES_FILE_PATTERN = Pattern.compile(".+\\.(java|kt|js)")
|
||||||
private const val MAX_STEPS_COUNT = 100
|
|
||||||
|
@Suppress("SpellCheckingInspection")
|
||||||
private val nonSourcesMatcher = FileMatcher(
|
private val nonSourcesMatcher = FileMatcher(
|
||||||
File("."),
|
File("."),
|
||||||
listOf(
|
listOf(
|
||||||
@@ -74,6 +75,7 @@ class CodeConformanceTest : TestCase() {
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@Suppress("SpellCheckingInspection")
|
||||||
private val COPYRIGHT_EXCLUDED_FILES_AND_DIRS_MATCHER = FileMatcher(
|
private val COPYRIGHT_EXCLUDED_FILES_AND_DIRS_MATCHER = FileMatcher(
|
||||||
File("."),
|
File("."),
|
||||||
listOf(
|
listOf(
|
||||||
@@ -162,7 +164,7 @@ class CodeConformanceTest : TestCase() {
|
|||||||
|
|
||||||
val atAuthorPattern = Pattern.compile("/\\*.+@author.+\\*/", Pattern.DOTALL)
|
val atAuthorPattern = Pattern.compile("/\\*.+@author.+\\*/", Pattern.DOTALL)
|
||||||
|
|
||||||
val tests = listOf(
|
@Suppress("SpellCheckingInspection") val tests = listOf(
|
||||||
FileTestCase(
|
FileTestCase(
|
||||||
"%d source files contain @author javadoc tag.\nPlease remove them or exclude in this test:\n%s"
|
"%d source files contain @author javadoc tag.\nPlease remove them or exclude in this test:\n%s"
|
||||||
) { _, source ->
|
) { _, source ->
|
||||||
@@ -394,7 +396,7 @@ class CodeConformanceTest : TestCase() {
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
data class RepoOccurance(val repo: String, val file: File)
|
data class RepoOccurrence(val repo: String, val file: File)
|
||||||
data class RepoOccurrences(val repo: String, val files: Collection<File>)
|
data class RepoOccurrences(val repo: String, val files: Collection<File>)
|
||||||
|
|
||||||
val extensionsPattern = Pattern.compile(".+\\.(java|kt|gradle|kts|xml)(\\.\\w+)?")
|
val extensionsPattern = Pattern.compile(".+\\.(java|kt|gradle|kts|xml)(\\.\\w+)?")
|
||||||
@@ -405,12 +407,12 @@ class CodeConformanceTest : TestCase() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (checkers.isNotEmpty()) {
|
if (checkers.isNotEmpty()) {
|
||||||
val occurrences = ArrayList<RepoOccurance>()
|
val occurrences = ArrayList<RepoOccurrence>()
|
||||||
file.useLines { lines ->
|
file.useLines { lines ->
|
||||||
for (line in lines) {
|
for (line in lines) {
|
||||||
for (checker in checkers) {
|
for (checker in checkers) {
|
||||||
if (line.contains(checker.repo) && (checker.exclude == null || !line.contains(checker.exclude))) {
|
if (line.contains(checker.repo) && (checker.exclude == null || !line.contains(checker.exclude))) {
|
||||||
occurrences.add(RepoOccurance(checker.repo, file))
|
occurrences.add(RepoOccurrence(checker.repo, file))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -17,7 +17,7 @@ import org.junit.Test
|
|||||||
import java.io.File
|
import java.io.File
|
||||||
|
|
||||||
|
|
||||||
class DepsVerificationMetadataTest {
|
class DependenciesVerificationMetadataTest {
|
||||||
@JacksonXmlRootElement(localName = "verification-metadata")
|
@JacksonXmlRootElement(localName = "verification-metadata")
|
||||||
private data class VerificationMetadata(
|
private data class VerificationMetadata(
|
||||||
@field:JacksonXmlElementWrapper(localName = "components")
|
@field:JacksonXmlElementWrapper(localName = "components")
|
||||||
@@ -57,17 +57,19 @@ class ReflectionCodeSanityTest : TestCase() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (badMembers.isNotEmpty()) {
|
if (badMembers.isNotEmpty()) {
|
||||||
fail("The members listed below appear to be delegates for properties.\n" +
|
fail(
|
||||||
|
"The members listed below appear to be delegates for properties.\n" +
|
||||||
"It's highly not recommended to use property delegates in reflection.jvm because a KProperty instance\n" +
|
"It's highly not recommended to use property delegates in reflection.jvm because a KProperty instance\n" +
|
||||||
"is created for each delegated property and that makes the initialization sequence of reflection\n" +
|
"is created for each delegated property and that makes the initialization sequence of reflection\n" +
|
||||||
"implementation classes unpredictable and leads to a deadlock or ExceptionInInitializerError.\n\n" +
|
"implementation classes unpredictable and leads to a deadlock or ExceptionInInitializerError.\n\n" +
|
||||||
"Please un-delegate the corresponding properties:\n\n" +
|
"Please un-delegate the corresponding properties:\n\n" +
|
||||||
badMembers.joinToString("\n"))
|
badMembers.joinToString("\n")
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun testMaxAllowedFields() {
|
fun testMaxAllowedFields() {
|
||||||
// The following classes are instantiated a lot in Kotlin applications and thus they should be optimized as best as possible.
|
// The following classes are instantiated a lot in Kotlin applications, and thus they should be optimized as good as possible.
|
||||||
// This test checks that these classes have not more fields than a predefined small number, which can usually be calculated as
|
// This test checks that these classes have not more fields than a predefined small number, which can usually be calculated as
|
||||||
// the number of constructor parameters (number of objects needed to initialize an instance) + 1 for 'data', the reflection cache.
|
// the number of constructor parameters (number of objects needed to initialize an instance) + 1 for 'data', the reflection cache.
|
||||||
val classesWithMaxAllowedFields = linkedMapOf(
|
val classesWithMaxAllowedFields = linkedMapOf(
|
||||||
|
|||||||
@@ -120,7 +120,7 @@ class SpaceCodeOwnersTest : TestCase() {
|
|||||||
// (line = 5, pattern = /some/),
|
// (line = 5, pattern = /some/),
|
||||||
// (line = 1, pattern = *)
|
// (line = 1, pattern = *)
|
||||||
// With input of parent = (line = 5, pattern = /some/) and path = /some/other
|
// With input of parent = (line = 5, pattern = /some/) and path = /some/other
|
||||||
// we only search till our parent pattern line, as other rules has lower specifity
|
// we only search till our parent pattern line, as other rules are less specific
|
||||||
for (use in this) {
|
for (use in this) {
|
||||||
if (parentMatchLine != null && use.item.line < parentMatchLine) break
|
if (parentMatchLine != null && use.item.line < parentMatchLine) break
|
||||||
if (use.rule.isMatch(path, isDirectory)) {
|
if (use.rule.isMatch(path, isDirectory)) {
|
||||||
|
|||||||
Reference in New Issue
Block a user