Skip to content

Commit 742d48a

Browse files
merged our private ruby sonar plugin repo to our public one
1 parent 7f2669f commit 742d48a

36 files changed

Lines changed: 1809 additions & 494 deletions

README.md

Lines changed: 37 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,40 @@
1-
# Sonar Ruby Plugin
1+
Sonar Ruby Plugin
2+
=================
3+
##Description / Features
4+
The plugin enables analysis of Ruby projects within SonarQube
25

3-
This plugin adds support for projects written in Ruby to be analyzed by Sonar.
6+
Currently the plugin captures basic metrics (Lines of Code, Number of classes and packages, Comment percentage),
7+
complexity on each file, and a visual line-by-line code coverage report.
48

5-
Currently only captures very basic metrics (LOC, Comment %, Overall Coverage %).
6-
Source code displays with simple code highlighting.
9+
It relies on well-known external tools: [SimpleCov](https://github.com/colszowka/simplecov), [SimpleCov-RCov](https://github.com/fguillen/simplecov-rcov) and [Metric_Fu](https://github.com/metricfu/metric_fu/)
710

8-
### Plans include:
9-
* Parsing RCov reports for detailed test coverage metrics
10-
* Parsing Flog reports for complexity score metrics
11+
##Install
12+
Download the plugin into the SONARQUBE_HOME/extensions/plugins directory
13+
14+
##Usage
15+
Make sure the property sonar.language is set to ruby: `sonar.language=ruby` in the sonar-project.properties file
16+
17+
#####Code Coverage
18+
In order for the plugin to report on code coverage, the ruby project needs to be using [simplecov-rcov](https://github.com/fguillen/simplecov-rcov)
19+
to generate a coverage report when you run your tests/specs, please see the gem's homepage [here](https://github.com/fguillen/simplecov-rcov) for installation
20+
and usage instructions.
21+
**Important:** Do not change the output directory for the simplecov-rcov report, leave it as default, or code coverage will not be reported.
22+
23+
#####Code Complexity
24+
In order for the plugin to report on code complexity, [metric_fu](https://github.com/metricfu/metric_fu/) needs to be ran against the ruby project,
25+
which will generate a metric report. Please see the gem's homepage [here](https://github.com/metricfu/metric_fu/) for installation and usage instructions.
26+
**Important:** metric_fu reports on more than just code complexity, however we still recommend to use the metric_fu command: `metric_fu -r`
27+
this will run all metrics. At the very least, Saikuro and Hotspots metrics need to be ran for complexity to be reported.
28+
Also, do not change the output directory for the metric_fu report, leave it as default or code complexity will not be reported
29+
30+
##Future Plans
31+
* Code Duplication
32+
* Code Violations
33+
* Configuration option to specify simplecov-rcov and metric_fu report directories
34+
35+
##Giving Credit
36+
The github project [pica/ruby-sonar-plugin](https://github.com/pica/ruby-sonar-plugin), is where the ruby-sonar-plugin started, rather than reinvent the wheel, we thought it better to enhance it.
37+
We used that plugin as a starting point for basic stats, then, updated the references to their latest versions and added additional metrics like line-by-line code coverage and code complexity.
38+
39+
We referenced the [javascript sonar plugin](https://github.com/SonarCommunity/sonar-javascript) and the [php sonar plugin](https://github.com/SonarCommunity/sonar-php) for complexity and coverage implementation.
40+
Our complexity sensor and code coverage sensor borrow heavily from the javascript plugin's equivalent sensors.

0 commit comments

Comments
 (0)