From c3816178e7705bc2d20cb7561fe7c1f1c4f0844f Mon Sep 17 00:00:00 2001 From: "tsun@codety.io" Date: Tue, 27 Aug 2024 22:43:33 -0700 Subject: [PATCH] Enable issue reporter configs. --- .github/workflows/codety.yml | 4 +-- .../scanner/service/dto/AnalyzerRequest.java | 19 ++++++++++- .../codety/scanner/util/CodetyConstant.java | 9 ++++-- scanner/doc/predefined-variables.md | 32 ++++++++++++++++++- ...CodeAnalysisResultDistributionService.java | 4 +++ .../console/ConsoleResultReporter.java | 4 +++ .../GithubPullRequestResultReporter.java | 6 ++-- 7 files changed, 69 insertions(+), 9 deletions(-) diff --git a/.github/workflows/codety.yml b/.github/workflows/codety.yml index b44c8e0..b7aaa11 100644 --- a/.github/workflows/codety.yml +++ b/.github/workflows/codety.yml @@ -26,9 +26,9 @@ jobs: # CODETY_TOKEN: ${{ secrets.CODETY_TOKEN_PROD }} #test: CODETY_TOKEN: ${{ secrets.CODETY_TOKEN_TEST }} - CODETY_HOST: ${{ vars.CODETY_HOST_TEST }} +# CODETY_HOST: ${{ vars.CODETY_HOST_TEST }} - CODETY_ENABLE_SLACK_NOTIFICATION: true + CODETY_ISSUE_REPORTER_SLACK: true SLACK_OAUTH_TOKEN: ${{ secrets.SLACK_OAUTH_TOKEN_TEST_INTEGRATION }} SLACK_CONVERSATION_ID: ${{ vars.SLACK_CONVERSATION_ID }} diff --git a/scanner-common/src/main/java/io/codety/scanner/service/dto/AnalyzerRequest.java b/scanner-common/src/main/java/io/codety/scanner/service/dto/AnalyzerRequest.java index 4cf19a7..b927643 100644 --- a/scanner-common/src/main/java/io/codety/scanner/service/dto/AnalyzerRequest.java +++ b/scanner-common/src/main/java/io/codety/scanner/service/dto/AnalyzerRequest.java @@ -19,10 +19,12 @@ public class AnalyzerRequest { private boolean enablePostingPullRequestComment = true; private boolean enablePostingPullRequestReviews = true; private boolean enablePostingGitHubPullRequestCheckRunAnnotations = true; + private boolean enableConsoleIssueReporter = true; private GitProviderType gitProviderType; private ComputeRunnerType computeRunnerType; + private String localGitRepoPath; private String gitRepoFullName; private String externalGitRepoOwnerId; @@ -84,12 +86,19 @@ public static AnalyzerRequest processSystemVariablesToRequest(Map 0) { CodetyConsoleLogger.info(CodetyConstant.INFO_SHOW_ANALYSIS_RESULT); diff --git a/scanner/src/main/java/io/codety/scanner/reporter/github/GithubPullRequestResultReporter.java b/scanner/src/main/java/io/codety/scanner/reporter/github/GithubPullRequestResultReporter.java index 95e7efe..e993eac 100644 --- a/scanner/src/main/java/io/codety/scanner/reporter/github/GithubPullRequestResultReporter.java +++ b/scanner/src/main/java/io/codety/scanner/reporter/github/GithubPullRequestResultReporter.java @@ -47,9 +47,9 @@ public void deliverResult(AnalyzerRequest analyzerRequest, CodeAnalysisResultSet StringBuilder pullRequestComment = createPullRequestComment(analyzerRequest, codeAnalysisResultDtoList); githubCommentService.addOrUpdatePullRequestComment(analyzerRequest, pullRequestComment.toString()); } -// if(analyzerRequest.isEnablePostingGitHubPullRequestCheckRunAnnotations()){ -// githubCommentService.addCheckRunAnnotations(analyzerRequest, codeAnalysisResultDtoList); -// } + if(analyzerRequest.isEnablePostingGitHubPullRequestCheckRunAnnotations()){ + githubCommentService.addCheckRunAnnotations(analyzerRequest, codeAnalysisResultDtoList); + } } }