Skip to content

Commit

Permalink
Merge pull request #245 from 417-72KI/accessors-for-messages
Browse files Browse the repository at this point in the history
  • Loading branch information
417-72KI authored Jan 15, 2023
2 parents 53dcfb4 + dc86ee2 commit 7a97de8
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 0 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
## Master
- Update README.md with guidance to enable auto-complete in Android Studio [@gianluz] - [#242](https://github.com/danger/kotlin/pull/242)
- Update install script with Kotlin compiler 1.7.0 [@gianluz] - [#241](https://github.com/danger/kotlin/pull/241)
- Add accessors for Danger reports [@417-72KI] - [#245](https://github.com/danger/kotlin/pull/245)

# 1.2.0
- Update `Kotlin` to `1.7.0` and added support for Apple Silicon Chipset [@gianluz] - [#231](https://github.com/danger/kotlin/pull/231)
Expand Down Expand Up @@ -97,3 +98,4 @@
[@tegorov]: https://github.com/tegorov
[@rojanthomas]: https://github.com/rojanthomas
[@eygraber]: https://github.com/eygraber
[@417-72KI]: https://github.com/417-72KI
4 changes: 4 additions & 0 deletions Dangerfile_ci.df.kts
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,10 @@ danger(args) {
val runningTime = after.minus(before)
@OptIn(kotlin.time.ExperimentalTime::class)
message("Coroutines checks terminated - runningFor $runningTime")

if ((fails + warnings).isEmpty()) {
message(":rocket: No errors or warnings!")
}
}

suspend fun DangerDSL.expensiveCheck(name: String, runForMillis: Long) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package systems.danger.kotlin

import systems.danger.kotlin.models.danger.DangerDSL
import systems.danger.kotlin.models.git.FilePath
import systems.danger.kotlin.sdk.Violation

internal var dangerRunner: MainDangerRunner? = null

Expand Down Expand Up @@ -133,3 +134,19 @@ fun fail(message: String, file: FilePath, line: Int) =
*/
fun suggest(code: String, file: FilePath, line: Int) =
runnerInstance.suggest(code, file, line)

/** Fails on the Danger report */
val fails: List<Violation>
get() = runnerInstance.fails.toList()

/** Warnings on the Danger report */
val warnings: List<Violation>
get() = runnerInstance.warnings.toList()

/** Messages on the Danger report */
val messages: List<Violation>
get() = runnerInstance.messages.toList()

/** Markdowns on the Danger report */
val markdowns: List<Violation>
get() = runnerInstance.markdowns.toList()

0 comments on commit 7a97de8

Please sign in to comment.