2.0.2 • Published 3 years ago

pn-sonarqube v2.0.2

Weekly downloads
12
License
ISC
Repository
-
Last release
3 years ago

Integrates with build pipelines to analyse code with sonarqube

Add script execution

invoke the bin from your build pipelines and supply what language (javascript or typescript, default is javascript) that is used in your project, the sonarqube url and the sonarqube token, the last two should be found from the global bitbucket variables $SONARQUBE_URL and $SONARQUBE_PIPELINE_TOKEN but can of course be supplied manually.

add lcov reporting

For this to work with your unit tests you must use lcov reporting.

an example of how this looks with nyc and mocha:

package.json

  "scripts": {
      "test": "./node_modules/.bin/nyc --reporter=lcov --reporter=text ./node_modules/.bin/mocha -r ts-node/register test/*.ts",
  }

...

  "nyc": {
    "extension": [
      ".ts"
    ],
    "require": [
      "ts-node/register"
    ],
    "include": [
      "src/**/*"
    ],
    "exclude": [
      "**/*.d.ts"
    ],
    "reporter": [
      "text"
    ],
    "all": true,
    "check-coverage": false
  }

Example bitbucket pipeline

bitbucket-pipelines.yml

# my-awesome-repo-thingys
image: node:12

pipelines:
  branches:
    master:
      - step:
          caches:
            - node
          script:
            - npm install
            - npm run lint
            - npm test
            - node --max-old-space-size=8192 ./node_modules/.bin/serverless deploy -s test -v
            - ./node_modules/.bin/pn-sonarqube -lang ts -sonarurl $SONARQUBE_URL -token $SONARQUBE_PIPELINE_TOKEN -sources src

Options

ParameterDescriptionRequiredDefault
sonarurlurl for sonarqubetrue
tokensonarqube tokentrue
sourcesfolder containing code to be analysedfalseroot
langts or js, needed for test cases to be analysedfalsejs

Note

Pipeline must use node 8 or higher

2.0.2

3 years ago

2.0.1

3 years ago

1.0.16

4 years ago

2.0.0

4 years ago

1.0.15

4 years ago

1.0.14

4 years ago

1.0.13

4 years ago

1.0.12

4 years ago

1.0.11

4 years ago

1.0.10

4 years ago

1.0.9

4 years ago

1.0.8

4 years ago

1.0.7

4 years ago

1.0.6

4 years ago

1.0.5

4 years ago

1.0.4

4 years ago

1.0.2

4 years ago

1.0.1

4 years ago

1.0.3

4 years ago

1.0.0

4 years ago