Skip to content
Snippets Groups Projects

WIP Compare codeclimate artifacts on merge request page

Closed username-removed-444 requested to merge dz-codeclimate-compare into master

What does this MR do?

Show how code quality changes by the merge request widget if project has codeclimate job in .gitlab-ci.yml.

Are there points in the code the reviewer needs to double check?

JS code

Why was this MR needed?

Show how code quality changes by the merge request allow us and other GitLab users to increase software quality they develop.

Screenshots (if relevant)

metrics

Does this MR meet the acceptance criteria?

What are the relevant issue numbers?

https://gitlab.com/gitlab-org/gitlab-ce/issues/4044

Edited by username-removed-444

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
  • @dzaporozhets really cool, this reminds me of an old design i once made for https://gitlab.com/gitlab-org/gitlab-ce/issues/25424#note_21800473 example image mockup

    So my question here is, does this relay information only originating from failed CI jobs or are there other sources?

    Also i like the way this displays the information, however i wonder about when this information is needed to be displayed. It can take up a lot of vertical space. In that sense it may make sense to hide it behind an expandable anchor:

    image

    Let me know what you think, I'll keep close watch of this mr

    Edited by Dimitrie Hoekstra
  • does this relay information only originating from failed CI jobs or are there other sources?

    @dimitrieh no information is either positive like: Code quality improved or negative like code quality decreased. However, CI is green because job is always positive (completed), similar to what we have now with test coverage

    Edited by username-removed-444
  • @dzaporozhets what about the following design?

    image

    expanded:

    image

    some thoughts:

    • better symbols for good and bad?
  • Yes :muscle:

  • @dimitrieh regarding the icons, do we always show a green one if there is at least one improved point? :confused:

  • note: from conversation with @filipa

    If there are new issues there is a problem, only good situation is when all are resolved

    so the icons will be either checkmark green or cross red

    Edited by Dimitrie Hoekstra
  • After talking with @dimitrieh:

    • Show green icon when all issues are resolved
    • Show red icon if there is any non resolved issue
  • Filipa Lacerda added 1 commit

    added 1 commit

    Compare with previous version

  • @dimitrieh @filipa when code quality does not change or improved == green icon. If degraded == red icon.

  • Filipa Lacerda added 273 commits

    added 273 commits

    Compare with previous version

  • From slack:

    • New issues == only in head

    • Resolved == only in base

    • head issues == codeclimate.json content for MR last commit sha

    • base issues == codeclimate.json content for MR base commit sha

    • if something is present in head but not in base means MR introduce code quality issue that was not present before in master

    • if something is missing in head but was in base means MR fixed code quality issue that was present before in master

    Edited by Filipa Lacerda
  • 184 184 merge_request)
    185 185 end
    186 186
    187 expose :codeclimate do
    188 expose :head do |merge_request|
    189 if merge_request.head_pipeline
    190 build = merge_request.head_pipeline.artifacts.find(&:codeclimate?)
    191
    192 if build && build.success?
    193 raw_namespace_project_build_artifacts_url(merge_request.project.namespace,
    • This URL should be returned only if we do support artifacts browsing, which is not always true. So, currently we don't have such method, but we are looking at browsable_artifacts? implemented in Ci::Build.

      Also, we should make sure that user can read the build, as not everyone can access artifacts.

    • @ayufan can you help me with this comment? What kind of existing code can I use to make sure we safely return artefact url?

    • @dzaporozhets Individual files from artifacts can be accessed only when you have metadata: build.artifacts_metadata?.

      I wonder if we should not introduce a method: browsable_artifacts?, extractable_artifacts? or something similar.

    • TODO:

      • add artifacts_metadata? check
      • add check if user can read_build
    • Please register or sign in to reply
  • added 1 commit

    • d0b34e1e - Refactor backend code related to codeclimate widget

    Compare with previous version

  • @ayufan thanks for the review. I am just in progress of cleaning the code since it was made as a concept and not meant for production use.

  • Filipa Lacerda added 1 commit

    added 1 commit

    Compare with previous version

  • Filipa Lacerda changed the description

    changed the description

  • Filipa Lacerda marked the checklist item Added for this feature/bug as completed

    marked the checklist item Added for this feature/bug as completed

  • Filipa Lacerda added 1 commit

    added 1 commit

    • b2e4140c - Apply changes to match mockups

    Compare with previous version

  • Filipa Lacerda
  • @iamphill can you please review this?

    cc @fatihacet can you also take a look?

    Thanks!

  • Please register or sign in to reply
    Loading