screwdriver-coverage-sonar 3.4.0 → 4.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/index.js +11 -20
  2. package/package.json +13 -13
package/index.js CHANGED
@@ -7,7 +7,7 @@ const joi = require('joi');
7
7
  const hoek = require('@hapi/hoek');
8
8
  const path = require('path');
9
9
  const request = require('screwdriver-request');
10
- const uuidv4 = require('uuid/v4');
10
+ const { v4: uuidv4 } = require('uuid');
11
11
  const logger = require('screwdriver-logger');
12
12
  const CoverageBase = require('screwdriver-coverage-base');
13
13
 
@@ -34,18 +34,9 @@ class CoverageSonar extends CoverageBase {
34
34
  joi
35
35
  .object()
36
36
  .keys({
37
- sdApiUrl: joi
38
- .string()
39
- .uri()
40
- .required(),
41
- sdUiUrl: joi
42
- .string()
43
- .uri()
44
- .required(),
45
- sonarHost: joi
46
- .string()
47
- .uri()
48
- .required(),
37
+ sdApiUrl: joi.string().uri().required(),
38
+ sdUiUrl: joi.string().uri().required(),
39
+ sonarHost: joi.string().uri().required(),
49
40
  adminToken: joi.string().required(),
50
41
  sonarEnterprise: joi.boolean().default(false),
51
42
  sonarGitAppName: joi.string().default(DEFAULT_GIT_APP_NAME)
@@ -281,8 +272,7 @@ class CoverageSonar extends CoverageBase {
281
272
  pipelineId,
282
273
  pipelineName,
283
274
  projectKey,
284
- prParentJobId,
285
- prNum
275
+ prParentJobId
286
276
  }) {
287
277
  let jobId = buildJobId;
288
278
  let jobName = buildJobName;
@@ -315,12 +305,14 @@ class CoverageSonar extends CoverageBase {
315
305
  }
316
306
 
317
307
  // Use prParentJobId as ID for PRs
318
- if (prNum && coverageScope === 'job' && enterpriseEnabled) {
308
+ if (coverageScope === 'job' && enterpriseEnabled) {
319
309
  const prRegex = /^PR-(\d+)(?::([\w-]+))?$/;
320
310
  const prNameMatch = jobName.match(prRegex);
321
311
 
322
- jobId = prParentJobId;
323
- jobName = prNameMatch && prNameMatch.length > 1 ? prNameMatch[2] : jobName;
312
+ if (prNameMatch && prNameMatch.length > 1) {
313
+ jobId = prParentJobId;
314
+ jobName = prNameMatch[2];
315
+ }
324
316
  }
325
317
 
326
318
  return {
@@ -412,8 +404,7 @@ class CoverageSonar extends CoverageBase {
412
404
  pipelineName,
413
405
  jobName,
414
406
  projectKey: coverageProjectKey,
415
- prParentJobId,
416
- prNum
407
+ prParentJobId
417
408
  });
418
409
 
419
410
  const infoObject = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "screwdriver-coverage-sonar",
3
- "version": "3.4.0",
3
+ "version": "4.0.0",
4
4
  "description": "SonarQube implementation of the coverage-base class",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -29,23 +29,23 @@
29
29
  "Tiffany Kyi <tiffanykyi@gmail.com>"
30
30
  ],
31
31
  "devDependencies": {
32
- "chai": "^4.2.0",
33
- "eslint": "^7.31.0",
34
- "eslint-config-screwdriver": "^5.0.1",
35
- "mocha": "^9.1.3",
32
+ "chai": "^4.3.7",
33
+ "eslint": "^8.28.0",
34
+ "eslint-config-screwdriver": "^7.0.0",
35
+ "mocha": "^10.1.0",
36
36
  "mocha-multi-reporters": "^1.5.1",
37
37
  "mocha-sonarqube-reporter": "^1.0.2",
38
38
  "mockery": "^2.1.0",
39
- "nyc": "^15.0.0",
40
- "sinon": "^9.0.0"
39
+ "nyc": "^15.1.0",
40
+ "sinon": "^15.0.0"
41
41
  },
42
42
  "dependencies": {
43
- "@hapi/hoek": "^9.2.0",
44
- "joi": "^17.4.1",
45
- "screwdriver-coverage-base": "^2.1.0",
46
- "screwdriver-logger": "^1.1.0",
47
- "screwdriver-request": "^1.0.1",
48
- "uuid": "^3.4.0"
43
+ "@hapi/hoek": "^10.0.1",
44
+ "joi": "^17.7.0",
45
+ "screwdriver-coverage-base": "^3.0.0",
46
+ "screwdriver-logger": "^2.0.0",
47
+ "screwdriver-request": "^2.0.1",
48
+ "uuid": "^9.0.0"
49
49
  },
50
50
  "release": {
51
51
  "debug": false