用 SonarQube(社区版)装饰 GitHub 中的拉取请求

Decorating the pull request in GitHub with SonarQube (Community Edition)

首先我创建了SonarQube Server(社区版) 我将 sonarQube 与 Github 集成,用于扫描 GitHub.

的代码

然后,我在 GitHub 中为 运行 sonarQube

创建了动作

.github/workflows/python-pull.yml

 run: sonar-scanner
          -Dsonar.host.url=${{ secrets.SONAR_URL }}
          -Dsonar.login=${{ secrets.SONAR_TOKEN }}
          -Dsonar.projectKey=${{ secrets.SONAR_PROJECT_KEY }}
          -Dsonar.pullrequest.key=${{ github.event.number }}
          -Dsonar.pullrequest.branch=${{ github.HEAD_REF }}
          -Dsonar.pullrequest.base=${{ github.BASE_REF }}
          -Dsonar.pullrequest.github.repository=${{ github.repository }}
          -Dsonar.scm.provider=git
          -Dsonar.java.binaries=/tmp

The result of GitHub actions 在此图像中,它仅显示“所有检查都已通过”

每当我推入或拉入 GitHub 时,sonarQube 服务器就会显示所有错误、错误、漏洞等 Like this

但是我的要求是: 我希望代码的所有详细信息都显示在 Sonarqube 服务器中显示的 GitHub 页面上(如错误和错误)

也让我知道 sonarQube社区版可以吗?

Community Edition 无法使用 Decorating Pull Reauest。 它可从 Developer Edition 及更高版本获得。

查看可用的 sonarsource 文档以获取更多信息。

https://docs.sonarqube.org/latest/analysis/pull-request/

https://www.sonarqube.org/github-integration/

Decorating Pull Request 适用于 Developer 或更高版本。

但你可以使用非官方版本sonarqube-community-branch-plugin

安装此插件,然后您可以参考文档进行进一步配置。