Skip to content

Commit 7a97de8

Browse files
authored
Merge pull request #245 from 417-72KI/accessors-for-messages
2 parents 53dcfb4 + dc86ee2 commit 7a97de8

File tree

3 files changed

+23
-0
lines changed

3 files changed

+23
-0
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
## Master
1414
- Update README.md with guidance to enable auto-complete in Android Studio [@gianluz] - [#242](https://github.com/danger/kotlin/pull/242)
1515
- Update install script with Kotlin compiler 1.7.0 [@gianluz] - [#241](https://github.com/danger/kotlin/pull/241)
16+
- Add accessors for Danger reports [@417-72KI] - [#245](https://github.com/danger/kotlin/pull/245)
1617

1718
# 1.2.0
1819
- Update `Kotlin` to `1.7.0` and added support for Apple Silicon Chipset [@gianluz] - [#231](https://github.com/danger/kotlin/pull/231)
@@ -97,3 +98,4 @@
9798
[@tegorov]: https://github.com/tegorov
9899
[@rojanthomas]: https://github.com/rojanthomas
99100
[@eygraber]: https://github.com/eygraber
101+
[@417-72KI]: https://github.com/417-72KI

Dangerfile_ci.df.kts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,10 @@ danger(args) {
6868
val runningTime = after.minus(before)
6969
@OptIn(kotlin.time.ExperimentalTime::class)
7070
message("Coroutines checks terminated - runningFor $runningTime")
71+
72+
if ((fails + warnings).isEmpty()) {
73+
message(":rocket: No errors or warnings!")
74+
}
7175
}
7276

7377
suspend fun DangerDSL.expensiveCheck(name: String, runForMillis: Long) {

danger-kotlin-library/src/main/kotlin/systems/danger/kotlin/MainScript.kt

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package systems.danger.kotlin
22

33
import systems.danger.kotlin.models.danger.DangerDSL
44
import systems.danger.kotlin.models.git.FilePath
5+
import systems.danger.kotlin.sdk.Violation
56

67
internal var dangerRunner: MainDangerRunner? = null
78

@@ -133,3 +134,19 @@ fun fail(message: String, file: FilePath, line: Int) =
133134
*/
134135
fun suggest(code: String, file: FilePath, line: Int) =
135136
runnerInstance.suggest(code, file, line)
137+
138+
/** Fails on the Danger report */
139+
val fails: List<Violation>
140+
get() = runnerInstance.fails.toList()
141+
142+
/** Warnings on the Danger report */
143+
val warnings: List<Violation>
144+
get() = runnerInstance.warnings.toList()
145+
146+
/** Messages on the Danger report */
147+
val messages: List<Violation>
148+
get() = runnerInstance.messages.toList()
149+
150+
/** Markdowns on the Danger report */
151+
val markdowns: List<Violation>
152+
get() = runnerInstance.markdowns.toList()

0 commit comments

Comments
 (0)