Skip to content

Commit ffe47b6

Browse files
committed
Revert "fix(fossid-webapp): Deduplicate and normalize ignore rules"
This reverts commit 31da20b as the solution didn't work and the error is still present. Signed-off-by: Nicolas Nobelis <[email protected]>
1 parent ec1e692 commit ffe47b6

File tree

2 files changed

+1
-99
lines changed

2 files changed

+1
-99
lines changed

plugins/scanners/fossid/src/main/kotlin/events/CloneRepositoryHandler.kt

Lines changed: 1 addition & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -150,9 +150,7 @@ class CloneRepositoryHandler(val config: FossIdConfig, val service: FossIdServic
150150
}
151151

152152
val allRules = excludesRules + legacyRules
153-
154-
val normalizedRules = deduplicateAndNormalizeIgnoreRules(allRules)
155-
normalizedRules.forEach {
153+
allRules.forEach {
156154
service.createIgnoreRule(
157155
config.user.value,
158156
config.apiKey.value,
@@ -210,26 +208,3 @@ class CloneRepositoryHandler(val config: FossIdConfig, val service: FossIdServic
210208
logger.info { "Data download has been completed." }
211209
}
212210
}
213-
214-
/**
215-
* Deduplicate and normalize ignore rules [allRules] by removing duplicate directory, file and extension rules,
216-
* and by stripping the trailing slash and asterisk from directory rule values.
217-
*/
218-
internal fun deduplicateAndNormalizeIgnoreRules(allRules: List<IgnoreRule>): List<IgnoreRule> {
219-
val normalizedIgnoredDirs = allRules
220-
.filter { it.type == RuleType.DIRECTORY }
221-
.map { it.copy(value = it.value.removeSuffix("/*")) }
222-
.distinctBy { it.value }
223-
224-
val normalizedIgnoredFiles = allRules
225-
.filter { it.type == RuleType.FILE }
226-
.distinctBy { it.value }
227-
228-
val normalizedIgnoredExtensions = allRules
229-
.filter { it.type == RuleType.EXTENSION }
230-
.distinctBy { it.value }
231-
232-
val normalizedRules = normalizedIgnoredDirs + normalizedIgnoredFiles + normalizedIgnoredExtensions
233-
234-
return normalizedRules
235-
}

plugins/scanners/fossid/src/test/kotlin/events/CloneRepositoryHandlerTest.kt

Lines changed: 0 additions & 73 deletions
This file was deleted.

0 commit comments

Comments
 (0)