Skip to content

Commit da83ebb

Browse files
authored
Merge branch 'master' into pass_danger_js_path
2 parents 543e625 + 2a4b27e commit da83ebb

File tree

12 files changed

+2160
-21
lines changed

12 files changed

+2160
-21
lines changed

CHANGELOG.md

+7-2
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,16 @@
1111
1212
-->
1313
## Master
14-
- Update Kotlin to 1.4.10 [@gianluz] [#140](https://github.com/danger/kotlin/pull/140)
15-
- Migrate from moshi to kotlinx serialization [@gianluz] [#141] (https://github.com/danger/kotlin/pull/141)
14+
- Update Kotlin to 1.4.10 [@gianluz] - [#140](https://github.com/danger/kotlin/pull/140)
15+
- Migrate from moshi to kotlinx serialization [@gianluz] - [#141](https://github.com/danger/kotlin/pull/141)
1616
- Fix incorrect url in install.sh script and in Dockerfile [@davidbilik] - [#144](https://github.com/danger/kotlin/pull/144)
1717
- Road to 1.0 - Refactor project structure [@gianluz] - [#142](https://github.com/danger/kotlin/pull/142)
1818
- Handle danger-js custom paths with parameter `--danger-js-path` [@f-meloni] - [#153](https://github.com/danger/kotlin/pull/153)
19+
- Update Kotlin to 1.4.20 [@gianluz] - [#148](https://github.com/danger/kotlin/pull/148)
20+
- Fix gitlab defaults following kotlinx serialisation [@gianluz] - [#146](https://github.com/danger/kotlin/pull/146)
21+
- Road to 1.0 - Migrate from java.util.Date to kotlinx.datetime [@gianluz] - [#147](https://github.com/danger/kotlin/pull/147)
22+
- Fix typo in Github Milestone serialization [@doodeec] - [#151](https://github.com/danger/kotlin/pull/151)
23+
- Use fixed commit of danger/kotlin repository in install.sh script [@davidbilik]- [#152](https://github.com/danger/kotlin/pull/152)
1924

2025
# 0.7.1
2126

Dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ RUN curl -sL https://deb.nodesource.com/setup_10.x | bash - && \
1515
# Install danger-kotlin globally
1616
COPY . /usr/local/_danger-kotlin
1717
RUN cd /usr/lib && \
18-
wget -q https://github.com/JetBrains/kotlin/releases/download/v1.4.10/kotlin-compiler-1.4.10.zip && \
18+
wget -q https://github.com/JetBrains/kotlin/releases/download/v1.4.20/kotlin-compiler-1.4.20.zip && \
1919
unzip kotlin-compiler-*.zip && \
2020
rm kotlin-compiler-*.zip && \
2121
cd /usr/local/_danger-kotlin && \

danger-kotlin-library/src/main/kotlin/systems/danger/kotlin/models/git/Git.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ data class GitCommit(
3535
val author: GitCommitAuthor,
3636
val committer: GitCommitAuthor,
3737
val message: String,
38-
val parents: List<String>? = null,
38+
val parents: List<String> = listOf(),
3939
val url: String
4040
)
4141

danger-kotlin-library/src/main/kotlin/systems/danger/kotlin/models/github/GitHub.kt

+2-2
Original file line numberDiff line numberDiff line change
@@ -302,8 +302,8 @@ data class GitHubUser(
302302

303303
@Serializable
304304
enum class GitHubMilestoneState {
305-
@SerialName("close")
306-
CLOSE,
305+
@SerialName("closed")
306+
CLOSED,
307307

308308
@SerialName("open")
309309
OPEN,

danger-kotlin-library/src/main/kotlin/systems/danger/kotlin/models/gitlab/GitLab.kt

+8-8
Original file line numberDiff line numberDiff line change
@@ -38,15 +38,15 @@ data class GitLabMergeRequest(
3838
@SerialName("allow_maintainer_to_push")
3939
val allowMaintainerToPush: Boolean = false,
4040
@SerialName("approvals_before_merge")
41-
val approvalsBeforeMerge: Int?,
42-
val assignee: GitLabUser?,
41+
val approvalsBeforeMerge: Int = 0,
42+
val assignee: GitLabUser? = null,
4343
val author: GitLabUser,
4444
@SerialName("changes_count")
4545
val changesCount: String,
4646
@SerialName("closed_at")
4747
val closedAt: Instant? = null,
4848
@SerialName("closed_by")
49-
val closedBy: GitLabUser?,
49+
val closedBy: GitLabUser? = null,
5050
val description: String,
5151
@SerialName("diff_refs")
5252
val diffRefs: GitLabDiffRefs,
@@ -69,7 +69,7 @@ data class GitLabMergeRequest(
6969
@SerialName("merged_at")
7070
val mergedAt: Instant? = null,
7171
@SerialName("merged_by")
72-
val mergedBy: GitLabUser?,
72+
val mergedBy: GitLabUser? = null,
7373
@SerialName("merge_when_pipeline_succeeds")
7474
val mergeOnPipelineSuccess: Boolean,
7575
val milestone: GitLabMilestone? = null,
@@ -78,7 +78,7 @@ data class GitLabMergeRequest(
7878
val projectId: String,
7979
val sha: String,
8080
@SerialName("should_remove_source_branch")
81-
val shouldRemoveSourceBranch: Boolean? = null,
81+
val shouldRemoveSourceBranch: Boolean? = false,
8282
@SerialName("source_branch")
8383
val sourceBranch: String,
8484
@SerialName("source_project_id")
@@ -108,9 +108,9 @@ data class GitLabMergeRequest(
108108
@Serializable
109109
data class GitLabMergeRequestTimeStats(
110110
@SerialName("human_time_estimate")
111-
val humanTimeEstimate: Int?,
111+
val humanTimeEstimate: Int = 0,
112112
@SerialName("human_time_spent")
113-
val humanTimeSpent: Int?,
113+
val humanTimeSpent: Int = 0,
114114
@SerialName("time_estimate")
115115
val timeEstimate: Int,
116116
@SerialName("total_time_spent")
@@ -202,7 +202,7 @@ enum class GitLabPipelineStatus {
202202
@Serializable
203203
data class GitLabUser(
204204
@SerialName("avatar_url")
205-
val avatarUrl: String?,
205+
val avatarUrl: String? = null,
206206
val id: Int,
207207
val name: String,
208208
val state: GitLabUserState,

danger-kotlin-library/src/test/kotlin/systems/danger/kotlin/KtxGitTest.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ internal class GitKtxTest {
3535
author = GitCommitAuthor("John Doe", "john@doe.com", "now"),
3636
committer = GitCommitAuthor("John Doe", "john@doe.com", "now"),
3737
message = "Random message",
38-
parents = null,
38+
parents = listOf(),
3939
url = ""
4040
)
4141
)

danger-kotlin-library/src/test/kotlin/systems/danger/kotlin/models/github/GitHubParsingTests.kt

+14-1
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ class GitHubParsingTests {
121121
expectedGitAuthor,
122122
expectedGitCommitter,
123123
"[Xcode] Updates for compatibility with Xcode 7.3.1.",
124-
null,
124+
listOf(),
125125
"https://api.github.com/repos/artsy/eidolon/git/commits/93ae30cf2aee4241c442fb3242543490998cffdb"
126126
)
127127
val expectedGitHubCommit = GitHubCommit(
@@ -210,6 +210,19 @@ class GitHubParsingTests {
210210
}
211211
}
212212

213+
@Test
214+
fun testItParsesTheClosedMilestone() {
215+
val dsl: DSL = Json {
216+
ignoreUnknownKeys = true
217+
isLenient = true
218+
}.decodeFromString(JSONFiles.githubWithClosedMilestoneDangerJSON)
219+
val github = dsl.danger.github
220+
221+
with(github.issue.milestone!!) {
222+
assertEquals(GitHubMilestoneState.CLOSED, state)
223+
}
224+
}
225+
213226
@Test
214227
fun testOnGitHubIsTrue() {
215228
assertEquals(true, dsl.danger.onGitHub)

danger-kotlin-library/src/test/kotlin/systems/danger/kotlin/utils/TestUtils.kt

+5
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,11 @@ object TestUtils {
1919
val githubWithSomeNullsAttributeDangerJSON by lazy {
2020
loadJSON("githubWithSomeNullsAttributeDangerJSON.json")
2121
}
22+
23+
val githubWithClosedMilestoneDangerJSON by lazy {
24+
loadJSON("githubWithClosedMilestoneDangerJSON.json")
25+
}
26+
2227
val dangerBitBucketServerJSON by lazy {
2328
loadJSON("bitbucketServerDangerJSON.json")
2429
}

0 commit comments

Comments
 (0)