QD-10214 Fix order of including yamls into parent one

(cherry picked from commit b287fa8789025982b450994e04d3526db11356d7)

IJ-CR-148920

GitOrigin-RevId: b5257aa5ebfc48594eea8c5def2e4cf1ea1c9bf2
This commit is contained in:
alexey.afanasiev
2024-11-06 00:06:09 +01:00
committed by intellij-monorepo-bot
parent 670145195c
commit 865f1aa38e
3 changed files with 7 additions and 2 deletions

View File

@@ -64,7 +64,11 @@ private val FIELDS_TO_MERGE = setOf("groups", "inspections")
private fun readRaw(reader: Reader, includeReaders: (Path) -> Reader): Map<String, *> {
val yamlReader = Yaml()
val rawConfig: Map<String, *> = yamlReader.load(reader)
val includedConfigs = (rawConfig["include"] as? List<*>)?.filterIsInstance(String::class.java).orEmpty().map { Paths.get(it) }
val includedConfigs = (rawConfig["include"] as? List<*>)
?.filterIsInstance<String>()
.orEmpty()
.map { Paths.get(it) }
.asReversed() // Values from included placed at the beginning of config. So the first in the list should be added last to keep order.
return includedConfigs.fold(rawConfig) { accumulator, path ->
val includedYaml = includeReaders.invoke(path).use { includeReader ->

View File

@@ -2,4 +2,5 @@ $schema: https://json.schemastore.org/idea-inspection-profile-1.0.json
inspections:
- inspection: TodoComment
enabled: false
severity: INFO

View File

@@ -1,6 +1,6 @@
<profile version="1.0">
<option name="myName" value="Chained profile" />
<inspection_tool class="TodoComment" enabled="true" level="INFO" enabled_by_default="true">
<inspection_tool class="TodoComment" enabled="false" level="INFO" enabled_by_default="true">
<scope name="file:Main.*" level="INFO" enabled="true" />
<scope name="file:*.*" level="INFO" enabled="false" />
</inspection_tool>