kolekti_analizo 5.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.config/cucumber.yml +11 -0
- data/.gitignore +10 -0
- data/.rspec +1 -0
- data/.ruby-gemset +1 -0
- data/.ruby-version +1 -0
- data/.travis.yml +23 -0
- data/CHANGELOG.md +50 -0
- data/Gemfile +4 -0
- data/LICENSE +165 -0
- data/README.md +37 -0
- data/Rakefile +10 -0
- data/bin/console +14 -0
- data/bin/setup +7 -0
- data/gem_tasks/cucumber.rake +27 -0
- data/kolekti_analizo.gemspec +37 -0
- data/lib/kolekti_analizo.rb +7 -0
- data/lib/kolekti_analizo/collector.rb +78 -0
- data/lib/kolekti_analizo/parser.rb +47 -0
- data/lib/kolekti_analizo/version.rb +3 -0
- metadata +208 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: faa131da0c1dfe3888c404c5299fde826ddf27a9
|
4
|
+
data.tar.gz: '05932a5ec83be4eeac9150b3a3f22b91393d4659'
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 1ea8fa7cdc55aa1efdb9c4a9cde8fbe1375fa2bf35b0e6aef8d183af09cbf419e96d878541bf5c8ffb36551f154cd3701b18456cce0edf76971e6ca59c9a04c1
|
7
|
+
data.tar.gz: 792d928c53cc51b75c081a065e6c979275efec6e41487ae158735db3cfbdf95cced97588d40714707edd545eb7b8b172b3a1ce2a3106ab38df9e6bedf0dac8d2
|
@@ -0,0 +1,11 @@
|
|
1
|
+
# Copied the file generated by cucumber-rails
|
2
|
+
|
3
|
+
<%
|
4
|
+
rerun = File.file?('rerun.txt') ? IO.read('rerun.txt') : ""
|
5
|
+
rerun_opts = rerun.to_s.strip.empty? ? "--format #{ENV['CUCUMBER_FORMAT'] || 'progress'} features" : "--format #{ENV['CUCUMBER_FORMAT'] || 'pretty'} #{rerun}"
|
6
|
+
std_opts = "--format #{ENV['CUCUMBER_FORMAT'] || 'pretty'} --strict --tags ~@wip -r features/support -r features/step_definitions"
|
7
|
+
%>
|
8
|
+
|
9
|
+
default: <%= std_opts %> features
|
10
|
+
wip: --tags @wip:3 --wip features
|
11
|
+
rerun: <%= rerun_opts %> --format rerun --out rerun.txt --strict --tags ~@wip
|
data/.gitignore
ADDED
data/.rspec
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
--color
|
data/.ruby-gemset
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
kolekti_analizo
|
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
2.4.1
|
data/.travis.yml
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
language: ruby
|
2
|
+
|
3
|
+
rvm:
|
4
|
+
- 2.3.0
|
5
|
+
|
6
|
+
before_install:
|
7
|
+
- gem install bundler -v 1.11.2
|
8
|
+
# Set script configuration for installing Analizo
|
9
|
+
- export ANALIZO_VERSION='1.17.0' # Version >1.17.0 needs Ubuntu 13.10/Debian 7
|
10
|
+
# Remove bugged libzmq3 package, see https://github.com/travis-ci/travis-ci/issues/982 and https://github.com/travis-ci/travis-ci/issues/1715 for details
|
11
|
+
- sudo apt-get remove libzmq3
|
12
|
+
- sudo bash -c "echo \"deb http://analizo.org/download/ ./\" > /etc/apt/sources.list.d/analizo.list"
|
13
|
+
- sudo bash -c "echo \"deb-src http://analizo.org/download/ ./\" >> /etc/apt/sources.list.d/analizo.list"
|
14
|
+
- wget -O - http://analizo.org/download/signing-key.asc | sudo apt-key add -
|
15
|
+
- sudo apt-get update -qq
|
16
|
+
- sudo DEBIAN_FRONTEND=noninteractive apt-get install -y analizo=${ANALIZO_VERSION} subversion git
|
17
|
+
|
18
|
+
notifications:
|
19
|
+
email:
|
20
|
+
recipients:
|
21
|
+
- mezuro-core@lists.ime.usp.br
|
22
|
+
on_success: change
|
23
|
+
on_failure: always
|
data/CHANGELOG.md
ADDED
@@ -0,0 +1,50 @@
|
|
1
|
+
# Revision history for Kolekti Analizo
|
2
|
+
|
3
|
+
The Kolekti Analizo gem implements a collector for C, C++ and Java using
|
4
|
+
Analizo with Kolekti
|
5
|
+
|
6
|
+
## Unreleased
|
7
|
+
|
8
|
+
## v5.0.0 - 05/03/2018
|
9
|
+
|
10
|
+
* Fix unknown metric default value fetching error type (Using UnavailableMetricError)
|
11
|
+
* Update to Ruby 2.4.1
|
12
|
+
* Restrict codeclimate-test-reporter version
|
13
|
+
* Development on Mezuro's single repository
|
14
|
+
|
15
|
+
## v0.0.5 - 15/04/2016
|
16
|
+
|
17
|
+
* Add proper cucumber integration
|
18
|
+
* Fix RSpec integration
|
19
|
+
* Add travis script
|
20
|
+
* Update kolekti
|
21
|
+
|
22
|
+
## v0.0.4 - 23/03/2016
|
23
|
+
|
24
|
+
* Use symbols instead of strings on supported_metrics code
|
25
|
+
|
26
|
+
## v0.0.2 / v0.0.3 - 01/03/2016
|
27
|
+
|
28
|
+
* Adapt kolekti_analizo to the new Kolekti API
|
29
|
+
|
30
|
+
## v0.0.1 - 19/02/2016
|
31
|
+
|
32
|
+
* Initial release
|
33
|
+
|
34
|
+
---
|
35
|
+
|
36
|
+
Kolekti Analizo. Copyright (C) 2016-2018 The Mezuro Team
|
37
|
+
|
38
|
+
This program is free software: you can redistribute it and/or modify it under
|
39
|
+
the terms of the GNU Affero General Public License as published by the Free
|
40
|
+
Software Foundation, either version 3 of the License, or (at your option) any
|
41
|
+
later version.
|
42
|
+
|
43
|
+
This program is distributed in the hope that it will be useful, but WITHOUT
|
44
|
+
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
45
|
+
FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
46
|
+
details.
|
47
|
+
|
48
|
+
You should have received a copy of the GNU Affero General Public License along
|
49
|
+
with this program. If not, see <http://www.gnu.org/licenses/>.
|
50
|
+
|
data/Gemfile
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,165 @@
|
|
1
|
+
GNU LESSER GENERAL PUBLIC LICENSE
|
2
|
+
Version 3, 29 June 2007
|
3
|
+
|
4
|
+
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
|
5
|
+
Everyone is permitted to copy and distribute verbatim copies
|
6
|
+
of this license document, but changing it is not allowed.
|
7
|
+
|
8
|
+
|
9
|
+
This version of the GNU Lesser General Public License incorporates
|
10
|
+
the terms and conditions of version 3 of the GNU General Public
|
11
|
+
License, supplemented by the additional permissions listed below.
|
12
|
+
|
13
|
+
0. Additional Definitions.
|
14
|
+
|
15
|
+
As used herein, "this License" refers to version 3 of the GNU Lesser
|
16
|
+
General Public License, and the "GNU GPL" refers to version 3 of the GNU
|
17
|
+
General Public License.
|
18
|
+
|
19
|
+
"The Library" refers to a covered work governed by this License,
|
20
|
+
other than an Application or a Combined Work as defined below.
|
21
|
+
|
22
|
+
An "Application" is any work that makes use of an interface provided
|
23
|
+
by the Library, but which is not otherwise based on the Library.
|
24
|
+
Defining a subclass of a class defined by the Library is deemed a mode
|
25
|
+
of using an interface provided by the Library.
|
26
|
+
|
27
|
+
A "Combined Work" is a work produced by combining or linking an
|
28
|
+
Application with the Library. The particular version of the Library
|
29
|
+
with which the Combined Work was made is also called the "Linked
|
30
|
+
Version".
|
31
|
+
|
32
|
+
The "Minimal Corresponding Source" for a Combined Work means the
|
33
|
+
Corresponding Source for the Combined Work, excluding any source code
|
34
|
+
for portions of the Combined Work that, considered in isolation, are
|
35
|
+
based on the Application, and not on the Linked Version.
|
36
|
+
|
37
|
+
The "Corresponding Application Code" for a Combined Work means the
|
38
|
+
object code and/or source code for the Application, including any data
|
39
|
+
and utility programs needed for reproducing the Combined Work from the
|
40
|
+
Application, but excluding the System Libraries of the Combined Work.
|
41
|
+
|
42
|
+
1. Exception to Section 3 of the GNU GPL.
|
43
|
+
|
44
|
+
You may convey a covered work under sections 3 and 4 of this License
|
45
|
+
without being bound by section 3 of the GNU GPL.
|
46
|
+
|
47
|
+
2. Conveying Modified Versions.
|
48
|
+
|
49
|
+
If you modify a copy of the Library, and, in your modifications, a
|
50
|
+
facility refers to a function or data to be supplied by an Application
|
51
|
+
that uses the facility (other than as an argument passed when the
|
52
|
+
facility is invoked), then you may convey a copy of the modified
|
53
|
+
version:
|
54
|
+
|
55
|
+
a) under this License, provided that you make a good faith effort to
|
56
|
+
ensure that, in the event an Application does not supply the
|
57
|
+
function or data, the facility still operates, and performs
|
58
|
+
whatever part of its purpose remains meaningful, or
|
59
|
+
|
60
|
+
b) under the GNU GPL, with none of the additional permissions of
|
61
|
+
this License applicable to that copy.
|
62
|
+
|
63
|
+
3. Object Code Incorporating Material from Library Header Files.
|
64
|
+
|
65
|
+
The object code form of an Application may incorporate material from
|
66
|
+
a header file that is part of the Library. You may convey such object
|
67
|
+
code under terms of your choice, provided that, if the incorporated
|
68
|
+
material is not limited to numerical parameters, data structure
|
69
|
+
layouts and accessors, or small macros, inline functions and templates
|
70
|
+
(ten or fewer lines in length), you do both of the following:
|
71
|
+
|
72
|
+
a) Give prominent notice with each copy of the object code that the
|
73
|
+
Library is used in it and that the Library and its use are
|
74
|
+
covered by this License.
|
75
|
+
|
76
|
+
b) Accompany the object code with a copy of the GNU GPL and this license
|
77
|
+
document.
|
78
|
+
|
79
|
+
4. Combined Works.
|
80
|
+
|
81
|
+
You may convey a Combined Work under terms of your choice that,
|
82
|
+
taken together, effectively do not restrict modification of the
|
83
|
+
portions of the Library contained in the Combined Work and reverse
|
84
|
+
engineering for debugging such modifications, if you also do each of
|
85
|
+
the following:
|
86
|
+
|
87
|
+
a) Give prominent notice with each copy of the Combined Work that
|
88
|
+
the Library is used in it and that the Library and its use are
|
89
|
+
covered by this License.
|
90
|
+
|
91
|
+
b) Accompany the Combined Work with a copy of the GNU GPL and this license
|
92
|
+
document.
|
93
|
+
|
94
|
+
c) For a Combined Work that displays copyright notices during
|
95
|
+
execution, include the copyright notice for the Library among
|
96
|
+
these notices, as well as a reference directing the user to the
|
97
|
+
copies of the GNU GPL and this license document.
|
98
|
+
|
99
|
+
d) Do one of the following:
|
100
|
+
|
101
|
+
0) Convey the Minimal Corresponding Source under the terms of this
|
102
|
+
License, and the Corresponding Application Code in a form
|
103
|
+
suitable for, and under terms that permit, the user to
|
104
|
+
recombine or relink the Application with a modified version of
|
105
|
+
the Linked Version to produce a modified Combined Work, in the
|
106
|
+
manner specified by section 6 of the GNU GPL for conveying
|
107
|
+
Corresponding Source.
|
108
|
+
|
109
|
+
1) Use a suitable shared library mechanism for linking with the
|
110
|
+
Library. A suitable mechanism is one that (a) uses at run time
|
111
|
+
a copy of the Library already present on the user's computer
|
112
|
+
system, and (b) will operate properly with a modified version
|
113
|
+
of the Library that is interface-compatible with the Linked
|
114
|
+
Version.
|
115
|
+
|
116
|
+
e) Provide Installation Information, but only if you would otherwise
|
117
|
+
be required to provide such information under section 6 of the
|
118
|
+
GNU GPL, and only to the extent that such information is
|
119
|
+
necessary to install and execute a modified version of the
|
120
|
+
Combined Work produced by recombining or relinking the
|
121
|
+
Application with a modified version of the Linked Version. (If
|
122
|
+
you use option 4d0, the Installation Information must accompany
|
123
|
+
the Minimal Corresponding Source and Corresponding Application
|
124
|
+
Code. If you use option 4d1, you must provide the Installation
|
125
|
+
Information in the manner specified by section 6 of the GNU GPL
|
126
|
+
for conveying Corresponding Source.)
|
127
|
+
|
128
|
+
5. Combined Libraries.
|
129
|
+
|
130
|
+
You may place library facilities that are a work based on the
|
131
|
+
Library side by side in a single library together with other library
|
132
|
+
facilities that are not Applications and are not covered by this
|
133
|
+
License, and convey such a combined library under terms of your
|
134
|
+
choice, if you do both of the following:
|
135
|
+
|
136
|
+
a) Accompany the combined library with a copy of the same work based
|
137
|
+
on the Library, uncombined with any other library facilities,
|
138
|
+
conveyed under the terms of this License.
|
139
|
+
|
140
|
+
b) Give prominent notice with the combined library that part of it
|
141
|
+
is a work based on the Library, and explaining where to find the
|
142
|
+
accompanying uncombined form of the same work.
|
143
|
+
|
144
|
+
6. Revised Versions of the GNU Lesser General Public License.
|
145
|
+
|
146
|
+
The Free Software Foundation may publish revised and/or new versions
|
147
|
+
of the GNU Lesser General Public License from time to time. Such new
|
148
|
+
versions will be similar in spirit to the present version, but may
|
149
|
+
differ in detail to address new problems or concerns.
|
150
|
+
|
151
|
+
Each version is given a distinguishing version number. If the
|
152
|
+
Library as you received it specifies that a certain numbered version
|
153
|
+
of the GNU Lesser General Public License "or any later version"
|
154
|
+
applies to it, you have the option of following the terms and
|
155
|
+
conditions either of that published version or of any later version
|
156
|
+
published by the Free Software Foundation. If the Library as you
|
157
|
+
received it does not specify a version number of the GNU Lesser
|
158
|
+
General Public License, you may choose any version of the GNU Lesser
|
159
|
+
General Public License ever published by the Free Software Foundation.
|
160
|
+
|
161
|
+
If the Library as you received it specifies that a proxy can decide
|
162
|
+
whether future versions of the GNU Lesser General Public License shall
|
163
|
+
apply, that proxy's public statement of acceptance of any version is
|
164
|
+
permanent authorization for you to choose that version for the
|
165
|
+
Library.
|
data/README.md
ADDED
@@ -0,0 +1,37 @@
|
|
1
|
+
# KolektiAnalizo
|
2
|
+
|
3
|
+
[![Code Climate](https://codeclimate.com/github/mezuro/kolekti_analizo.png)](https://codeclimate.com/github/mezuro/kalibro_client)
|
4
|
+
|
5
|
+
Generic parser for Analizo static code metrics collector.
|
6
|
+
|
7
|
+
## Contributing
|
8
|
+
|
9
|
+
Please, have a look the wiki pages about development workflow and code standards:
|
10
|
+
|
11
|
+
* https://github.com/mezuro/mezuro/wiki/Development-workflow
|
12
|
+
* https://github.com/mezuro/mezuro/wiki/Standards
|
13
|
+
|
14
|
+
## Installation
|
15
|
+
|
16
|
+
Add this line to your application's Gemfile:
|
17
|
+
|
18
|
+
gem 'kolekti_analizo'
|
19
|
+
|
20
|
+
And then execute:
|
21
|
+
|
22
|
+
$ bundle
|
23
|
+
|
24
|
+
Or install it yourself as:
|
25
|
+
|
26
|
+
$ gem install kolekti_analizo
|
27
|
+
|
28
|
+
## Usage
|
29
|
+
|
30
|
+
Just register it into Kolekti with
|
31
|
+
|
32
|
+
```ruby
|
33
|
+
require 'kolekti'
|
34
|
+
require 'kolekti_analizo'
|
35
|
+
|
36
|
+
Kolekti.register_collector(Kolekti::Analizo::Collector.new)
|
37
|
+
```
|
data/Rakefile
ADDED
@@ -0,0 +1,10 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
2
|
+
require "rspec/core/rake_task"
|
3
|
+
|
4
|
+
RSpec::Core::RakeTask.new(:spec)
|
5
|
+
|
6
|
+
# Copied from https://github.com/cucumber/cucumber-ruby/blob/master/Rakefile#L6
|
7
|
+
$:.unshift(File.dirname(__FILE__) + '/lib')
|
8
|
+
Dir['gem_tasks/**/*.rake'].each { |rake| load rake }
|
9
|
+
|
10
|
+
task :default => [:spec, :cucumber]
|
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "kolekti_analizo"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start
|
data/bin/setup
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
# Copied from https://github.com/cucumber/cucumber-ruby/blob/master/gem_tasks/cucumber.rake
|
2
|
+
|
3
|
+
require 'cucumber/rake/task'
|
4
|
+
require 'cucumber/platform'
|
5
|
+
|
6
|
+
class Cucumber::Rake::Task
|
7
|
+
def set_profile_for_current_ruby
|
8
|
+
self.profile = if Cucumber::JRUBY
|
9
|
+
Cucumber::WINDOWS ? 'jruby_win' : 'jruby'
|
10
|
+
elsif Cucumber::WINDOWS_MRI
|
11
|
+
'windows_mri'
|
12
|
+
elsif Cucumber::RUBY_1_9
|
13
|
+
'ruby_1_9'
|
14
|
+
elsif Cucumber::RUBY_2_0
|
15
|
+
'ruby_2_0'
|
16
|
+
elsif Cucumber::RUBY_2_1
|
17
|
+
'ruby_2_1'
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
Cucumber::Rake::Task.new(:features) do |t|
|
23
|
+
t.fork = true
|
24
|
+
t.set_profile_for_current_ruby
|
25
|
+
end
|
26
|
+
|
27
|
+
task :cucumber => :features
|
@@ -0,0 +1,37 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
version = File.read(File.expand_path("../../VERSION", __dir__)).strip
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "kolekti_analizo"
|
8
|
+
spec.version = version
|
9
|
+
spec.authors = ["Daniel Miranda",
|
10
|
+
"Diego Araújo",
|
11
|
+
"Eduardo Araújo",
|
12
|
+
"Rafael Reggiani Manzo"]
|
13
|
+
spec.email = ["danielkza2@gmail.com",
|
14
|
+
"diegoamc90@gmail.com",
|
15
|
+
"duduktamg@hotmail.com",
|
16
|
+
"rr.manzo@protonmail.com"]
|
17
|
+
|
18
|
+
spec.summary = 'Metric collecting support for C, C++ and JAVA that servers Kolekti.'
|
19
|
+
spec.homepage = 'https://gitlab.com/mezuro/mezuro/tree/master/kalibro/kolekti_analizo'
|
20
|
+
|
21
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
22
|
+
spec.bindir = "exe"
|
23
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
24
|
+
spec.require_paths = ["lib"]
|
25
|
+
|
26
|
+
spec.add_dependency "kolekti", "~> 1.1"
|
27
|
+
|
28
|
+
spec.add_development_dependency "bundler", "~> 1.10"
|
29
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
30
|
+
spec.add_development_dependency "rspec"
|
31
|
+
spec.add_development_dependency "cucumber", "~> 2.1.0"
|
32
|
+
spec.add_development_dependency "mocha", "~> 1.1.0"
|
33
|
+
spec.add_development_dependency "simplecov"
|
34
|
+
spec.add_development_dependency "factory_girl", "~> 4.5.0"
|
35
|
+
spec.add_development_dependency "codeclimate-test-reporter", '< 1.0.0'
|
36
|
+
spec.add_development_dependency "byebug"
|
37
|
+
end
|
@@ -0,0 +1,78 @@
|
|
1
|
+
require 'kalibro_client'
|
2
|
+
require 'kolekti/collector'
|
3
|
+
require 'kolekti/errors'
|
4
|
+
|
5
|
+
require 'kolekti_analizo/parser'
|
6
|
+
|
7
|
+
module Kolekti
|
8
|
+
module Analizo
|
9
|
+
class Collector < Kolekti::Collector
|
10
|
+
def initialize
|
11
|
+
super('Analizo', 'description', load_analizo_supported_metrics)
|
12
|
+
end
|
13
|
+
|
14
|
+
def self.available?
|
15
|
+
system('analizo --version', [:out, :err] => '/dev/null') ? true : false
|
16
|
+
end
|
17
|
+
|
18
|
+
def collect_metrics(code_directory, wanted_metric_configurations, persistence_strategy)
|
19
|
+
parser = Analizo::Parser.new(wanted_metric_configurations, persistence_strategy)
|
20
|
+
result = run code_directory
|
21
|
+
parser.parse_all(result)
|
22
|
+
end
|
23
|
+
|
24
|
+
def default_value_from(metric_configuration)
|
25
|
+
metric = !metric_configuration.nil? ? metric_configuration.metric : nil
|
26
|
+
if metric.nil? || metric.type != 'NativeMetricSnapshot' || metric.metric_collector_name != self.name
|
27
|
+
raise Kolekti::UnavailableMetricError.new("Metric configuration does not belong to Analizo")
|
28
|
+
end
|
29
|
+
|
30
|
+
0.0
|
31
|
+
end
|
32
|
+
|
33
|
+
def clean(code_directory, wanted_metric_configurations)
|
34
|
+
# pass
|
35
|
+
end
|
36
|
+
|
37
|
+
protected
|
38
|
+
|
39
|
+
def load_analizo_supported_metrics
|
40
|
+
supported_metrics = {}
|
41
|
+
global = true
|
42
|
+
metric_list.each_line do |line|
|
43
|
+
if line.include?("-")
|
44
|
+
code = line[/^[^ ]*/] # From the beginning of line to the first space
|
45
|
+
name = line[/- .*$/].slice(2..-1) # After the "- " to the end of line
|
46
|
+
scope = global ? :SOFTWARE : :CLASS
|
47
|
+
supported_metrics[code.to_sym] = KalibroClient::Entities::Miscellaneous::NativeMetric.new(
|
48
|
+
name, code, scope, [:C, :CPP, :JAVA], "Analizo")
|
49
|
+
elsif line.include?("Module Metrics:")
|
50
|
+
global = false
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
supported_metrics
|
55
|
+
end
|
56
|
+
|
57
|
+
def run(code_directory)
|
58
|
+
results = `analizo metrics #{code_directory}`
|
59
|
+
raise Kolekti::CollectorError.new("Analizo failed with exit status: #{$?.exitstatus}") unless $?.success?
|
60
|
+
results
|
61
|
+
end
|
62
|
+
|
63
|
+
def metric_list
|
64
|
+
readio, writeio = IO.pipe
|
65
|
+
|
66
|
+
success = system('analizo metrics --list', out: writeio)
|
67
|
+
writeio.close
|
68
|
+
|
69
|
+
if success
|
70
|
+
readio.read
|
71
|
+
else
|
72
|
+
raise Kolekti::CollectorError.new("Analizo failed")
|
73
|
+
end
|
74
|
+
|
75
|
+
end
|
76
|
+
end
|
77
|
+
end
|
78
|
+
end
|
@@ -0,0 +1,47 @@
|
|
1
|
+
module Kolekti
|
2
|
+
module Analizo
|
3
|
+
class Parser
|
4
|
+
def initialize(wanted_metric_configurations, persistence_strategy)
|
5
|
+
@wanted_metric_configurations = wanted_metric_configurations
|
6
|
+
@persistence_strategy = persistence_strategy
|
7
|
+
end
|
8
|
+
|
9
|
+
def parse_all(output)
|
10
|
+
YAML.load_documents(output).each do |hash|
|
11
|
+
parse(hash)
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
private
|
16
|
+
|
17
|
+
def parse_file_name(file_name)
|
18
|
+
without_extension = file_name.rpartition('.').first
|
19
|
+
without_extension.gsub('.', '_').gsub('/', '.')
|
20
|
+
end
|
21
|
+
|
22
|
+
def parse_class_name(analizo_module_name)
|
23
|
+
analizo_module_name.split('::').join('.')
|
24
|
+
end
|
25
|
+
|
26
|
+
def module_name(file_name, analizo_module_name)
|
27
|
+
"#{parse_file_name(file_name)}.#{parse_class_name(analizo_module_name)}"
|
28
|
+
end
|
29
|
+
|
30
|
+
def parse(result_map)
|
31
|
+
result_map.each do |code, value|
|
32
|
+
metric_configuration = @wanted_metric_configurations[code]
|
33
|
+
next if metric_configuration.nil?
|
34
|
+
|
35
|
+
if result_map['_filename'].nil?
|
36
|
+
@persistence_strategy.create_tree_metric_result(
|
37
|
+
metric_configuration, "ROOT", value, KalibroClient::Entities::Miscellaneous::Granularity::SOFTWARE)
|
38
|
+
else
|
39
|
+
name = module_name(result_map['_filename'].last, result_map['_module'])
|
40
|
+
@persistence_strategy.create_tree_metric_result(
|
41
|
+
metric_configuration, name, value, KalibroClient::Entities::Miscellaneous::Granularity::CLASS)
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
metadata
ADDED
@@ -0,0 +1,208 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: kolekti_analizo
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 5.0.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Daniel Miranda
|
8
|
+
- Diego Araújo
|
9
|
+
- Eduardo Araújo
|
10
|
+
- Rafael Reggiani Manzo
|
11
|
+
autorequire:
|
12
|
+
bindir: exe
|
13
|
+
cert_chain: []
|
14
|
+
date: 2018-03-06 00:00:00.000000000 Z
|
15
|
+
dependencies:
|
16
|
+
- !ruby/object:Gem::Dependency
|
17
|
+
name: kolekti
|
18
|
+
requirement: !ruby/object:Gem::Requirement
|
19
|
+
requirements:
|
20
|
+
- - "~>"
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: '1.1'
|
23
|
+
type: :runtime
|
24
|
+
prerelease: false
|
25
|
+
version_requirements: !ruby/object:Gem::Requirement
|
26
|
+
requirements:
|
27
|
+
- - "~>"
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '1.1'
|
30
|
+
- !ruby/object:Gem::Dependency
|
31
|
+
name: bundler
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
33
|
+
requirements:
|
34
|
+
- - "~>"
|
35
|
+
- !ruby/object:Gem::Version
|
36
|
+
version: '1.10'
|
37
|
+
type: :development
|
38
|
+
prerelease: false
|
39
|
+
version_requirements: !ruby/object:Gem::Requirement
|
40
|
+
requirements:
|
41
|
+
- - "~>"
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: '1.10'
|
44
|
+
- !ruby/object:Gem::Dependency
|
45
|
+
name: rake
|
46
|
+
requirement: !ruby/object:Gem::Requirement
|
47
|
+
requirements:
|
48
|
+
- - "~>"
|
49
|
+
- !ruby/object:Gem::Version
|
50
|
+
version: '10.0'
|
51
|
+
type: :development
|
52
|
+
prerelease: false
|
53
|
+
version_requirements: !ruby/object:Gem::Requirement
|
54
|
+
requirements:
|
55
|
+
- - "~>"
|
56
|
+
- !ruby/object:Gem::Version
|
57
|
+
version: '10.0'
|
58
|
+
- !ruby/object:Gem::Dependency
|
59
|
+
name: rspec
|
60
|
+
requirement: !ruby/object:Gem::Requirement
|
61
|
+
requirements:
|
62
|
+
- - ">="
|
63
|
+
- !ruby/object:Gem::Version
|
64
|
+
version: '0'
|
65
|
+
type: :development
|
66
|
+
prerelease: false
|
67
|
+
version_requirements: !ruby/object:Gem::Requirement
|
68
|
+
requirements:
|
69
|
+
- - ">="
|
70
|
+
- !ruby/object:Gem::Version
|
71
|
+
version: '0'
|
72
|
+
- !ruby/object:Gem::Dependency
|
73
|
+
name: cucumber
|
74
|
+
requirement: !ruby/object:Gem::Requirement
|
75
|
+
requirements:
|
76
|
+
- - "~>"
|
77
|
+
- !ruby/object:Gem::Version
|
78
|
+
version: 2.1.0
|
79
|
+
type: :development
|
80
|
+
prerelease: false
|
81
|
+
version_requirements: !ruby/object:Gem::Requirement
|
82
|
+
requirements:
|
83
|
+
- - "~>"
|
84
|
+
- !ruby/object:Gem::Version
|
85
|
+
version: 2.1.0
|
86
|
+
- !ruby/object:Gem::Dependency
|
87
|
+
name: mocha
|
88
|
+
requirement: !ruby/object:Gem::Requirement
|
89
|
+
requirements:
|
90
|
+
- - "~>"
|
91
|
+
- !ruby/object:Gem::Version
|
92
|
+
version: 1.1.0
|
93
|
+
type: :development
|
94
|
+
prerelease: false
|
95
|
+
version_requirements: !ruby/object:Gem::Requirement
|
96
|
+
requirements:
|
97
|
+
- - "~>"
|
98
|
+
- !ruby/object:Gem::Version
|
99
|
+
version: 1.1.0
|
100
|
+
- !ruby/object:Gem::Dependency
|
101
|
+
name: simplecov
|
102
|
+
requirement: !ruby/object:Gem::Requirement
|
103
|
+
requirements:
|
104
|
+
- - ">="
|
105
|
+
- !ruby/object:Gem::Version
|
106
|
+
version: '0'
|
107
|
+
type: :development
|
108
|
+
prerelease: false
|
109
|
+
version_requirements: !ruby/object:Gem::Requirement
|
110
|
+
requirements:
|
111
|
+
- - ">="
|
112
|
+
- !ruby/object:Gem::Version
|
113
|
+
version: '0'
|
114
|
+
- !ruby/object:Gem::Dependency
|
115
|
+
name: factory_girl
|
116
|
+
requirement: !ruby/object:Gem::Requirement
|
117
|
+
requirements:
|
118
|
+
- - "~>"
|
119
|
+
- !ruby/object:Gem::Version
|
120
|
+
version: 4.5.0
|
121
|
+
type: :development
|
122
|
+
prerelease: false
|
123
|
+
version_requirements: !ruby/object:Gem::Requirement
|
124
|
+
requirements:
|
125
|
+
- - "~>"
|
126
|
+
- !ruby/object:Gem::Version
|
127
|
+
version: 4.5.0
|
128
|
+
- !ruby/object:Gem::Dependency
|
129
|
+
name: codeclimate-test-reporter
|
130
|
+
requirement: !ruby/object:Gem::Requirement
|
131
|
+
requirements:
|
132
|
+
- - "<"
|
133
|
+
- !ruby/object:Gem::Version
|
134
|
+
version: 1.0.0
|
135
|
+
type: :development
|
136
|
+
prerelease: false
|
137
|
+
version_requirements: !ruby/object:Gem::Requirement
|
138
|
+
requirements:
|
139
|
+
- - "<"
|
140
|
+
- !ruby/object:Gem::Version
|
141
|
+
version: 1.0.0
|
142
|
+
- !ruby/object:Gem::Dependency
|
143
|
+
name: byebug
|
144
|
+
requirement: !ruby/object:Gem::Requirement
|
145
|
+
requirements:
|
146
|
+
- - ">="
|
147
|
+
- !ruby/object:Gem::Version
|
148
|
+
version: '0'
|
149
|
+
type: :development
|
150
|
+
prerelease: false
|
151
|
+
version_requirements: !ruby/object:Gem::Requirement
|
152
|
+
requirements:
|
153
|
+
- - ">="
|
154
|
+
- !ruby/object:Gem::Version
|
155
|
+
version: '0'
|
156
|
+
description:
|
157
|
+
email:
|
158
|
+
- danielkza2@gmail.com
|
159
|
+
- diegoamc90@gmail.com
|
160
|
+
- duduktamg@hotmail.com
|
161
|
+
- rr.manzo@protonmail.com
|
162
|
+
executables: []
|
163
|
+
extensions: []
|
164
|
+
extra_rdoc_files: []
|
165
|
+
files:
|
166
|
+
- ".config/cucumber.yml"
|
167
|
+
- ".gitignore"
|
168
|
+
- ".rspec"
|
169
|
+
- ".ruby-gemset"
|
170
|
+
- ".ruby-version"
|
171
|
+
- ".travis.yml"
|
172
|
+
- CHANGELOG.md
|
173
|
+
- Gemfile
|
174
|
+
- LICENSE
|
175
|
+
- README.md
|
176
|
+
- Rakefile
|
177
|
+
- bin/console
|
178
|
+
- bin/setup
|
179
|
+
- gem_tasks/cucumber.rake
|
180
|
+
- kolekti_analizo.gemspec
|
181
|
+
- lib/kolekti_analizo.rb
|
182
|
+
- lib/kolekti_analizo/collector.rb
|
183
|
+
- lib/kolekti_analizo/parser.rb
|
184
|
+
- lib/kolekti_analizo/version.rb
|
185
|
+
homepage: https://gitlab.com/mezuro/mezuro/tree/master/kalibro/kolekti_analizo
|
186
|
+
licenses: []
|
187
|
+
metadata: {}
|
188
|
+
post_install_message:
|
189
|
+
rdoc_options: []
|
190
|
+
require_paths:
|
191
|
+
- lib
|
192
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
193
|
+
requirements:
|
194
|
+
- - ">="
|
195
|
+
- !ruby/object:Gem::Version
|
196
|
+
version: '0'
|
197
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
198
|
+
requirements:
|
199
|
+
- - ">="
|
200
|
+
- !ruby/object:Gem::Version
|
201
|
+
version: '0'
|
202
|
+
requirements: []
|
203
|
+
rubyforge_project:
|
204
|
+
rubygems_version: 2.6.11
|
205
|
+
signing_key:
|
206
|
+
specification_version: 4
|
207
|
+
summary: Metric collecting support for C, C++ and JAVA that servers Kolekti.
|
208
|
+
test_files: []
|