Skip to content

Commit

Permalink
remove comment
Browse files Browse the repository at this point in the history
  • Loading branch information
DE7924 committed Jan 15, 2025
1 parent 9f4cd75 commit 87907c1
Showing 1 changed file with 16 additions and 15 deletions.
31 changes: 16 additions & 15 deletions src/scripts/analyze.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,27 +50,28 @@ export const eslint = async (command: Command): Promise<StepResponse> => {
* successfully, it builds a simple success comment.
*/
export const litAnalyzer = async (command: Command): Promise<StepResponse> => {
let [response, outputStr] = await runCommand(command);
const [response, initialOutputStr] = await runCommand(command);
let outputStr = initialOutputStr;
let problemCount = 0;
if (response.error == true) {

if (response.error) {
const lines = outputStr.split("\n");
const problemsCountStr = lines
.map((line) => {
const match = line.match(
/^\|\s*(\d+)\s*\|\s*(\d+)\s*\|\s*(\d+)\s*\|\s*(\d+)\s*\|\s*(\d+)\s*\|$/,
);
if (match) {
const [filesChecked, filesWithProblems, problems, errors, warnings] =
match;
return problems;
}
})
.join("");
const problemsCountStr = lines.reduce((acc, line) => {
const match = line.match(
/^\|\s*(\d+)\s*\|\s*(\d+)\s*\|\s*(\d+)\s*\|\s*(\d+)\s*\|\s*(\d+)\s*\|$/,
);
if (match) {
const [, , , problems] = match;
return acc + problems;
}
return acc;
}, "");

problemCount = parseInt(problemsCountStr);
problemCount = parseInt(problemsCountStr, 10) || 0;

outputStr = outputStr.split("...").pop() || outputStr;
}

return await buildComment(response, command.label, outputStr, problemCount);
};

Expand Down

0 comments on commit 87907c1

Please sign in to comment.