opencode-sonarqube 1.2.16 → 1.2.17

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.
Files changed (2) hide show
  1. package/dist/index.js +35 -6
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -18056,6 +18056,14 @@ class DuplicationsAPI {
18056
18056
  }
18057
18057
  }
18058
18058
  // src/api/ce.ts
18059
+ import { appendFileSync } from "node:fs";
18060
+ var debugLog = (msg) => {
18061
+ try {
18062
+ appendFileSync("/tmp/sonarqube-plugin-debug.log", `${new Date().toISOString()} [ce] ${msg}
18063
+ `);
18064
+ } catch {}
18065
+ };
18066
+
18059
18067
  class ComputeEngineAPI {
18060
18068
  client;
18061
18069
  logger;
@@ -18118,21 +18126,39 @@ class ComputeEngineAPI {
18118
18126
  const { current, queue } = await this.getComponentTasks(componentKey);
18119
18127
  return current !== undefined || queue.length > 0;
18120
18128
  }
18121
- async waitForTask(taskId, pollIntervalMs = 2000) {
18129
+ async waitForTask(taskId, pollIntervalMs = 2000, maxWaitMs = 300000) {
18122
18130
  this.logger.info(`Waiting for task to complete: ${taskId}`);
18123
- while (true) {
18131
+ const startTime = Date.now();
18132
+ let taskNotFoundRetries = 0;
18133
+ const maxTaskNotFoundRetries = 10;
18134
+ debugLog(`waitForTask: starting for ${taskId}`);
18135
+ while (Date.now() - startTime < maxWaitMs) {
18124
18136
  const task = await this.getTask(taskId);
18125
18137
  if (!task) {
18126
- this.logger.warn(`Task ${taskId} not found`);
18127
- return;
18138
+ taskNotFoundRetries++;
18139
+ debugLog(`waitForTask: task not found, retry ${taskNotFoundRetries}/${maxTaskNotFoundRetries}`);
18140
+ if (taskNotFoundRetries >= maxTaskNotFoundRetries) {
18141
+ this.logger.warn(`Task ${taskId} not found after ${maxTaskNotFoundRetries} retries`);
18142
+ debugLog(`waitForTask: giving up after ${maxTaskNotFoundRetries} retries`);
18143
+ return;
18144
+ }
18145
+ this.logger.debug(`Task ${taskId} not found yet, retrying (${taskNotFoundRetries}/${maxTaskNotFoundRetries})...`);
18146
+ await new Promise((resolve) => setTimeout(resolve, pollIntervalMs));
18147
+ continue;
18128
18148
  }
18149
+ taskNotFoundRetries = 0;
18150
+ debugLog(`waitForTask: task found, status=${task.status}`);
18129
18151
  if (task.status === "SUCCESS" || task.status === "FAILED" || task.status === "CANCELED") {
18130
18152
  this.logger.info(`Task completed with status: ${task.status}`);
18153
+ debugLog(`waitForTask: task completed with ${task.status}`);
18131
18154
  return task;
18132
18155
  }
18133
18156
  this.logger.debug(`Task in progress: ${task.status}`);
18134
18157
  await new Promise((resolve) => setTimeout(resolve, pollIntervalMs));
18135
18158
  }
18159
+ this.logger.warn(`Timeout waiting for task ${taskId}`);
18160
+ debugLog(`waitForTask: timeout after ${maxWaitMs}ms`);
18161
+ return;
18136
18162
  }
18137
18163
  async waitForAnalysis(componentKey, timeoutMs = 300000, pollIntervalMs = 2000) {
18138
18164
  this.logger.info(`Waiting for analysis to complete: ${componentKey}`);
@@ -20045,7 +20071,7 @@ function getSeveritiesFromLevel(level) {
20045
20071
  }
20046
20072
 
20047
20073
  // src/index.ts
20048
- import { readFileSync, writeFileSync } from "node:fs";
20074
+ import { readFileSync, writeFileSync, appendFileSync as appendFileSync2 } from "node:fs";
20049
20075
 
20050
20076
  // src/cli.ts
20051
20077
  var CLI_HELP = `
@@ -20265,7 +20291,10 @@ function shouldIgnoreFile2(filePath) {
20265
20291
  return IGNORED_FILE_PATTERNS2.some((pattern) => pattern.test(filePath));
20266
20292
  }
20267
20293
  var SonarQubePlugin = async ({ client, directory, worktree }) => {
20268
- const safeLog = (_msg) => {};
20294
+ const safeLog = (msg) => {
20295
+ appendFileSync2("/tmp/sonarqube-plugin-debug.log", `${new Date().toISOString()} ${msg}
20296
+ `);
20297
+ };
20269
20298
  const pluginImportUrl = import.meta.url;
20270
20299
  const resolveDirectoryFromImportUrl = () => {
20271
20300
  try {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "opencode-sonarqube",
3
- "version": "1.2.16",
3
+ "version": "1.2.17",
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",