1.0.4 • Published 3 years ago

@syngenta-digital/scs v1.0.4

Weekly downloads
-
License
Apache-2.0
Repository
github
Last release
3 years ago

SonarCloud Scan (SCS)

Simple NPX package to run sonarcloud analysis

Features

  • Ability to run a sonarcloud scan in one command
  • Supports most use cases and languages
  • Support config files in JSON or YML

Installation & Usage

This is a Node.js module available through the npm registry.

Before installing, download and install Node.js. Node.js 0.10 or higher is required.

# if env variables SONAR_TOKEN & SONAR_ORG are set

$ npx @syngenta-digital/scs

# or you can pass in the flags

$ npx @syngenta-digital/scs --token some-token --org syngenta-dpe-usco --key some-project --name some-project

# or pass in a configuration json

$ npx @syngenta-digital/scs --file some-dir/sonar.json

# or pass in a configuration yml

$ npx @syngenta-digital/scs --file some-dir/sonar.yml

Command Flag Options

Flag NameRequiredDescription
tokenfalseThe token to access sonarcloud (default: SONAR_TOKEN env variable)
orgfalseThe sonarcloud org the project belongs to (default: SONAR_ORG env variable)
filefalseThe configuration file relative path
versionfalseThe version
descriptionfalseThe description
sourcesfalseThe code source directories; separate by comma if multiple
exclusionsfalseThe exclusions not to scan
testsfalseThe tests directories
providerfalseThe provider (i.e. git, hg, etc)
homepagefalseThe homepage of project
issuesfalseThe issues link
issuesfalseThe issues link
scmfalseThe source control management link

YAML Config File Example

token: optional-token
organization: some-organization
sonar:
    projectKey: test-project
    projectName: test-name
    projectVersion: 1.0
    projectDescription: test-description
    sources: src
    exclusions: node_modules
    tests: test
    scm:
        provider: git
    links:
        homepage: https://www.test.com
        issues: https://some-issu-url.com
        scm: git+https://some-issu-url.com

JSON Config File Example

{
    "token": "optional-token",
    "organization": "some-organization",
    "sonar": {
        "projectKey": "test-project",
        "projectName": "test-name",
        "projectVersion": 1.0,
        "projectDescription": "test-description",
        "sources": "src",
        "exclusions": "node_modules",
        "tests": "test",
        "scm": {
            "provider": "git"
        },
        "links": {
            "homepage": "https://www.test.com",
            "issues": "https://some-issu-url.com",
            "scm": "git+https://some-issu-url.com"
        }
    }
}

Other Configurations

You can use a traditional sonar-project.properties config as well. Full options here