hainenber commented on code in PR #44201:
URL: https://github.com/apache/superset/pull/44201#discussion_r4237365836
##########
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:
I've addressed in d5c37e2f86a93ad3beddd4f800502c4f1b3031f3
--
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]