Chore: remove betterer:json script (#98618)

* Chore: remove betterer:json script

* codeowners
pull/98619/head^2
Josh Hunt 6 months ago committed by GitHub
parent b7809b7350
commit 7c596bb4ed
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 7423
      .betterer.results.json
  2. 1
      .github/CODEOWNERS
  3. 1
      package.json
  4. 53
      scripts/cli/bettererResultsToJson.ts

File diff suppressed because it is too large Load Diff

@ -631,7 +631,6 @@ playwright.config.ts @grafana/plugins-platform-frontend
.pa11yci.conf.js @grafana/grafana-frontend-platform
.pa11yci-pr.conf.js @grafana/grafana-frontend-platform
.betterer.results @grafanabot
.betterer.results.json @grafanabot
.betterer.ts @grafana/grafana-frontend-platform
# @grafana/ui component documentation

@ -55,7 +55,6 @@
"ci:test-frontend": "yarn run test:ci",
"i18n:stats": "node ./scripts/cli/reportI18nStats.mjs",
"betterer": "betterer --tsconfig ./scripts/cli/tsconfig.json",
"betterer:json": "ts-node --transpile-only --project ./scripts/cli/tsconfig.json ./scripts/cli/bettererResultsToJson.ts",
"betterer:merge": "betterer merge --tsconfig ./scripts/cli/tsconfig.json",
"betterer:stats": "node ./scripts/cli/reportBettererStats.mjs",
"betterer:issues": "ts-node --transpile-only --project ./scripts/cli/tsconfig.json ./scripts/cli/generateBettererIssues.ts",

@ -1,53 +0,0 @@
import { betterer } from '@betterer/betterer';
import { writeFile } from 'fs/promises';
interface FilesByIssues {
name: string;
files: [
{
path: string;
count: number;
},
];
}
type ResultMap = Record<string, FilesByIssues[]>;
/**
* Produces a JSON file for consumption directly in Grafana
*/
async function main() {
const results = await betterer.results();
const resultMap: ResultMap = {};
for (const suite of results.resultSummaries) {
resultMap[suite.name] = [];
const filesByIssues: FilesByIssues[] = [];
// Group by message in the suite, then by file counting the number of occurrences
for (const [file, details] of Object.entries(suite.details)) {
const relativePath = file.replace(process.cwd(), '');
details.forEach((element) => {
const messageExist = filesByIssues.some((issue) => issue.name === element.message);
// If the message does not exist, add it to the list of issues
// With the file and start the count at 1
if (!messageExist) {
const name: FilesByIssues['name'] = element.message;
filesByIssues.push({ name, files: [{ path: relativePath, count: 1 }] });
} else {
//If it exists, check if there is a file with the same path
//If so, increment the count, if not, add the file to the list starting the count at 1
const issue = filesByIssues.find((issue) => issue.name === element.message);
if (issue?.files.find((file) => file.path === relativePath)?.count !== undefined) {
issue.files.find((file) => file.path === relativePath)!.count++;
} else {
issue?.files.push({ path: relativePath, count: 1 });
}
}
});
resultMap[suite.name] = filesByIssues;
}
}
await writeFile('.betterer.results.json', JSON.stringify(resultMap, undefined, 2));
}
main().catch(console.error);
Loading…
Cancel
Save