opencode-sonarqube 1.2.21 → 1.2.25

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({
@@ -19465,6 +19465,7 @@ function createHooks(getConfig, getDirectory) {
19465
19465
 
19466
19466
  // src/tools/sonarqube.ts
19467
19467
  init_zod();
19468
+ import { mkdir } from "node:fs/promises";
19468
19469
  var logger7 = new Logger("sonarqube-tool");
19469
19470
  var SonarQubeToolArgsSchema = exports_external2.object({
19470
19471
  action: exports_external2.enum(["analyze", "issues", "newissues", "status", "init", "setup", "validate", "hotspots", "duplications", "rule", "history", "profile", "branches", "metrics", "worstfiles"]).describe("Action to perform: analyze (run scanner), issues (all issues), newissues (only new code issues), status (quality gate), init/setup (initialize), validate (enterprise check), hotspots (security review), duplications (code duplicates), rule (explain rule), history (past analyses), profile (quality profile), branches (branch status), metrics (detailed metrics), worstfiles (files with most issues)"),
@@ -19572,6 +19573,26 @@ async function handleSetup(config2, directory, force = false) {
19572
19573
 
19573
19574
  ${result.message}`;
19574
19575
  }
19576
+ const sonarqubeDir = `${directory}/.sonarqube`;
19577
+ const configPath = `${sonarqubeDir}/config.json`;
19578
+ const configExists = await Bun.file(configPath).exists();
19579
+ if (!configExists) {
19580
+ await mkdir(sonarqubeDir, { recursive: true });
19581
+ const defaultConfig = {
19582
+ level: config2.level || "enterprise",
19583
+ autoAnalyze: true,
19584
+ autoFix: true,
19585
+ sources: config2.sources || "src",
19586
+ newCodeDefinition: "previous_version",
19587
+ analyzeBeforeCommit: true,
19588
+ blockCommit: true,
19589
+ blockPush: true,
19590
+ blockingSeverity: "CRITICAL",
19591
+ fixBeforeCommit: true
19592
+ };
19593
+ await Bun.write(configPath, JSON.stringify(defaultConfig, null, 2));
19594
+ logger7.info("Created default config.json", { path: configPath });
19595
+ }
19575
19596
  const lines = [
19576
19597
  "## SonarQube Project Initialized",
19577
19598
  "",
@@ -19584,9 +19605,12 @@ ${result.message}`;
19584
19605
  if (result.qualityGate) {
19585
19606
  lines.push(`- Quality Gate: ${result.qualityGate}`);
19586
19607
  }
19587
- lines.push("");
19588
19608
  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.');
19609
+ if (configExists) {
19610
+ lines.push("", projectStatusMessage, "", 'Run with action: "analyze" to start code analysis.');
19611
+ } else {
19612
+ lines.push("", "**Pre-commit blocking enabled** - commits with critical issues will be blocked.", "", projectStatusMessage, "", 'Run with action: "analyze" to start code analysis.');
19613
+ }
19590
19614
  return lines.join(`
19591
19615
  `);
19592
19616
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "opencode-sonarqube",
3
- "version": "1.2.21",
3
+ "version": "1.2.25",
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",