Skip to content

irfanahmadein/sonar-ruby-plugin

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Sonar Ruby Plugin

SonarQube plugin for analyzing Ruby files

SonarCloud

Requirements

Overview

This is plugin for SonarQube 5.6+ for analysing projects with Ruby content that supports:

  • Rubocop for code quality information
  • Simplecov for unit test coverage information
  • NCLOC metric generation

Configuration

Example project configuration

This is an example of what a project configuration file (sonar-project.properties) could look like:

sonar.projectKey=company:my-application
sonar.projectName=My Application
sonar.projectVersion=1.0
sonar.sourceEncoding=UTF-8
sonar.sources=src/app
sonar.exclusions=**/node_modules/**,**/*.spec.ts
sonar.tests=src/app
sonar.test.inclusions=**/*.spec.ts

sonar.ruby.file.suffixes=rb,ruby
sonar.ruby.coverage.reportPath=coverage/.resultset.json
sonar.ruby.coverage.framework=RSpec
sonar.ruby.rubocopConfig=.rubocop.yml
sonar.ruby.rubocop=/usr/bin/rubocop
sonar.ruby.rubocop.reportPath=rubocop-result.json
sonar.ruby.rubocop.filePath=.

Installation

Manual Installation

Here are the steps to manually install this plugin for use in SonarQube:

  1. Download the plugin jar
  2. Copy the jar into the SonarQube plugin directory (e.g. /opt/sonarqube/extensions/plugins)
  3. Restart SonarQube

Update Center Installation

TODO: Need to get this plugin added to SonarQube's update center

Running the analysis

In order to run the analysis for Ruby you will need to utilize the sonar-scanner application.

  • Run rubocop making sure that the json results file is created
    e.g. rubocop --format=json --out=rubocop-result.json

  • Run your specs (make sure that your sonarqube config points to the right coverage directory )
    e.g. bundle exec rspec spec
    Make sure that your sonarqube config points to the right coverage directory e.g. spec/coverage/.resultset.json

  • Make sure you have a sonar-project.properties file in the root of your project directory

  • run sonar-scanner

About

SonarQube plugin for analyzing Ruby files

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Java 99.0%
  • Other 1.0%