Skip to content

Commit

Permalink
regex
Browse files Browse the repository at this point in the history
  • Loading branch information
DE7924 committed Dec 18, 2024
1 parent 724b90a commit 8fdfe07
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
4 changes: 2 additions & 2 deletions dist/index.js

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

2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

8 changes: 6 additions & 2 deletions src/scripts/analyze.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,9 @@ export const litAnalyzer = async (command: Command): Promise<stepResponse> => {
const lines = outputStr.split("\n");
const table = lines
.map((line) => {
const match = line.match(/^\s*(\S+)\s+(\d+):\s+(.*)$/);
const match = line.match(
/^(?<file>\.\/[^\s]+)\n\n\s+(?<message>[^\n]+)\n\s+(?<line>\d+):/,
);
if (match) {
const [_, file, line, message] = match;

Check failure on line 79 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>`;
Expand All @@ -82,7 +84,9 @@ export const litAnalyzer = async (command: Command): Promise<stepResponse> => {
.join("");

const problemCount = lines.filter((line) =>
line.match(/^\s*(\S+)\s+(\d+):\s+(.*)$/),
line.match(
/^(?<file>\.\/[^\s]+)\n\n\s+(?<message>[^\n]+)\n\s+(?<line>\d+):/,
),
).length;

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>`;
Expand Down

0 comments on commit 8fdfe07

Please sign in to comment.