mirror of
https://gitflic.ru/project/openide/openide.git
synced 2025-12-15 02:59:33 +07:00
[qodana] QD-10859 qodana yaml profile section supports profile.yaml syntax
(cherry picked from commit d784db2c51ac3e3dc84c32fda54cc774816a24d7) IJ-CR-156429 GitOrigin-RevId: 8a38559c56b168d5da6b2e371c2eed70d0e17ee2
This commit is contained in:
committed by
intellij-monorepo-bot
parent
18f567d5a3
commit
5bc7a0c95f
@@ -85,28 +85,28 @@ private class CompositeGroupProvider : InspectionGroupProvider {
|
||||
}
|
||||
|
||||
@Internal
|
||||
class YamlInspectionProfileImpl private constructor(override val profileName: String?,
|
||||
class YamlInspectionProfileImpl private constructor(
|
||||
override val profileName: String?,
|
||||
override val inspectionToolsSupplier: InspectionToolsSupplier,
|
||||
override val inspectionProfileManager: BaseInspectionProfileManager,
|
||||
override val baseProfile: InspectionProfileImpl,
|
||||
override val configurations: List<YamlBaseConfig>,
|
||||
override val groups: List<YamlInspectionGroup>,
|
||||
private val groupProvider: InspectionGroupProvider) : YamlInspectionProfile, InspectionGroupProvider {
|
||||
|
||||
private val groupProvider: InspectionGroupProvider,
|
||||
) : YamlInspectionProfile, InspectionGroupProvider {
|
||||
companion object {
|
||||
@JvmStatic
|
||||
fun loadFrom(reader: Reader,
|
||||
includeReaders: (Path) -> Reader,
|
||||
fun loadFromYamlRaw(
|
||||
yaml: YamlInspectionProfileRaw,
|
||||
baseProfile: InspectionProfileImpl,
|
||||
toolsSupplier: InspectionToolsSupplier,
|
||||
profileManager: BaseInspectionProfileManager
|
||||
): YamlInspectionProfileImpl {
|
||||
val profile = readConfig(reader, includeReaders)
|
||||
val baseProfile = findBaseProfile(profileManager, profile.baseProfile)
|
||||
val configurations = profile.inspections.map(::createInspectionConfig)
|
||||
val configurations = yaml.inspections.map(::createInspectionConfig)
|
||||
val groupProvider = CompositeGroupProvider()
|
||||
groupProvider.addProvider(InspectionGroupProviderEP.createDynamicGroupProvider())
|
||||
|
||||
val groups = profile.groups.map { group -> createGroup(groupProvider, group) }
|
||||
val groups = yaml.groups.map { group -> createGroup(groupProvider, group) }
|
||||
val customGroupProvider = object : InspectionGroupProvider {
|
||||
val groupMap = groups.associateBy { group -> group.groupId }
|
||||
override fun findGroup(groupId: String): YamlInspectionGroup? {
|
||||
@@ -116,7 +116,7 @@ class YamlInspectionProfileImpl private constructor(override val profileName: St
|
||||
groupProvider.addProvider(customGroupProvider)
|
||||
|
||||
return YamlInspectionProfileImpl(
|
||||
profile.name,
|
||||
yaml.name,
|
||||
toolsSupplier,
|
||||
profileManager,
|
||||
baseProfile,
|
||||
@@ -125,6 +125,17 @@ class YamlInspectionProfileImpl private constructor(override val profileName: St
|
||||
groupProvider)
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
fun loadFrom(reader: Reader,
|
||||
includeReaders: (Path) -> Reader,
|
||||
toolsSupplier: InspectionToolsSupplier,
|
||||
profileManager: BaseInspectionProfileManager
|
||||
): YamlInspectionProfileImpl {
|
||||
val profile = readConfig(reader, includeReaders)
|
||||
val baseProfile = findBaseProfile(profileManager, profile.baseProfile)
|
||||
return loadFromYamlRaw(profile, baseProfile, toolsSupplier, profileManager)
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
fun loadFrom(project: Project,
|
||||
filePath: String = "${getDefaultProfileDirectory(project)}/profile.yaml",
|
||||
|
||||
@@ -2,12 +2,14 @@
|
||||
package com.intellij.codeInspection.inspectionProfile
|
||||
|
||||
import com.intellij.codeInspection.inspectionProfile.YamlProfileUtils.makeYaml
|
||||
import org.jetbrains.annotations.ApiStatus
|
||||
import org.yaml.snakeyaml.Yaml
|
||||
import java.io.Reader
|
||||
import java.nio.file.Path
|
||||
import java.nio.file.Paths
|
||||
|
||||
internal class YamlInspectionProfileRaw(
|
||||
@ApiStatus.Internal
|
||||
class YamlInspectionProfileRaw(
|
||||
val baseProfile: String? = null,
|
||||
val name: String? = null,
|
||||
val groups: List<YamlInspectionGroupRaw> = emptyList(),
|
||||
@@ -19,13 +21,15 @@ internal class YamlInspectionProfileRaw(
|
||||
}
|
||||
}
|
||||
|
||||
internal class YamlInspectionGroupRaw(
|
||||
@ApiStatus.Internal
|
||||
class YamlInspectionGroupRaw(
|
||||
val groupId: String = "Unknown",
|
||||
val inspections: List<String> = emptyList(),
|
||||
val groups: List<String> = emptyList()
|
||||
)
|
||||
|
||||
internal class YamlInspectionConfigRaw(
|
||||
@ApiStatus.Internal
|
||||
class YamlInspectionConfigRaw(
|
||||
val inspection: String? = null,
|
||||
val group: String? = null,
|
||||
val enabled: Boolean? = null,
|
||||
|
||||
Reference in New Issue
Block a user