Skip to content

Commit b58c8ba

Browse files
maennchensschuberth
authored andcommitted
refactor(model): replace let { … } with also { … } in ScannerRun checks
The lambda results are unused, so `also { … }` better conveys the side‑effect–only intent. No functional changes. Signed-off-by: Jonatan Männchen <[email protected]>
1 parent f3c95a5 commit b58c8ba

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

model/src/main/kotlin/ScannerRun.kt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ data class ScannerRun(
124124
"Found a scan result with an unknown provenance, which is not allowed."
125125
}
126126

127-
(scanResult.provenance as? RepositoryProvenance)?.let { repositoryProvenance ->
127+
(scanResult.provenance as? RepositoryProvenance)?.also { repositoryProvenance ->
128128
require(repositoryProvenance.vcsInfo.path.isEmpty()) {
129129
"Found a scan result with a non-empty VCS path, which is not allowed."
130130
}
@@ -135,7 +135,7 @@ data class ScannerRun(
135135
}
136136
}
137137

138-
provenances.getDuplicates { it.id }.keys.let { idsForDuplicateProvenanceResolutionResults ->
138+
provenances.getDuplicates { it.id }.keys.also { idsForDuplicateProvenanceResolutionResults ->
139139
require(idsForDuplicateProvenanceResolutionResults.isEmpty()) {
140140
"Found multiple provenance resolution results for the following ids: " +
141141
"${idsForDuplicateProvenanceResolutionResults.joinToString { it.toCoordinates() }}."
@@ -147,23 +147,23 @@ data class ScannerRun(
147147
it.getKnownProvenancesWithoutVcsPath().values
148148
}
149149

150-
(scannedProvenances - resolvedProvenances).let {
150+
(scannedProvenances - resolvedProvenances).also {
151151
require(it.isEmpty()) {
152152
"Found scan results which do not correspond to any resolved provenances, which is not allowed: \n" +
153153
it.toYaml()
154154
}
155155
}
156156

157157
val fileListProvenances = files.mapTo(mutableSetOf()) { it.provenance }
158-
(fileListProvenances - resolvedProvenances).let {
158+
(fileListProvenances - resolvedProvenances).also {
159159
require(it.isEmpty()) {
160160
"Found a file lists which do not correspond to any resolved provenances, which is not allowed: \n" +
161161
it.toYaml()
162162
}
163163
}
164164

165165
files.forEach { fileList ->
166-
(fileList.provenance as? RepositoryProvenance)?.let {
166+
(fileList.provenance as? RepositoryProvenance)?.also {
167167
require(it.vcsInfo.path.isEmpty()) {
168168
"Found a file list with a non-empty VCS path, which is not allowed."
169169
}

0 commit comments

Comments
 (0)