getclonedata 0.2.1 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/getclonedata/getclonedata_clonerepo.rb +24 -10
- data/lib/getclonedata/version.rb +1 -1
- data/lib/getclonedata.rb +5 -0
- data/spec/clonerepo_spec.rb +15 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c11f4f5f885c086c29a337d67533efaaec59e070
|
4
|
+
data.tar.gz: ac4e3c9ebb61812849ada701250ab8553bcc0038
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 609ecc2d8b5ceab9257fc0920050169634ad6e48a5d367f04f645ca8653cc8ed06b37a8c84edc1d0a808a74f0c7bcd2bacc694e6ba6be2d0d6729755e366f999
|
7
|
+
data.tar.gz: fbc527f85bb3c85eef7c3f96891e71327e41cb4715f79fce481c362257dc2364acd33a6befe8b2a430d941f4cbd818f6c46fcf104d7fa33c6c8322977b2a1b51
|
data/Gemfile.lock
CHANGED
@@ -9,7 +9,7 @@ module GetCloneData
|
|
9
9
|
|
10
10
|
@@itt = 0
|
11
11
|
|
12
|
-
attr_reader :flog, :flog, :flay, :rubocop, :loc
|
12
|
+
attr_reader :flog, :flog, :flay, :rubocop, :loc, :ruby_files
|
13
13
|
|
14
14
|
def initialize(repo_path:)
|
15
15
|
@repo_path = repo_path
|
@@ -44,10 +44,24 @@ module GetCloneData
|
|
44
44
|
@@itt
|
45
45
|
end
|
46
46
|
|
47
|
+
def ruby_files
|
48
|
+
return @ruby_files if @ruby_files
|
49
|
+
|
50
|
+
path_rb_expander = PathExpander.new [@repo_path], "**/*.{rb,rake}"
|
51
|
+
@ruby_files = path_rb_expander.process
|
52
|
+
@ruby_files
|
53
|
+
end
|
54
|
+
|
47
55
|
def get_flog_scores
|
48
56
|
if Dir.exist? @repo_path
|
49
|
-
|
50
|
-
|
57
|
+
flog = Flog.new
|
58
|
+
flog.flog(*ruby_files)
|
59
|
+
#flog.calculate_total_score
|
60
|
+
flog_response = {
|
61
|
+
total_score: flog.total_score,
|
62
|
+
max_score: flog.max_score,
|
63
|
+
average: flog.average
|
64
|
+
}
|
51
65
|
end
|
52
66
|
# reponse is an array of all the flog scores from total , ave, each method...
|
53
67
|
flog_response if flog_response
|
@@ -55,20 +69,20 @@ module GetCloneData
|
|
55
69
|
|
56
70
|
def get_flay_score
|
57
71
|
if Dir.exist? @repo_path
|
58
|
-
flay =
|
72
|
+
flay = Flay.new
|
73
|
+
flay.process(*ruby_files)
|
74
|
+
flay.analyze
|
75
|
+
flay = flay.summary.values.first
|
59
76
|
end
|
60
77
|
flay if flay
|
61
78
|
end
|
62
79
|
|
63
80
|
def get_rubocop_errors
|
64
|
-
holder = Array.new()
|
65
81
|
if Dir.exist? @repo_path
|
66
|
-
rubocop_response = `rubocop #{@repo_path}`
|
67
|
-
|
68
|
-
|
82
|
+
rubocop_response = `rubocop #{@repo_path} --format json`
|
83
|
+
summary = JSON.parse(rubocop_response, :symbolize_names => true)[:summary]
|
84
|
+
summary
|
69
85
|
end
|
70
|
-
# response is array [no. of files, no. of offenses]
|
71
|
-
holder
|
72
86
|
end
|
73
87
|
|
74
88
|
def get_loc
|
data/lib/getclonedata/version.rb
CHANGED
data/lib/getclonedata.rb
CHANGED
data/spec/clonerepo_spec.rb
CHANGED
@@ -18,10 +18,24 @@ describe 'Github specifications' do
|
|
18
18
|
end
|
19
19
|
|
20
20
|
it 'HAPPY: should contain flog' do
|
21
|
-
|
21
|
+
flog = {
|
22
|
+
total_score: 407.33109526582183,
|
23
|
+
max_score: 142.57356872856903,
|
24
|
+
average: 31.333161174293988
|
25
|
+
}
|
26
|
+
@repository.get_flog_scores.must_equal flog
|
22
27
|
end
|
23
28
|
|
24
29
|
it 'HAPPY: should contain flay' do
|
25
30
|
@repository.get_flay_score.must_be_instance_of Float
|
26
31
|
end
|
32
|
+
|
33
|
+
it 'HAPPY: should contain rubocop summary' do
|
34
|
+
summary = {
|
35
|
+
offense_count: 578,
|
36
|
+
target_file_count: 6,
|
37
|
+
inspected_file_count: 6
|
38
|
+
}
|
39
|
+
@repository.get_rubocop_errors.must_equal summary
|
40
|
+
end
|
27
41
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: getclonedata
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Renaud Jollet
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2016-12-
|
13
|
+
date: 2016-12-30 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: http
|