npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

grunt-sonar-runner

v3.0.2

Published

Sonar Analysis Runner from grunt. The major version is kept in sync with sonar runner distribution version.

Downloads

7,151

Readme

grunt-sonar-runner

Sonar Analysis Runner from grunt

Build Status NPM version Dependency Status

Getting Started

This plugin requires Grunt ~0.4.5

If you haven't used Grunt before, be sure to check out the Getting Started guide, as it explains how to create a Gruntfile as well as install and use Grunt plugins. Once you're familiar with that process, you may install this plugin with this command:

npm install grunt-sonar-runner --save-dev

Once the plugin has been installed, it may be enabled inside your Gruntfile with this line of JavaScript:

grunt.loadNpmTasks('grunt-sonar-runner');

The "sonarRunner" task

Overview

In your project's Gruntfile, add a section named sonarRunner to the data object passed into grunt.initConfig().

grunt.initConfig({
sonarRunner: {
        analysis: {
            options: {
                debug: true,
                separator: '\n',
                sonar: {
                    login: 'admin',
                    password: 'admin',
                    host: {
                        url: 'http://localhost:9000'
                    },
                    jdbc: {
                        url: 'jdbc:mysql://localhost:3306/sonar',
                        username: 'sonar',
                        password: 'sonar'
                    },

                    projectKey: 'sonar:grunt-sonar-runner:0.1.0',
                    projectName: 'Grunt Sonar Runner',
                    projectVersion: '0.10',
                    sources: ['test'].join(','),
                    language: 'js',
                    sourceEncoding: 'UTF-8'
                }
            }
        }
    }
});

Options

options.debug

Type: Boolean Default value: 'false'

A Boolean value to display debug information when preparing sonar analysis.

options.separator

Type: String Default value: os.EOL

A string value representing a new line character to separate individual sonar properties

options.dryRun

Type: Boolean Default value: 'false'

A flag to run it in dry mode. The configuration is checked but not execute

options.maxBuffer

Type: Number Default value: 'null'

maxBuffer specifies the largest amount of data allowed on stdout or stderr - if this value is exceeded then the child process is killed and an error returned from sonar-runner. See: child_process.exec()

options.projectHome

Type: String Default value: ''

A string value representing a root path from the project, if configured it will create a project configuration file based on options.sonar without override default runner configuration file. If the root path contains a file named sonar-project.properties, this file will be considered instead

options.sonar.host.url

Type: String Default value: 'http://localhost:9000'

Sonar Dashboard URL

options.sonar.jdbc.url

Type: String Default value: ''

JDBC connection url

options.sonar.jdbc.username

Type: String Default value: ''

JDBC connection username

options.sonar.jdbc.password

Type: String Default value: ''

JDBC connection password

options.sonar.sources

Type: String Default value: ''

comma separated list of directories to analyse. All js files in the provided directories will be included.

options.sonar.projectKey

Type: String Default value: ''

project key usually of form group:artifactId:version

options.sonar.projectName

Type: String Default value: ''

Project Summary

options.sonar.projectVersion

Type: String Default value: ''

Current project build version

options.sonar.language

Type: String Default value: null

Sets the project language. A list of language plugins can be found here. If this property is undefined, a multi language project will be assumed and the sources searched for valid/supported languages.

options.sonar.javascript.lcov.reportPath

Type: String Default value: -

Path to the LCOV Code Coverage File to be used in Sonar

options.sonar.exclusions

Type: String or [String]
Default value: null

A list of directories and files that should be excluded from Sonar analysis. A list of wildcards that can be use can be found here.

Usage Examples

The configuration code below shows all possible options that are currently supported by the plugin. Any additional sonar properties can be added right inside the sonar object literal.

grunt.initConfig({
  sonarRunner: {
              analysis: {
                  options: {
                      debug: true,
                      separator: '\n',
                      dryRun: false,
                      sonar: {
                          login: 'admin',
                          password: 'admin',                          
                          host: {
                              url: 'http://localhost:9000'
                          },
                          jdbc: {
                              url: 'jdbc:mysql://localhost:3306/sonar',
                              username: 'sonar',
                              password: 'sonar'
                          },

                          projectKey: 'sonar:grunt-sonar-runner:0.1.0',
                          projectName: 'Grunt Sonar Runner',
                          projectVersion: '0.10',
                          sources: ['test'].join(','),
                          language: 'js',
                          sourceEncoding: 'UTF-8'
                      }
                  }
              }
          }
});

To run

grunt sonarRunner:analysis

Release History