sadpandajoe commented on code in PR #44201:
URL: https://github.com/apache/superset/pull/44201#discussion_r4171000686


##########
superset-frontend/scripts/internal/oxlint-metrics-uploader.js:
##########
@@ -120,112 +159,79 @@ async function runOxlintAndProcess() {
     // config has to be passed explicitly or the run reports oxlint's defaults
     // instead of the project's ruleset. Matches the `lint` scripts in
     // package.json.
-    const oxlintOutput = execSync(
-      'npx oxlint --config oxlint.json --format json',
-      {
+    let oxlintOutput = '{}';
+    try {
+      oxlintOutput = execSync('npx oxlint --config oxlint.json --format json', 
{
         encoding: 'utf8',
         maxBuffer: 50 * 1024 * 1024, // 50MB buffer for large outputs
         stdio: ['pipe', 'pipe', 'ignore'], // Ignore stderr to avoid error 
output
-      },
-    );
-
-    const results = JSON.parse(oxlintOutput);
-
-    // Process OXC JSON output
-    const metricsByRule = {};
-    let occurrencesData = [];
-
-    // OXC JSON format has diagnostics array
-    if (results.diagnostics && Array.isArray(results.diagnostics)) {
-      results.diagnostics.forEach(diagnostic => {
-        const ruleId = parseRuleId(diagnostic.code);
-
-        const file = diagnostic.filename || 'unknown';
-        const line = diagnostic.labels?.[0]?.span?.line || 0;
-        const column = diagnostic.labels?.[0]?.span?.column || 0;
-        const message = diagnostic.message || '';
-
-        const ruleData = metricsByRule[ruleId] || { count: 0 };
-        ruleData.count += 1;
-        metricsByRule[ruleId] = ruleData;
-
-        occurrencesData.push({
-          rule: ruleId,
-          message,
-          file,
-          line,
-          column,
-          ts: DATETIME,
-        });
       });
+    } catch (error) {
+      if (error.stdout) {
+        oxlintOutput = error.stdout.toString();

Review Comment:
   When either Oxlint pass exits with status 1 and valid JSON stdout, the 
uploader must still write both sheets; the current tests only call parser 
helpers, so removing this recovery leaves them green while `lint-stats` exits 
before uploading. Could we add a `runOxlintAndProcess` regression test that 
mocks the nonzero exit for each pass and asserts both sheet writes contain the 
diagnostics?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to