Skip to content

WIP: Add route and controller for code analytics

What does this MR do?

This MR is the part of the first iteration of a new Identifying Code Hotspots feature https://gitlab.com/gitlab-org/gitlab-ee/issues/12683#/

Implementation issue: #13165 (closed)

This is originally a big MR that has been broken down into other MRs:

These need to be merged before this MR can be merged. For review, this MR is against the branch ag-code-hotspots-finder, but once that is merged through MR !17277 (merged) I will change the target branch to master

The goal is to generate analytics' mapping for files and directories for the given group, and project, indicating total number of edits in the given duration.

At the point, the timeframe can only be specified as last_30_days and path is neither validated nor used in the SQL query. These will be resolved in the iterations that follow.

This iteration creates a route for code analytics, that accepts timeframe as a param for a pre-selected group and project and returns a hashmap representation as follows on show:

{
  entity: "api", edits: 8, children: {
    entity: "api/helpers", edits: 3,
    entity: "api/endpoint.rb", edits: 5,
  }
},

Each of the entity-ies will be represented as a square of size edits and clickable if the entity has further children.

Does this MR meet the acceptance criteria?

Conformity

Performance and testing

Security

If this MR contains changes to processing or storing of credentials or tokens, authorization and authentication methods and other items described in the security review guidelines:

  • Label as security and @ mention @gitlab-com/gl-security/appsec
  • The MR includes necessary changes to maintain consistency between UI, API, email, or other methods
  • Security reports checked/validated by a reviewer from the AppSec team
Edited by Aakriti Gupta

Merge request reports