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


##########
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:
   The new runner test returns JSON from both `execSync` mocks, so neither 
recovery branch runs; removing either branch still leaves this test green while 
a real status-1 exit stops both uploads. Could the mock throw an error with 
`status: 1` and JSON `stdout` for each pass in turn, keeping the sheet 
assertions?



-- 
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