mirror of
https://gitflic.ru/project/openide/openide.git
synced 2025-12-14 18:05:27 +07:00
[hardcoded-passwords] QD-8998 provide custom configuration to HardcodedPasswords from qodana yaml
(cherry picked from commit 78721044fad224d56dd3439c577bffd0098ff8a8) IJ-CR-139669 GitOrigin-RevId: 1cc78b4bf95df3c1aa87d102a4a9a39721acb9cf
This commit is contained in:
committed by
intellij-monorepo-bot
parent
10f9b09d83
commit
3268d0564f
@@ -10,8 +10,6 @@ import org.jetbrains.annotations.NotNull;
|
|||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
import org.yaml.snakeyaml.parser.ParserException;
|
import org.yaml.snakeyaml.parser.ParserException;
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
|
|
||||||
public abstract class InspectionProfileLoaderBase<T extends InspectionProfileImpl> implements InspectionProfileLoader<T> {
|
public abstract class InspectionProfileLoaderBase<T extends InspectionProfileImpl> implements InspectionProfileLoader<T> {
|
||||||
protected Project project;
|
protected Project project;
|
||||||
|
|
||||||
@@ -26,9 +24,6 @@ public abstract class InspectionProfileLoaderBase<T extends InspectionProfileImp
|
|||||||
if (!YamlInspectionProfileImpl.isYamlFile(profilePath)) {
|
if (!YamlInspectionProfileImpl.isYamlFile(profilePath)) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
if (!new File(profilePath).isFile()) {
|
|
||||||
throw new InspectionApplicationException("Inspection profile '" + profilePath + "' does not exist");
|
|
||||||
}
|
|
||||||
try {
|
try {
|
||||||
return YamlInspectionProfileImpl.loadFrom(project, profilePath, inspectionToolsSupplier, profileManager).buildEffectiveProfile();
|
return YamlInspectionProfileImpl.loadFrom(project, profilePath, inspectionToolsSupplier, profileManager).buildEffectiveProfile();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import com.intellij.codeInspection.ex.*
|
|||||||
import com.intellij.codeInspection.inspectionProfile.YamlProfileUtils.createProfileCopy
|
import com.intellij.codeInspection.inspectionProfile.YamlProfileUtils.createProfileCopy
|
||||||
import com.intellij.openapi.diagnostic.logger
|
import com.intellij.openapi.diagnostic.logger
|
||||||
import com.intellij.openapi.project.Project
|
import com.intellij.openapi.project.Project
|
||||||
|
import com.intellij.openapi.project.guessProjectDir
|
||||||
import com.intellij.openapi.util.io.toCanonicalPath
|
import com.intellij.openapi.util.io.toCanonicalPath
|
||||||
import com.intellij.openapi.vfs.VfsUtilCore
|
import com.intellij.openapi.vfs.VfsUtilCore
|
||||||
import com.intellij.openapi.vfs.VirtualFile
|
import com.intellij.openapi.vfs.VirtualFile
|
||||||
@@ -119,8 +120,13 @@ class YamlInspectionProfileImpl private constructor(override val profileName: St
|
|||||||
toolsSupplier: InspectionToolsSupplier = ProjectInspectionToolRegistrar.getInstance(project),
|
toolsSupplier: InspectionToolsSupplier = ProjectInspectionToolRegistrar.getInstance(project),
|
||||||
profileManager: BaseInspectionProfileManager = ProjectInspectionProfileManager.getInstance(project)
|
profileManager: BaseInspectionProfileManager = ProjectInspectionProfileManager.getInstance(project)
|
||||||
): YamlInspectionProfileImpl {
|
): YamlInspectionProfileImpl {
|
||||||
val configFile = File(filePath).absoluteFile
|
val configFile = if (File(filePath).isAbsolute) {
|
||||||
require(configFile.exists()) { "File does not exist: ${configFile.canonicalPath}" }
|
File(filePath).absoluteFile
|
||||||
|
} else {
|
||||||
|
project.guessProjectDir()?.toNioPath()?.toFile()?.resolve(filePath)?.absoluteFile
|
||||||
|
}
|
||||||
|
require(configFile?.exists() == true) { "File does not exist: ${configFile!!.canonicalPath}" }
|
||||||
|
requireNotNull(configFile)
|
||||||
|
|
||||||
val includeProvider: (Path) -> Reader = {
|
val includeProvider: (Path) -> Reader = {
|
||||||
val includePath = Path.of(configFile.parent).resolve(it)
|
val includePath = Path.of(configFile.parent).resolve(it)
|
||||||
|
|||||||
Reference in New Issue
Block a user