Gitlab 和 Code-Climate - 它真正涵盖了什么?没有什么?

Gitlab and Code-Climate - what does it really cover? nothing?

我按照这个 gitlab 文档(非常糟糕的文档)设置了代码质量步骤: https://docs.gitlab.com/ee/user/project/merge_requests/code_quality.html

现在代码质量步骤运行并且我得到了报告(完美)。

不过,好像查的不多,举个例子:

:["Complexity"],"check_name":"method_count","content":{"body":""},"description":"`Admis` has 78 methods (exceeds 20 allowed). Consider refactoring.","fingerprint":"3a31032b9aff6d8b119f276d03a3c391","location":{"path":"src/main/java/nc/unc/importparcoursup/dao/admisDAO/Admis.java","lines":{"begin":14,"end":457}},"other_locations":[],"remediation_points":7000000,"severity":"major","type":"issue","engine_name":"structure"},{
:["Complexity"],"check_name":"file_lines","content":{"body":""},"description":"File `Candidat.java` has 945 lines of code (exceeds 250 allowed). Consider refactoring.","fingerprint":"4f570943e9f89fac8caa554c7e78f993","location":{"path":"src/main/java/nc/unc/importparcoursup/dao/candidatDAO/Candidat.java","lines":{"begin":1,"end":1184}},"other_locations":[],"remediation_points":11208000,"severity":"major","type":"issue","engine_name":"structure"},{
:["Complexity"],"check_name":"method_count","content":{"body":""},"description":"`Candidat` has 232 methods (exceeds 20 allowed). Consider refactoring.","fingerprint":"4dbebf004d9f5f3a1fabf03c43699c01","location":{"path":"src/main/java/nc/unc/importparcoursup/dao/candidatDAO/Candidat.java","lines":{"begin":14,"end":1184}},"other_locations":[],"remediation_points":22400000,"severity":"major","type":"issue","engine_name":"structure"},{
:["Bug Risk"],"check_name":"TODO","description":"TODO found","location":{"lines":{"begin":28,"end":28},"path":"src/main/java/nc/unc/importparcoursup/view/components/CheckComponentAdmis.java"},"type":"issue","engine_name":"fixme","fingerprint":"d8d52d96fc27f9b0a1f9879e7d133345","severity":"minor"}]

我知道还有很多其他问题。如果我把代码放到sonarcube中,我发现的问题远不止于此)

所有错误(真正的错误)在哪里?

是不是设置有问题?

我的项目来源:https://gitlab.com/tyvain/parcoursup

您的存储库不包含代码质量检查的配置,因此它运行具有默认选项。

您应该添加一个 .codeclimate.yml 文件。 (你也可以 运行 声纳作为引擎...)

https://docs.codeclimate.com/docs/advanced-configuration and https://docs.codeclimate.com/docs/list-of-engines

gitlab 默认情况下(即没有配置)似乎更适合网络项目,请参阅 https://gitlab.com/gitlab-org/security-products/codequality/tree/master/codeclimate_defaults

处的默认配置

此外,您可能应该在工件下方的报告子条目中添加报告(也许另外),例如:

  artifacts:
    paths:
      - gl-code-quality-report.json
    reports:
      codequality: gl-code-quality-report.json

这样,gitlab 会显示合并请求中的 new/fixed 问题(付费级别),请参阅

此致,蒂姆

自那以后,2018 年的文档有了很大的发展,发现的潜在质量警告现在更加明显 GitLab 13.6(2020 年 11 月,两年后)

Display Code Quality severity ratings

The Code Quality feature in GitLab is great at showing what quality violations exist in a project or are changing in the Merge Request. However, understanding which of those violations is the most important is not clear in the GitLab interface today.

With the Full Code Quality Report and Merge Request Widget, now you can see the severity rating. This makes it easy for you to understand which code quality violations are most important to resolve before merging and reduces the technical debt in your project.

See Documentation and Issue.