5

I setup code quality step, following this gitlab doc (very poor doc): https://docs.gitlab.com/ee/user/project/merge_requests/code_quality.html

Now the code quality step runs and I get the report (perfect).

But, it seems that it doesn"t check much, here is an example:

:["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 and file_lines": are for my entities class, so they are not real erros (no point in splitting an entity class)
  • "TODO found": real problem ok (bravo code quality check!)

I know there are many other problems. If I put the code into sonarcube, I find many more problems than that)

Where are all the errors (the real ones) ?

Did something is badly setup ?

My project source: https://gitlab.com/tyvain/parcoursup

Tyvain
  • 2,640
  • 6
  • 36
  • 70

2 Answers2

9

your repository does not contain configuration for the code-quality check, so it runs with default options.

You should probably add a .codeclimate.yml-file. (You can also run sonar as an engine there...)

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

gitlab by default (i.e. without configutation) seems to be more suited for web-projects, see the default config at https://gitlab.com/gitlab-org/security-products/codequality/tree/master/codeclimate_defaults

Also, you should probably add the report (maybe additionally) in the reports-subentry below artifacts, like:

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

This way, gitlab shows the new/fixed issues in merge requests (at payed levels), see

Regards, Tim

2

That 2018 documentation has since then evolved considerably, and the potential quality warnings found are much more visible now with GitLab 13.6 (November 2020, two years later)

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.

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

See Documentation and Issue.

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250