opencode-sonarqube 1.2.26 → 1.2.27
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 +7 -2
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -20680,13 +20680,15 @@ Fix these issues before ${operationType === "commit" ? "committing" : "pushing"}
|
|
|
20680
20680
|
return { block: false };
|
|
20681
20681
|
await loadPluginConfig();
|
|
20682
20682
|
const sonarConfig = pluginConfig?.["sonarqube"];
|
|
20683
|
+
safeLog(`[handleGitOperationCheck] sonarConfig=${JSON.stringify(sonarConfig)}`);
|
|
20683
20684
|
const config2 = loadConfig(sonarConfig);
|
|
20684
|
-
safeLog(`[handleGitOperationCheck] ${operationType}: level=${config2?.level}`);
|
|
20685
|
+
safeLog(`[handleGitOperationCheck] ${operationType}: level=${config2?.level}, blockCommit=${config2?.blockCommit}, blockPush=${config2?.blockPush}`);
|
|
20685
20686
|
if (!config2 || config2.level === "off")
|
|
20686
20687
|
return { block: false };
|
|
20687
20688
|
const { analyzeBeforeCommit = true, blockCommit = false, blockPush = false } = config2;
|
|
20688
20689
|
const { fixBeforeCommit = false, blockingSeverity = "CRITICAL", autoFix = false } = config2;
|
|
20689
20690
|
const shouldBlock = operationType === "commit" ? blockCommit : blockPush;
|
|
20691
|
+
safeLog(`[handleGitOperationCheck] shouldBlock=${shouldBlock}, blockCommit=${blockCommit}, blockPush=${blockPush}, blockingSeverity=${blockingSeverity}`);
|
|
20690
20692
|
try {
|
|
20691
20693
|
const dir = getDirectory();
|
|
20692
20694
|
const state = await getProjectState(dir);
|
|
@@ -20700,7 +20702,9 @@ Fix these issues before ${operationType === "commit" ? "committing" : "pushing"}
|
|
|
20700
20702
|
await showToast("SonarQube: Running pre-commit analysis...", "info");
|
|
20701
20703
|
const analysisResult = await runAnalysis(config2, state, { projectKey: state.projectKey }, dir);
|
|
20702
20704
|
safeLog(`[handleGitOperationCheck] qualityGate=${analysisResult.qualityGateStatus}`);
|
|
20703
|
-
|
|
20705
|
+
const result = await processAnalysisResult(analysisResult, blockingSeverity, shouldBlock, fixBeforeCommit, autoFix);
|
|
20706
|
+
safeLog(`[handleGitOperationCheck] processResult block=${result.block}, message=${result.message}`);
|
|
20707
|
+
return result;
|
|
20704
20708
|
} catch (err) {
|
|
20705
20709
|
safeLog(`[handleGitOperationCheck] ERROR: ${err instanceof Error ? err.message : String(err)}`);
|
|
20706
20710
|
return { block: false };
|
|
@@ -20843,6 +20847,7 @@ Git operation completed with changes. Consider running:
|
|
|
20843
20847
|
if (/git\s+commit\b/.test(command) && !/--amend/.test(command)) {
|
|
20844
20848
|
safeLog(`[pre-check] Detected git commit, running quality check...`);
|
|
20845
20849
|
const result = await handleGitOperationCheck(output, "commit");
|
|
20850
|
+
safeLog(`[pre-check] commit check result: block=${result.block}, message=${result.message}`);
|
|
20846
20851
|
if (result.block && args) {
|
|
20847
20852
|
args.command = `echo "\uD83D\uDEAB BLOCKED BY SONARQUBE: ${result.message || "Quality gate failed"}" && exit 1`;
|
|
20848
20853
|
safeLog(`[pre-check] Commit BLOCKED - command replaced`);
|