Skip to content

Commit 243a899

Browse files
committed
👾 Release 0.1.1
1 parent 23626ed commit 243a899

6 files changed

Lines changed: 44 additions & 23 deletions

File tree

ReleaseNotes.md

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,22 @@
11
# Omni Reporter Commons Release Notes
22

3-
#### Release 0.1.1 - Upcoming
3+
4+
#### Release 0.1.2 - Upcoming
5+
6+
###### Features
47

58
1. ~~Reports in the same folder are merged and average, (We assume thart if there are different reports in the same folder, it only means that there are different brands in there.)~~ Unfortunately, by doing so, the results may become inconsistent for reports that do not report coverage for certain files. Please make sure not to have different report brands (i.e. Clover and LCov together) for the same files. In that case, line coverage will be reported duplicate.
69
2. Exclude report option (Since the above, may be difficult to manage in some situations, we can then use this option to exclude a report that for some reason we don't want to consider for the overall coverage calculation)
710
3. Support for Group Coverage with Branch Coverage (mostly Coveralls)
811
4. Source encoding gets automatically chosen unless we configure flag `failOnNoEncoding` to `true`
912

13+
#### Release 0.1.1 - 2022/01/31
14+
15+
###### Bugs
16+
17+
1. Fix Reporting sending of test report files by default with `ignoreTestBuildDirectory`
18+
2. Fix Codacy not including TSX in TypeScript reports
19+
1020
#### Release 0.1.0 - 2022/01/30
1121

1222
###### Features

pom.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
<groupId>org.jesperancinha.plugins</groupId>
88
<artifactId>omni-coveragereporter-commons</artifactId>
9-
<version>0.1.0</version>
9+
<version>0.1.1</version>
1010

1111
<packaging>jar</packaging>
1212

@@ -36,7 +36,7 @@
3636
<connection>scm:git:git://github.com/JEsperancinhaOrg.git</connection>
3737
<developerConnection>scm:git:git://github.com/JEsperancinhaOrg.git</developerConnection>
3838
<url>https://github.com/JEsperancinhaOrg/omni-reporter-commons</url>
39-
<tag>0.1.0</tag>
39+
<tag>0.1.1</tag>
4040
</scm>
4141
<distributionManagement>
4242
<snapshotRepository>

src/main/kotlin/org/jesperancinha/plugins/omni/reporter/domain/reports/OmniReportAdapters.kt

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
package org.jesperancinha.plugins.omni.reporter.domain.reports
22

3-
import org.jesperancinha.plugins.omni.reporter.LanguageNotConfiguredException
43
import org.jesperancinha.plugins.omni.reporter.domain.api.CodacyFileReport
54
import org.jesperancinha.plugins.omni.reporter.domain.api.CoverallsSourceFile
65
import org.jesperancinha.plugins.omni.reporter.domain.api.isBranch
@@ -241,10 +240,7 @@ class OmniJacocoReportFileAdapter(
241240

242241
override fun toCodacy(sourceCodeFile: SourceCodeFile, language: Language): CodacyFileReport? {
243242
val coverage = reportFile.lines.fromJacocoToCodacyCoverage
244-
return if (coverage.isEmpty() || !reportFile.name.endsWith(
245-
language.ext
246-
)
247-
) {
243+
return if (coverage.isEmpty() || language.ext.none { reportFile.name.endsWith(it) }) {
248244
null
249245
} else {
250246
CodacyFileReport(
@@ -301,7 +297,7 @@ class OmniLCovReportFileAdapter(
301297

302298
override fun toCodacy(sourceCodeFile: SourceCodeFile, language: Language): CodacyFileReport? {
303299
val coverage = reportFile.lineData.fromLCovToCodacyCoverage
304-
return if (coverage.isEmpty() || !reportFile.sourceFilePath.endsWith(language.ext)
300+
return if (coverage.isEmpty() || language.ext.none { reportFile.sourceFilePath.endsWith(it) }
305301
) {
306302
null
307303
} else {
@@ -368,7 +364,8 @@ class OmniCloverReportFileAdapter(
368364

369365
override fun toCodacy(sourceCodeFile: SourceCodeFile, language: Language): CodacyFileReport? {
370366
val coverage = reportFile.cloverLines.fromCloverToCodacyCoverage
371-
return if (coverage.isEmpty() || !reportFile.path.endsWith(language.ext)
367+
return if (coverage.isEmpty() || language.ext.none { reportFile.path
368+
.endsWith(it) }
372369
) {
373370
null
374371
} else {
@@ -436,7 +433,7 @@ class OmniCoveragePyReportFileAdapter(
436433

437434
override fun toCodacy(sourceCodeFile: SourceCodeFile, language: Language): CodacyFileReport? {
438435
val coverage = reportFile.value.fromCoveragePyToCodacyCoverage
439-
return if (coverage.isEmpty() || !reportFile.key.endsWith(language.ext)
436+
return if (coverage.isEmpty() || language.ext.none { reportFile.key.endsWith(it) }
440437
) {
441438
null
442439
} else {

src/main/kotlin/org/jesperancinha/plugins/omni/reporter/parsers/Parsers.kt

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -54,11 +54,11 @@ internal val String.toFileDigest: String
5454
.joinToString(separator = "") { byte -> "%02x".format(byte) }
5555
.uppercase()
5656

57-
enum class Language(val ext: String, val lang: String) {
58-
JAVA("java", "Java"),
59-
KOTLIN("kt", "Kotlin"),
60-
SCALA("scala", "Scala"),
61-
PYTHON("py", "Python"),
62-
JAVASCRIPT("js", "JavaScript"),
63-
TYPESCRIPT("ts", "TypeScript")
57+
enum class Language(val ext: List<String>, val lang: String) {
58+
JAVA(listOf("java"), "Java"),
59+
KOTLIN(listOf("kt"), "Kotlin"),
60+
SCALA(listOf("scala"), "Scala"),
61+
PYTHON(listOf("py"), "Python"),
62+
JAVASCRIPT(listOf("js"), "JavaScript"),
63+
TYPESCRIPT(listOf("ts", "tsx"), "TypeScript")
6464
}

src/main/kotlin/org/jesperancinha/plugins/omni/reporter/processors/Processor.kt

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,10 @@ private val CODECOV_SUPPORTED_REPORTS = arrayOf(
1818
"clover" to "xml"
1919
)
2020

21+
22+
private val KNOWN_TEST_DIRECTORIES = arrayOf(
23+
"test-classes"
24+
)
2125
private val CODECOV_UNSUPPORTED_REPORTS = arrayOf(
2226
"coverage-final" to "json"
2327
)
@@ -39,10 +43,20 @@ abstract class Processor(
3943

4044

4145
companion object {
46+
47+
val nonGenericTestDirectoryPredicate =
48+
{ report: File -> KNOWN_TEST_DIRECTORIES.none { report.absolutePath.contains(it) } }
49+
50+
51+
val nonTestDirectoryPredicate = { testDirectory: String, report: File ->
52+
(report.parentFile.absolutePath == testDirectory ||
53+
!report.absolutePath.contains(testDirectory))
54+
}
55+
4256
fun supportedPredicate(ignoreTestBuildDirectory: Boolean) =
4357
if (ignoreTestBuildDirectory) { testDirectory: String, report: File ->
44-
(report.parentFile.absolutePath == testDirectory ||
45-
!report.absolutePath.contains(testDirectory))
58+
nonGenericTestDirectoryPredicate(report) &&
59+
nonTestDirectoryPredicate(testDirectory, report)
4660
} else { _, _ -> true }
4761
}
4862
}

src/test/kotlin/org/jesperancinha/plugins/omni/reporter/processors/ProcessorKtTest.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import io.kotest.matchers.collections.shouldHaveSize
44
import io.kotest.matchers.nulls.shouldNotBeNull
55
import org.jesperancinha.plugins.omni.reporter.OmniBuild
66
import org.jesperancinha.plugins.omni.reporter.OmniProject
7-
import org.jesperancinha.plugins.omni.reporter.processors.Processor.Companion.supportedPredicate
7+
import org.jesperancinha.plugins.omni.reporter.processors.Processor.Companion.nonTestDirectoryPredicate
88
import org.junit.jupiter.api.Test
99
import java.io.File
1010
import kotlin.io.path.toPath
@@ -19,7 +19,7 @@ internal class ProcessorKtTest {
1919
val test3Folder = File(rootFolder, "test3").absolutePath
2020
val omniProject = MavenOmniProject(listOf(test3Folder), MavenOmniBuild(test3Folder, test3Folder))
2121

22-
val supportedPredicate = { _:String, _:File -> true }
22+
val supportedPredicate = { _: String, _: File -> true }
2323
val toReportFiles = listOf(omniProject).toReportFiles(supportedPredicate, false, rootFolder)
2424
toReportFiles.shouldNotBeNull()
2525
toReportFiles.entries.first().value.shouldHaveSize(1)
@@ -33,7 +33,7 @@ internal class ProcessorKtTest {
3333
val test3Folder = File(rootFolder, "test3").absolutePath
3434
val omniProject = MavenOmniProject(listOf(test3Folder), MavenOmniBuild(test3Folder, test3Folder))
3535

36-
val toReportFiles = listOf(omniProject).toReportFiles(supportedPredicate(true), false, rootFolder)
36+
val toReportFiles = listOf(omniProject).toReportFiles(nonTestDirectoryPredicate, false, rootFolder)
3737
toReportFiles.shouldNotBeNull()
3838
toReportFiles.entries.first().value.shouldHaveSize(1)
3939
}

0 commit comments

Comments
 (0)