Gitlab和代码气候-它真正涵盖了什么?没有?

时间:2018-10-11 04:53:04

标签: java gitlab-ci code-climate

我按照此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"}]
  • “ method_count和file_lines”:用于我的实体类,因此它们不是真正的错误(拆分实体类没有意义)
  • “找到TODO”:真正的问题好(检查代码质量!)

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

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

设置错误吗?

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

2 个答案:

答案 0 :(得分:2)

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

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

请参见https://docs.codeclimate.com/docs/advanced-configurationhttps://docs.codeclimate.com/docs/list-of-engines

默认情况下(没有配置)的gitlab似乎更适合于Web项目,请参见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在合并请求中(付费级别)显示新的/已修复的问题,请参见

关于蒂姆

答案 1 :(得分:0)

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

显示代码质量严重等级

GitLab中的代码质量功能可以很好地显示项目中存在或在合并请求中正在更改的质量违规。但是,今天在GitLab界面中尚不清楚了解哪些违规最重要。

使用“完整代码质量报告”和“合并请求”小组件,现在您可以看到严重等级。这样一来,您就可以轻松地了解在合并之前解决哪些代码质量违规最重要的问题,并减少项目中的技术负担。

https://about.gitlab.com/images/13_6/code_quality_severity.png -- Display Code Quality severity ratings

请参见DocumentationIssue