branchcov-xmlruby-sonar 0.0.3 → 0.0.5
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/lib/ruby_branch_cover.rb +18 -4
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0f718350097a6d5b7ffa9bd11a464a89e3f6ee7521d471ceba556a6c76f85012
|
4
|
+
data.tar.gz: 787e85b086951b0ae43f104bc5e248c6a8c6431ad78c6b920efffc9b07ed0796
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 839b2c2af6352bcde189532c05b08c0aa44cb58c692449a90a8fb302ff2ef6428dcd9f6cd0937ba3ae357b409bc441e32c0e88860351cd51053f167bf2a85bb6
|
7
|
+
data.tar.gz: e563619942f92391f07801cb4ac818b2e94467cbca9d452d287817400acedade98222bc321b6be70021a89f8124e52c2b35b59e7c2b8f57ec3d85e6d703bdca9
|
data/lib/ruby_branch_cover.rb
CHANGED
@@ -40,18 +40,32 @@ class RubyBranchCover
|
|
40
40
|
end
|
41
41
|
end
|
42
42
|
|
43
|
+
def find_rspec_key(count)
|
44
|
+
key_to_append = 'RSpec'
|
45
|
+
final_key = ''
|
46
|
+
count.times do
|
47
|
+
|index|
|
48
|
+
final_key = final_key + key_to_append
|
49
|
+
if index < count-1
|
50
|
+
final_key = final_key + ', '
|
51
|
+
end
|
52
|
+
end
|
53
|
+
return final_key
|
54
|
+
end
|
55
|
+
|
43
56
|
|
44
|
-
def read_json_and_getxml(filepath)
|
57
|
+
def read_json_and_getxml(filepath, parallelism_count)
|
45
58
|
file = File.read(filepath)
|
46
59
|
data_hash = JSON.parse(file)
|
47
60
|
file_elements = []
|
48
|
-
|
49
|
-
|
61
|
+
rspec_key = find_rspec_key parallelism_count
|
62
|
+
unless data_hash.empty? || data_hash[rspec_key] == nil || data_hash[rspec_key]['coverage'] == nil
|
63
|
+
files_map = data_hash[rspec_key]['coverage']
|
50
64
|
files_map.each do
|
51
65
|
|filename,value|
|
52
66
|
branches = value['branches']
|
53
67
|
line_to_cover_array = []
|
54
|
-
unless branches.keys.size == 0
|
68
|
+
unless branches == nil || branches.keys.size == 0
|
55
69
|
branches.each do
|
56
70
|
|branch, condtions_map|
|
57
71
|
line_number = branch.split(',')[2].strip
|