Skip to content

Commit

Permalink
fix lit analyzer
Browse files Browse the repository at this point in the history
  • Loading branch information
DE7924 committed Dec 18, 2024
1 parent 31b9b97 commit d493d43
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 32 deletions.
31 changes: 16 additions & 15 deletions dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

36 changes: 19 additions & 17 deletions src/scripts/analyze.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,31 +65,33 @@ export const litAnalyzer = async (command: Command): Promise<stepResponse> => {
});
} catch (error) {
setFailed(`Failed ${command.label}: ${error}`);

Check failure on line 67 in src/scripts/analyze.ts

View workflow job for this annotation

GitHub Actions / code-quality

Invalid type "unknown" of template literal expression
response.error = true;
}

const lines = outputStr.split("\n");
const table = lines
.map((line) => {
const match = line.match(/^\s*(\S+)\s+(\d+):\s+(.*)$/);
if (match) {
const [_, file, line, message] = match;
return `<tr><td>${file}</td><td>${line}</td><td>${message}</td></tr>`;
}
return "";
})
.join("");
if (response.error == true) {
const lines = outputStr.split("\n");
const table = lines
.map((line) => {
const match = line.match(/^\s*(\S+)\s+(\d+):\s+(.*)$/);
if (match) {
const [_, file, line, message] = match;

Check failure on line 77 in src/scripts/analyze.ts

View workflow job for this annotation

GitHub Actions / code-quality

'_' is assigned a value but never used
return `<tr><td>${file}</td><td>${line}</td><td>${message}</td></tr>`;
}
return "";
})
.join("");

const problemCount = lines.filter((line) =>
line.match(/^\s*(\S+)\s+(\d+):\s+(.*)$/),
).length;
const problemCount = lines.filter((line) =>
line.match(/^\s*(\S+)\s+(\d+):\s+(.*)$/),
).length;

if (problemCount > 0) {
response.error = true;
response.output = `${failedEmoji} - ${command.label}: ${problemCount} problem${problemCount !== 1 ? "s" : ""} found\n<details><summary>See Details</summary><table><tr><th>File</th><th>Line</th><th>Message</th></tr>${table}</table></details>`;

return response;
} else {
response.output = `${passedEmoji} - ${command.label}\n`;
return response;
}
return response;
};

export const analyze = async (): Promise<stepResponse> => {
Expand Down

0 comments on commit d493d43

Please sign in to comment.