bvm 0.3.2 → 0.3.3
Sign up to get free protection for your applications and to get access to all the features.
- data/LICENSE +1 -1
- data/README.md +29 -7
- data/lib/bvm/converter.rb +16 -8
- metadata +14 -15
data/LICENSE
CHANGED
data/README.md
CHANGED
@@ -1,24 +1,46 @@
|
|
1
1
|
BVM (Big Visible Metrics)
|
2
2
|
=========================
|
3
3
|
|
4
|
-
BVM helps you generate Big Visible Charts of Sonar Code Metrics for your
|
5
|
-
utility that parses the data exposed as XML via the Sonar API. It converts this XML into CSV data that is consumable
|
6
|
-
using Microsoft Tree Mapper or a tool of your choice.
|
4
|
+
BVM helps you generate Big Visible Charts of Sonar Code Metrics for your teamspace. It is a simple command line utility that parses the data exposed as XML via the Sonar API. It converts this XML into CSV data that is consumable using [Microsoft Treemapper](http://research.microsoft.com/en-us/downloads/3f3ed95e-26d8-4616-a06c-b609df29756f/default.aspx) or a tool of your choice.
|
7
5
|
|
8
6
|
Installing
|
9
7
|
----------
|
10
8
|
|
11
9
|
Installation is super easy. Just enter:
|
12
10
|
|
13
|
-
gem install bvm
|
11
|
+
gem install bvm
|
12
|
+
|
13
|
+
Once it is installed, you may also want to install Microsoft Treemapper. Download it from Microsoft's [site](http://research.microsoft.com/en-us/downloads/3f3ed95e-26d8-4616-a06c-b609df29756f/default.aspx) and follow the installation instructions.
|
14
14
|
|
15
15
|
Typical Usage
|
16
16
|
-------------
|
17
17
|
|
18
|
-
|
19
|
-
|
18
|
+
This sample generates a CSV file ready for Microsoft Treemapper to use against the Apache's Maven source. The size of the box represents the numbers of lines of code (the ncloc metric) in the class and the color reflects the cyclomatic complextiy. In this case, a complexity of 50 is the threshhold between red and green on the chart.
|
19
|
+
|
20
|
+
curl -X GET "http://nemo.sonarsource.org/api/resources?resource=99176&metrics=ncloc,complexity&depth=-1&qualifiers=CLA&format=xml" | bvm --jar maven --color complexity --invert-color --color-adjust 50 > maven-complexity.csv
|
21
|
+
|
22
|
+
This generates a similar data set for code coverage. In this case, the coverage threshhold is set to 80%.
|
23
|
+
|
24
|
+
curl -X GET "http://nemo.sonarsource.org/api/resources?resource=99176&metrics=ncloc,coverage&depth=-1&qualifiers=CLA&format=xml" | bvm --jar maven --color coverage --color-adjust 80 > maven-coverage.csv
|
25
|
+
|
26
|
+
The Details
|
27
|
+
-----------
|
28
|
+
|
29
|
+
The CSV content that BVM generates consists of the following format:
|
30
|
+
|
31
|
+
<size_metric>,<color_metric>,<jar_name>,<package_name>,<class_name>
|
32
|
+
|
33
|
+
The size metric is self-explanitory. It's the size of the box to be generated. By default is it set to ncloc and this is probably what you will always want. I can be changed using the --size switch and specifing a different Sonar metric.
|
34
|
+
|
35
|
+
The color metric defaults to coverage. You will probably want this to be several different values, depending on the charts you want to generate. It can be specified using the --color switch.
|
36
|
+
|
37
|
+
Microsoft Treemapper expects that negative numbers are red and positive numbers are green but our metrics aren't quite so compliant. The --invert-color switch will multiply the specified color metric by -1 to accomodate the charts you are trying to create. Furthermore, the --color-adjust switch can be given a number that will be added to the specified metric before being outputed. This allows us to set threshholds of tolerance for our charts.
|
38
|
+
|
39
|
+
The JAR name is really just the project name. If you have multiple JARs in your project (and who doesn't) then the --jar switch will allow you to group them all into one file and generate one enormous view of your entire codebase. It defaults to "jar" and you probably always want to override it.
|
40
|
+
|
41
|
+
If you are command line savvy you probably noticed that BVM does not actually operate on files. It reads STDIN and writes STDOUT.
|
20
42
|
|
21
43
|
Copyright
|
22
44
|
---------
|
23
45
|
|
24
|
-
Copyright (c)
|
46
|
+
Copyright (c) 2012 Guy Royse & Alyssa Diaz & Jacob Dingus. See LICENSE for further details.
|
data/lib/bvm/converter.rb
CHANGED
@@ -18,8 +18,10 @@ class Converter
|
|
18
18
|
def convert(input)
|
19
19
|
output = ""
|
20
20
|
metrics = parse_xml input
|
21
|
-
metrics[:resource].
|
22
|
-
|
21
|
+
unless metrics[:resource].nil?
|
22
|
+
metrics[:resource].each do |resource|
|
23
|
+
output << build_output(resource, @jar, @size_metric, @color_metric, @color_adjustment)
|
24
|
+
end
|
23
25
|
end
|
24
26
|
output
|
25
27
|
end
|
@@ -29,13 +31,19 @@ class Converter
|
|
29
31
|
end
|
30
32
|
|
31
33
|
def build_output(resource, jar, size, color, adjust)
|
32
|
-
name = resource[:name][0]
|
33
|
-
size_metric = find_metric resource[:msr], size
|
34
|
-
color_metric = find_metric resource[:msr], color
|
35
|
-
color_metric *= -1 unless not @invert_color_metric
|
36
|
-
color_metric += adjust
|
37
34
|
package = parse_package resource[:key][0]
|
38
|
-
|
35
|
+
name = resource[:name][0]
|
36
|
+
|
37
|
+
unless resource[:msr].nil?
|
38
|
+
size_metric = find_metric resource[:msr], size
|
39
|
+
color_metric = find_metric resource[:msr], color
|
40
|
+
color_metric *= -1 unless not @invert_color_metric
|
41
|
+
color_metric += adjust
|
42
|
+
%Q/#{size_metric},#{color_metric},"#{jar}","#{package}","#{name}"\n/
|
43
|
+
else
|
44
|
+
%Q/1.0,#{adjust},"NotFound","#{package}","#{name}"\n/
|
45
|
+
end
|
46
|
+
|
39
47
|
end
|
40
48
|
|
41
49
|
def find_metric(metrics, key)
|
metadata
CHANGED
@@ -1,21 +1,21 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bvm
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Guy Royse
|
9
9
|
- Alyssa Diaz
|
10
|
+
- Jacob Dingus
|
10
11
|
autorequire:
|
11
12
|
bindir: bin
|
12
13
|
cert_chain: []
|
13
|
-
date:
|
14
|
-
default_executable:
|
14
|
+
date: 2012-03-07 00:00:00.000000000Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: xml-simple
|
18
|
-
requirement: &
|
18
|
+
requirement: &8392128 !ruby/object:Gem::Requirement
|
19
19
|
none: false
|
20
20
|
requirements:
|
21
21
|
- - ~>
|
@@ -23,10 +23,10 @@ dependencies:
|
|
23
23
|
version: 1.0.12
|
24
24
|
type: :runtime
|
25
25
|
prerelease: false
|
26
|
-
version_requirements: *
|
26
|
+
version_requirements: *8392128
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rspec
|
29
|
-
requirement: &
|
29
|
+
requirement: &8391504 !ruby/object:Gem::Requirement
|
30
30
|
none: false
|
31
31
|
requirements:
|
32
32
|
- - ! '>='
|
@@ -34,10 +34,10 @@ dependencies:
|
|
34
34
|
version: 2.3.0
|
35
35
|
type: :development
|
36
36
|
prerelease: false
|
37
|
-
version_requirements: *
|
37
|
+
version_requirements: *8391504
|
38
38
|
- !ruby/object:Gem::Dependency
|
39
39
|
name: rspec-core
|
40
|
-
requirement: &
|
40
|
+
requirement: &8390868 !ruby/object:Gem::Requirement
|
41
41
|
none: false
|
42
42
|
requirements:
|
43
43
|
- - ! '>='
|
@@ -45,10 +45,10 @@ dependencies:
|
|
45
45
|
version: 2.3.1
|
46
46
|
type: :development
|
47
47
|
prerelease: false
|
48
|
-
version_requirements: *
|
48
|
+
version_requirements: *8390868
|
49
49
|
- !ruby/object:Gem::Dependency
|
50
50
|
name: rspec-expectations
|
51
|
-
requirement: &
|
51
|
+
requirement: &8390256 !ruby/object:Gem::Requirement
|
52
52
|
none: false
|
53
53
|
requirements:
|
54
54
|
- - ! '>='
|
@@ -56,9 +56,9 @@ dependencies:
|
|
56
56
|
version: 2.3.0
|
57
57
|
type: :development
|
58
58
|
prerelease: false
|
59
|
-
version_requirements: *
|
59
|
+
version_requirements: *8390256
|
60
60
|
description: Generates CSV files that can be consumed by Microsoft Treemapper from
|
61
|
-
the Sonar API. Reads
|
61
|
+
the Sonar API. Reads stdin and stdout.
|
62
62
|
email:
|
63
63
|
- guy@guyroyse.com
|
64
64
|
executables:
|
@@ -66,14 +66,13 @@ executables:
|
|
66
66
|
extensions: []
|
67
67
|
extra_rdoc_files: []
|
68
68
|
files:
|
69
|
-
- lib/bvm/converter.rb
|
70
69
|
- lib/bvm/bvm_runner.rb
|
70
|
+
- lib/bvm/converter.rb
|
71
71
|
- lib/bvm.rb
|
72
72
|
- lib/bvm_runner.rb
|
73
73
|
- bin/bvm
|
74
74
|
- LICENSE
|
75
75
|
- README.md
|
76
|
-
has_rdoc: true
|
77
76
|
homepage: http://github.com/guyroyse/big-visible-metrics
|
78
77
|
licenses:
|
79
78
|
- MIT
|
@@ -95,7 +94,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
95
94
|
version: 1.3.6
|
96
95
|
requirements: []
|
97
96
|
rubyforge_project:
|
98
|
-
rubygems_version: 1.
|
97
|
+
rubygems_version: 1.8.10
|
99
98
|
signing_key:
|
100
99
|
specification_version: 3
|
101
100
|
summary: Generates CSV files from SONAR metrics
|