opencode-sonarqube 1.2.30 → 1.2.31
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +19 -5
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -20682,13 +20682,28 @@ Fix these issues before ${operationType === "commit" ? "committing" : "pushing"}
|
|
|
20682
20682
|
const handleGitOperationCheck = async (output, operationType) => {
|
|
20683
20683
|
const args = output.args;
|
|
20684
20684
|
const command = args?.command ?? "";
|
|
20685
|
+
const workdir = args?.workdir;
|
|
20685
20686
|
const isMatch = operationType === "commit" ? isGitCommit(command) : isGitPush(command);
|
|
20686
20687
|
if (!isMatch)
|
|
20687
20688
|
return { block: false };
|
|
20688
|
-
|
|
20689
|
-
|
|
20690
|
-
|
|
20691
|
-
|
|
20689
|
+
const dir = workdir || getDirectory();
|
|
20690
|
+
safeLog(`[handleGitOperationCheck] workdir=${workdir}, resolved dir=${dir}`);
|
|
20691
|
+
const targetConfigPath = `${dir}/.sonarqube/config.json`;
|
|
20692
|
+
let targetConfig;
|
|
20693
|
+
try {
|
|
20694
|
+
const configFile = Bun.file(targetConfigPath);
|
|
20695
|
+
if (await configFile.exists()) {
|
|
20696
|
+
targetConfig = await configFile.json();
|
|
20697
|
+
safeLog(`[handleGitOperationCheck] Loaded config from ${targetConfigPath}`);
|
|
20698
|
+
}
|
|
20699
|
+
} catch {}
|
|
20700
|
+
if (!targetConfig) {
|
|
20701
|
+
await loadPluginConfig();
|
|
20702
|
+
targetConfig = pluginConfig?.["sonarqube"];
|
|
20703
|
+
safeLog(`[handleGitOperationCheck] Using plugin config (no target config found)`);
|
|
20704
|
+
}
|
|
20705
|
+
safeLog(`[handleGitOperationCheck] targetConfig=${JSON.stringify(targetConfig)}`);
|
|
20706
|
+
const config2 = loadConfig(targetConfig);
|
|
20692
20707
|
safeLog(`[handleGitOperationCheck] ${operationType}: level=${config2?.level}, blockCommit=${config2?.blockCommit}, blockPush=${config2?.blockPush}`);
|
|
20693
20708
|
if (!config2 || config2.level === "off")
|
|
20694
20709
|
return { block: false };
|
|
@@ -20697,7 +20712,6 @@ Fix these issues before ${operationType === "commit" ? "committing" : "pushing"}
|
|
|
20697
20712
|
const shouldBlock = operationType === "commit" ? blockCommit : blockPush;
|
|
20698
20713
|
safeLog(`[handleGitOperationCheck] shouldBlock=${shouldBlock}, blockCommit=${blockCommit}, blockPush=${blockPush}, blockingSeverity=${blockingSeverity}`);
|
|
20699
20714
|
try {
|
|
20700
|
-
const dir = getDirectory();
|
|
20701
20715
|
const state = await getProjectState(dir);
|
|
20702
20716
|
safeLog(`[handleGitOperationCheck] dir=${dir}, projectKey=${state?.projectKey ?? "NONE"}`);
|
|
20703
20717
|
if (!state?.projectKey)
|