Skip to content

Commit

Permalink
lit --format markdown
Browse files Browse the repository at this point in the history
  • Loading branch information
DE7924 committed Dec 19, 2024
1 parent a6834ff commit 8fe260b
Show file tree
Hide file tree
Showing 5 changed files with 225 additions and 63 deletions.
213 changes: 182 additions & 31 deletions custom-elements.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,62 @@
"kind": "javascript-module",
"path": "src/main.ts",
"declarations": [
{
"kind": "variable",
"name": "failedEmoji",
"type": {
"text": "string"
},
"default": "\"\""
},
{
"kind": "variable",
"name": "passedEmoji",
"type": {
"text": "string"
},
"default": "\"\""
},
{
"kind": "function",
"name": "buildComment",
"return": {
"type": {
"text": "Promise<string[]>"
}
},
"parameters": [
{
"name": "commands",
"type": {
"text": "{ label: string; command: string }[]"
}
}
]
},
{
"kind": "function",
"name": "runCommand",
"return": {
"type": {
"text": "Promise<string | boolean>"
}
},
"parameters": [
{
"name": "command",
"type": {
"text": "string"
}
},
{
"name": "label",
"type": {
"text": "string"
}
}
]
},
{
"kind": "function",
"name": "run",
Expand All @@ -36,6 +92,38 @@
}
],
"exports": [
{
"kind": "js",
"name": "failedEmoji",
"declaration": {
"name": "failedEmoji",
"module": "src/main.ts"
}
},
{
"kind": "js",
"name": "passedEmoji",
"declaration": {
"name": "passedEmoji",
"module": "src/main.ts"
}
},
{
"kind": "js",
"name": "buildComment",
"declaration": {
"name": "buildComment",
"module": "src/main.ts"
}
},
{
"kind": "js",
"name": "runCommand",
"declaration": {
"name": "runCommand",
"module": "src/main.ts"
}
},
{
"kind": "js",
"name": "run",
Expand Down Expand Up @@ -64,40 +152,44 @@
"declarations": [],
"exports": []
},
{
"kind": "javascript-module",
"path": "docs/assets/hierarchy.js",
"declarations": [],
"exports": []
},
{
"kind": "javascript-module",
"path": "docs/assets/icons.js",
"declarations": [],
"exports": []
},
{
"kind": "javascript-module",
"path": "docs/assets/main.js",
"declarations": [],
"exports": []
},
{
"kind": "javascript-module",
"path": "docs/assets/navigation.js",
"declarations": [],
"exports": []
},
{
"kind": "javascript-module",
"path": "docs/assets/search.js",
"declarations": [],
"exports": []
},
{
"kind": "javascript-module",
"path": "src/scripts/analyze.ts",
"declarations": [
{
"kind": "function",
"name": "eslint",
"return": {
"type": {
"text": "Promise<stepResponse>"
}
},
"parameters": [
{
"name": "command",
"type": {
"text": "Command"
}
}
]
},
{
"kind": "function",
"name": "litAnalyzer",
"return": {
"type": {
"text": "Promise<stepResponse>"
}
},
"parameters": [
{
"name": "command",
"type": {
"text": "Command"
}
}
]
},
{
"kind": "function",
"name": "analyze",
Expand All @@ -109,6 +201,22 @@
}
],
"exports": [
{
"kind": "js",
"name": "eslint",
"declaration": {
"name": "eslint",
"module": "src/scripts/analyze.ts"
}
},
{
"kind": "js",
"name": "litAnalyzer",
"declaration": {
"name": "litAnalyzer",
"module": "src/scripts/analyze.ts"
}
},
{
"kind": "js",
"name": "analyze",
Expand Down Expand Up @@ -144,14 +252,32 @@
"text": "Context"
}
},
{
"name": "setupStr",
"type": {
"text": "stepResponse | undefined"
}
},
{
"name": "analyzeStr",
"type": {
"text": "stepResponse | undefined"
}
},
{
"name": "runCodeFormattingStr",
"name": "eslintStr",
"type": {
"text": "stepResponse | undefined"
}
},
{
"name": "litAnalyzerStr",
"type": {
"text": "stepResponse | undefined"
}
},
{
"name": "codeFormattingStr",
"type": {
"text": "stepResponse | undefined"
}
Expand Down Expand Up @@ -207,6 +333,31 @@
}
]
},
{
"kind": "javascript-module",
"path": "src/scripts/setup.ts",
"declarations": [
{
"kind": "function",
"name": "setup",
"return": {
"type": {
"text": "Promise<stepResponse>"
}
}
}
],
"exports": [
{
"kind": "js",
"name": "setup",
"declaration": {
"name": "setup",
"module": "src/scripts/setup.ts"
}
}
]
},
{
"kind": "javascript-module",
"path": "src/scripts/testing.ts",
Expand Down
32 changes: 19 additions & 13 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.

2 changes: 1 addition & 1 deletion src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ export async function run(): Promise<void> {
const litAnalyzerStr: stepResponse | undefined = doStaticAnalysis
? await litAnalyzer({
label: "Lit Analyzer",
command: "npm run lint:lit-analyzer",
command: "npm run lint:lit-analyzer -- --format markdown",
})
: undefined;

Expand Down
39 changes: 22 additions & 17 deletions src/scripts/analyze.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,26 +70,31 @@ export const litAnalyzer = async (command: Command): Promise<stepResponse> => {

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

const problemCount = lines.filter((line) =>
// const table = lines
// .map((line) => {
// const match = line.match(/^(.*?):(\d+):(\d+): (.*)$/);
// if (match) {
// const [_, file, line, message] = match;
// return `<tr><td>${file}</td><td>${line}</td><td>${message}</td></tr>`;
// }
// return "";
// })
// .join("");

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

const [_, __, problemCountStr, ___, ____] = problemsLine;

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

View workflow job for this annotation

GitHub Actions / code-quality

'_' is assigned a value but never used

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

View workflow job for this annotation

GitHub Actions / code-quality

'__' is assigned a value but never used

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

View workflow job for this annotation

GitHub Actions / code-quality

'___' is assigned a value but never used

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

View workflow job for this annotation

GitHub Actions / code-quality

'____' is assigned a value but never used
const problemCount = parseInt(problemCountStr);
// const problemCount =
// problemsLine.length > 0
// ? parseInt(problemsLine[0].match(/(\d+) problem/)![1])
// : 0;

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>`;
response.output = `${failedEmoji} - ${command.label}: ${problemCount} problem${problemCount !== 1 ? "s" : ""} found\n<details><summary>See Details</summary>${outputStr}</details>`;

return response;
} else {
Expand Down

0 comments on commit 8fe260b

Please sign in to comment.