Welcome to mirror list, hosted at ThFree Co, Russian Federation.

codequality_parser.js « utils « store « codequality_report « reports « javascripts « assets « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: a794f5f0577bf72194fdbd7c82123dabddef6bec (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
export const parseCodeclimateMetrics = (issues = [], path = '') => {
  return issues.map((issue) => {
    const parsedIssue = {
      name: issue.description,
      path: issue.file_path,
      urlPath: `${path}/${issue.file_path}#L${issue.line}`,
      ...issue,
    };

    if (issue?.location?.path) {
      let parseCodeQualityUrl = `${path}/${issue.location.path}`;
      parsedIssue.path = issue.location.path;

      if (issue?.location?.lines?.begin) {
        parsedIssue.line = issue.location.lines.begin;
        parseCodeQualityUrl += `#L${issue.location.lines.begin}`;
      } else if (issue?.location?.positions?.begin?.line) {
        parsedIssue.line = issue.location.positions.begin.line;
        parseCodeQualityUrl += `#L${issue.location.positions.begin.line}`;
      }

      parsedIssue.urlPath = parseCodeQualityUrl;
    }

    return parsedIssue;
  });
};