From 865f1aa38e725955b1499b1957030d5a54d11dbe Mon Sep 17 00:00:00 2001 From: "alexey.afanasiev" Date: Wed, 6 Nov 2024 00:06:09 +0100 Subject: [PATCH] QD-10214 Fix order of including yamls into parent one (cherry picked from commit b287fa8789025982b450994e04d3526db11356d7) IJ-CR-148920 GitOrigin-RevId: b5257aa5ebfc48594eea8c5def2e4cf1ea1c9bf2 --- .../inspectionProfile/YamlInspectionProfileRaw.kt | 6 +++++- platform/inspect/testData/chainedInclude/top/second.yml | 1 + platform/inspect/testData/chainedInclude_profile.xml | 2 +- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/platform/inspect/src/com/intellij/codeInspection/inspectionProfile/YamlInspectionProfileRaw.kt b/platform/inspect/src/com/intellij/codeInspection/inspectionProfile/YamlInspectionProfileRaw.kt index 3da32a4fab50..5e037553c673 100644 --- a/platform/inspect/src/com/intellij/codeInspection/inspectionProfile/YamlInspectionProfileRaw.kt +++ b/platform/inspect/src/com/intellij/codeInspection/inspectionProfile/YamlInspectionProfileRaw.kt @@ -64,7 +64,11 @@ private val FIELDS_TO_MERGE = setOf("groups", "inspections") private fun readRaw(reader: Reader, includeReaders: (Path) -> Reader): Map { val yamlReader = Yaml() val rawConfig: Map = 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() + .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 -> diff --git a/platform/inspect/testData/chainedInclude/top/second.yml b/platform/inspect/testData/chainedInclude/top/second.yml index effbcec9708d..aa2c80555d42 100644 --- a/platform/inspect/testData/chainedInclude/top/second.yml +++ b/platform/inspect/testData/chainedInclude/top/second.yml @@ -2,4 +2,5 @@ $schema: https://json.schemastore.org/idea-inspection-profile-1.0.json inspections: - inspection: TodoComment + enabled: false severity: INFO \ No newline at end of file diff --git a/platform/inspect/testData/chainedInclude_profile.xml b/platform/inspect/testData/chainedInclude_profile.xml index 0b373b7339d4..d635de7af720 100644 --- a/platform/inspect/testData/chainedInclude_profile.xml +++ b/platform/inspect/testData/chainedInclude_profile.xml @@ -1,6 +1,6 @@