All Projects → bellingard → Sonar Scanner Npm

bellingard / Sonar Scanner Npm

Licence: other
SonarQube Scanner for the JavaScript world

Programming Languages

javascript
184084 projects - #8 most used programming language

Labels

Projects that are alternatives of or similar to Sonar Scanner Npm

Sonar Java
☕️ SonarSource Static Analyzer for Java Code Quality and Security
Stars: ✭ 745 (+473.08%)
Mutual labels:  sonarqube
Sonar Mybatis
MyBatis Plugin for SonarQube: Rules to check SQL statements in MyBatis Mapper XML files
Stars: ✭ 31 (-76.15%)
Mutual labels:  sonarqube
Docker For All
Docker applied in development, devops, testing, product management etc.
Stars: ✭ 88 (-32.31%)
Mutual labels:  sonarqube
Sonarqube Community Branch Plugin
A plugin that allows branch analysis and pull request decoration in the Community version of Sonarqube
Stars: ✭ 775 (+496.15%)
Mutual labels:  sonarqube
Sonarondocker
🐳 📡 Docker way of running SonarQube + any DB
Stars: ✭ 25 (-80.77%)
Mutual labels:  sonarqube
Jest Sonar Reporter
A Sonar test reporter for Jest.
Stars: ✭ 57 (-56.15%)
Mutual labels:  sonarqube
Sonarjs
SonarSource Static Analyzer for JavaScript and TypeScript
Stars: ✭ 696 (+435.38%)
Mutual labels:  sonarqube
Qualinsight Plugins Sonarqube Badges
Plugin for SonarQube that generates badges displaying information about a project's or view's quality.
Stars: ✭ 108 (-16.92%)
Mutual labels:  sonarqube
Sonar Scm Tfvc
SonarQube integration for Team Foundation Version Control
Stars: ✭ 15 (-88.46%)
Mutual labels:  sonarqube
Codecharta
CodeCharta visualizes multiple code metrics using 3D tree maps.
Stars: ✭ 85 (-34.62%)
Mutual labels:  sonarqube
Sonar Jproperties Plugin
SonarQube Java Properties Analyzer
Stars: ✭ 5 (-96.15%)
Mutual labels:  sonarqube
Ansible Role Sonarqube
Ansible Role: SonarQube
Stars: ✭ 22 (-83.08%)
Mutual labels:  sonarqube
Sonar Swift
sonar-swift.SonarQube iOS Plugin, Support Objective-C And Swift, Support Infer (SonarQube iOS 代码扫描插件,支持 Objective-C 和 Swift ,支持 Infer 结果导入 ) base on https://github.com/Idean/sonar-swift
Stars: ✭ 70 (-46.15%)
Mutual labels:  sonarqube
Sonarts
Static code analyzer for TypeScript
Stars: ✭ 776 (+496.92%)
Mutual labels:  sonarqube
Sonar Scanner Maven
SonarQube Scanner for Maven
Stars: ✭ 94 (-27.69%)
Mutual labels:  sonarqube
Sonar Swift
Open source Swift plugin for SonarQube (also supports Objective-C)
Stars: ✭ 735 (+465.38%)
Mutual labels:  sonarqube
Dashboard
📺 Create your own team dashboard with custom widgets. Built with Next.js, React, styled-components and polished.
Stars: ✭ 1,007 (+674.62%)
Mutual labels:  sonarqube
Zpa
A parser and source code analyzer for PL/SQL and Oracle SQL.
Stars: ✭ 124 (-4.62%)
Mutual labels:  sonarqube
Sonarquest
A playful approach to refactoring code smells
Stars: ✭ 104 (-20%)
Mutual labels:  sonarqube
Azure
Azure-related repository
Stars: ✭ 78 (-40%)
Mutual labels:  sonarqube

NPM module to run SonarQube/SonarCloud analyses

sonarqube-scanner makes it very easy to trigger SonarQube / SonarCloud analyses on a JavaScript code base, without needing to install any specific tool or (Java) runtime.

This module is analyzed on SonarCloud.

Build status Quality Gate Maintainability Reliability Security Releases Coverage Status

Installation

This package is available on npm as: sonarqube-scanner

To add code analysis to your build files, simply add the package to your project dev dependencies:

npm install -D sonarqube-scanner

To install the scanner globally and be able to run analyses on the command line:

npm install -g sonarqube-scanner

Usage: add code analysis to your build files

Prerequisite: you've installed the package as a dev dependency.

The following example shows how to run an analysis on a JavaScript project, and pushing the results to a SonarQube instance:

const scanner = require('sonarqube-scanner');

scanner(
  {
    serverUrl : 'https://sonarqube.mycompany.com',
    token : "019d1e2e04eefdcd0caee1468f39a45e69d33d3f",
    options: {
      'sonar.projectName': 'My App',
      'sonar.projectDescription': 'Description for "My App" project...',
      'sonar.sources': 'dist',
      'sonar.tests': 'specs'
    }
  },
  () => process.exit()
)

Syntax: sonarqube-scanner ( parameters, [callback] )

Arguments

  • parameters Map
    • serverUrl String (optional) The URL of the SonarQube server. Defaults to http://localhost:9000
    • token String (optional) The token used to connect to the SonarQube/SonarCloud server. Empty by default.
    • options Map (optional) Used to pass extra parameters for the analysis. See the official documentation for more details.
  • callback Function (optional) Callback (the execution of the analysis is asynchronous).

Usage: run analyses on the command line

Prerequisite: you've installed the package globally.

If you want to run an analysis without having to configure anything in the first place, simply run the sonar-scanner command. The following example assumes that you have installed SonarQube locally:

cd my-project
sonar-scanner

Specifying properties/settings

  • If there's a package.json file in the folder, it will be read to feed the analysis with basic information (like project name or version)
  • If there's a sonar-project.properties file in the folder, it will behave like the original SonarScanner
  • Additional analysis parameters can be passed on the command line using the standard -Dsonar.xxx=yyy syntax
    • Example:

      sonar-scanner -Dsonar.host.url=https://myserver.com -Dsonar.login=019d1e2e04e

FAQ

I constantly get "Impossible to download and extract binary [...] In such situation, the best solution is to install the standard SonarScanner", what can I do?

You can install manually the standard SonarScanner, which requires to have a Java Runtime Environment available too (Java 8+). Once this is done, you can replace the 2nd line of the example by:

var scanner = require('sonarqube-scanner').customScanner;

In my Docker container, the scanner fails with ".../jre/bin/java: not found", how do I solve this?

You are probably relying on Alpine for your Docker image, and Alpine does not include glibc by default. It needs to be installed manually.

Thanks to Philipp Eschenbach for troubleshooting this on issue #59.

Download From Mirrors

By default, the scanner binaries are downloaded from https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/. To use a custom mirror, set $SONAR_SCANNER_MIRROR. Or download precise version with $SONAR_SCANNER_VERSION

Example:

export SONAR_SCANNER_MIRROR=https://npm.taobao.org/mirrors/sonar-scanner/
export SONAR_SCANNER_VERSION=3.2.0.1227

or alternatively set variable in .npmrc

    sonar_scanner_mirror=https://npm.taobao.org/mirrors/sonar-scanner/
    sonar_scanner_version=3.2.0.1227

Specifying the cache folder

By default, the scanner binaries are cached into $HOME/.sonar/native-sonar-scanner folder. To use a custom cache fodler instead of $HOME, set $SONAR_BINARY_CACHE.

Example:

export SONAR_BINARY_CACHE=/Users/myaccount/cache

or alternatively set variable in .npmrc

    sonar_binary_cache=/Users/myaccount/cache

License

sonarqube-scanner is licensed under the LGPL v3 License.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].