opencode-sonarqube 1.2.21 → 1.2.24

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/README.md CHANGED
@@ -146,7 +146,7 @@ Create `.sonarqube/config.json` in your project root:
146
146
  | `analyzeBeforeCommit` | `boolean` | `true` | Run analysis before git commit |
147
147
  | `blockCommit` | `boolean` | `false` | Block commit if blocking issues exist |
148
148
  | `blockPush` | `boolean` | `false` | Block push if blocking issues exist |
149
- | `blockingSeverity` | `"BLOCKER"` \| `"CRITICAL"` \| `"MAJOR"` | `"CRITICAL"` | Minimum severity that blocks operations |
149
+ | `blockingSeverity` | `"BLOCKER"` \| `"CRITICAL"` \| `"MAJOR"` \| `"MINOR"` \| `"INFO"` | `"CRITICAL"` | Minimum severity that blocks operations |
150
150
  | `fixBeforeCommit` | `boolean` | `false` | Attempt auto-fix before commit |
151
151
 
152
152
  ### Strictness Levels
package/dist/index.js CHANGED
@@ -4061,7 +4061,7 @@ var init_types2 = __esm(() => {
4061
4061
  analyzeBeforeCommit: exports_external2.boolean().default(true).describe("Run analysis before git commit"),
4062
4062
  blockCommit: exports_external2.boolean().default(false).describe("Block commit if BLOCKER/CRITICAL issues exist"),
4063
4063
  blockPush: exports_external2.boolean().default(false).describe("Block push if BLOCKER/CRITICAL issues exist"),
4064
- blockingSeverity: exports_external2.enum(["BLOCKER", "CRITICAL", "MAJOR"]).default("CRITICAL").describe("Minimum severity that blocks operations"),
4064
+ blockingSeverity: exports_external2.enum(["BLOCKER", "CRITICAL", "MAJOR", "MINOR", "INFO"]).default("CRITICAL").describe("Minimum severity that blocks operations"),
4065
4065
  fixBeforeCommit: exports_external2.boolean().default(false).describe("Attempt auto-fix before commit")
4066
4066
  });
4067
4067
  ProjectStateSchema = exports_external2.object({
@@ -19572,6 +19572,24 @@ async function handleSetup(config2, directory, force = false) {
19572
19572
 
19573
19573
  ${result.message}`;
19574
19574
  }
19575
+ const configPath = `${directory}/.sonarqube/config.json`;
19576
+ const configExists = await Bun.file(configPath).exists();
19577
+ if (!configExists) {
19578
+ const defaultConfig = {
19579
+ level: config2.level || "enterprise",
19580
+ autoAnalyze: true,
19581
+ autoFix: true,
19582
+ sources: config2.sources || "src",
19583
+ newCodeDefinition: "previous_version",
19584
+ analyzeBeforeCommit: true,
19585
+ blockCommit: true,
19586
+ blockPush: true,
19587
+ blockingSeverity: "CRITICAL",
19588
+ fixBeforeCommit: true
19589
+ };
19590
+ await Bun.write(configPath, JSON.stringify(defaultConfig, null, 2));
19591
+ logger7.info("Created default config.json", { path: configPath });
19592
+ }
19575
19593
  const lines = [
19576
19594
  "## SonarQube Project Initialized",
19577
19595
  "",
@@ -19584,9 +19602,12 @@ ${result.message}`;
19584
19602
  if (result.qualityGate) {
19585
19603
  lines.push(`- Quality Gate: ${result.qualityGate}`);
19586
19604
  }
19587
- lines.push("");
19588
19605
  const projectStatusMessage = result.isNewProject ? "A new project was created on your SonarQube server." : "Connected to existing project on SonarQube server.";
19589
- lines.push(projectStatusMessage, "", 'Run with action: "analyze" to start code analysis.');
19606
+ if (configExists) {
19607
+ lines.push("", projectStatusMessage, "", 'Run with action: "analyze" to start code analysis.');
19608
+ } else {
19609
+ lines.push("", "**Pre-commit blocking enabled** - commits with critical issues will be blocked.", "", projectStatusMessage, "", 'Run with action: "analyze" to start code analysis.');
19610
+ }
19590
19611
  return lines.join(`
19591
19612
  `);
19592
19613
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "opencode-sonarqube",
3
- "version": "1.2.21",
3
+ "version": "1.2.24",
4
4
  "description": "OpenCode Plugin for SonarQube integration - Enterprise-level code quality from the start",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",