From da7d017d58dc1899b63962b0f7c4d33cae9ef2eb Mon Sep 17 00:00:00 2001 From: Plai Date: Thu, 22 Jun 2023 08:56:09 +0000 Subject: [PATCH 1/4] Make lint-ci export eslint json output --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 213c550..9cebc2f 100644 --- a/package.json +++ b/package.json @@ -9,7 +9,7 @@ "license": "MIT", "scripts": { "lint": "eslint 'src/**/*.{js,ts}' --quiet --fix", - "lint-ci": "eslint 'src/**/*.{js,ts}'", + "lint-ci": "eslint 'src/**/*.{js,ts}' -f json -o eslint-report.json || true", "format": "prettier --write 'src/**/*.{js,ts}'", "test": "jest", "build": "tsc --project tsconfig.build.json", From 8551013449c766b688b2fa7c4c5af6ee8b7c4f3e Mon Sep 17 00:00:00 2001 From: Plai Date: Thu, 22 Jun 2023 08:57:14 +0000 Subject: [PATCH 2/4] Save lint context from node job and add codecoach job --- .github/workflows/ci.yml | 51 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6baa9a3..a1b444f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -30,10 +30,61 @@ jobs: - run: yarn lint-ci + - name: Save linting context for CodeCoach + run: echo "ESLINT_CONTEXT=$(pwd)" >> $GITHUB_ENV + + - name: Save eslint-report.json + uses: actions/upload-artifact@v3 + with: + name: eslint-report + path: eslint-report.json + retention-days: 1 + - run: yarn test --ci - run: yarn build + codecoach: + needs: npm-build + runs-on: ubuntu-latest + container: encx/codecoach-cli + + steps: + - uses: actions/checkout@v3 + + - name: Restore eslint-report.json + uses: actions/download-artifact@v3 + with: + name: eslint-report + path: . + + - name: CodeCoach + run: | + cat << EOF > codecoach.json + { + "vcs": "github", + "githubRepoUrl": "${{ github.server_url }}/${{ github.repository }}", + "githubPr": "${{ github.event.pull_request.number }}", + "githubToken": "${{ github.token }}", + "buildLogFile": [ + "eslint;eslint-report.json;${ESLINT_CONTEXT}" + ], + "removeOldComment": true, + "output": "output.json" + } + EOF + + codecoach --config="codecoach.json" + + - name: Save CodeCoach debug info + uses: actions/upload-artifact@v3 + with: + name: codecoach-debug + path: | + eslint-report.json + output.json + debug.log + docker-build: name: "docker: Build" runs-on: ubuntu-latest From 3018b71b734dc9aaf8accb58a6f78e712bef8618 Mon Sep 17 00:00:00 2001 From: Plai Date: Thu, 22 Jun 2023 08:57:42 +0000 Subject: [PATCH 3/4] update gitignore --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 84a2a14..f9cbe88 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,7 @@ dist/ node_modules/ *.log +eslint-report.json # Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider # Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839 From 04d37b4921144d68d535a3c7549125cf937ce89a Mon Sep 17 00:00:00 2001 From: Plai Date: Thu, 22 Jun 2023 16:37:56 +0700 Subject: [PATCH 4/4] [test] introduce lint warnings --- src/app.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/app.ts b/src/app.ts index ed6f7f3..fa55731 100644 --- a/src/app.ts +++ b/src/app.ts @@ -51,7 +51,7 @@ class App { configs.githubPr, ); return new GitHubAdapter(githubPRService); - } else if (configs.vcs === 'gitlab') { + } else if (configs.vcs == "gitlab") { return new GitLabAdapter(new GitLabMRService()); } } @@ -63,7 +63,7 @@ class App { case ProjectType.msbuild: return new MSBuildParser(cwd); case ProjectType.tslint: - return new TSLintParser(cwd); + return new TSLintParser(cwd) case ProjectType.eslint: return new ESLintParser(cwd); case ProjectType.scalastyle: