repo_analyzer 1.0.0 → 1.2.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/.circleci/config.yml +2 -2
- data/.gitignore +1 -1
- data/.ruby-version +1 -1
- data/CHANGELOG.md +13 -0
- data/Gemfile.lock +2 -1
- data/app/extractors/repo_analyzer/tests_info_extractor.rb +39 -1
- data/lib/repo_analyzer/version.rb +1 -1
- data/spec/assets/test_project/coverage/coverage.json +1391 -0
- data/spec/extractors/tests_info_extractor_spec.rb +14 -0
- metadata +5 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9d1b86e2ab569ab6ba492b0e2ad78284a16d5224a66bf8ef781ebbceffdbbc5b
|
4
|
+
data.tar.gz: 179576b67a152a131c89f0c873e018a01df9cc20509c72ef30391304701a87f3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 886b9d9b023b032d75bd3d1f8958d9a674aae36b49cf79a8635179d6c5dc419e489935797ec4bd9f3db64cd05ea23c827fecc2d09a3a066843bb92f4c7f0944b
|
7
|
+
data.tar.gz: 0d6465e08b70b38b568b5009ce16f3151455f3d017b9c4afa99bd1234aa7ad13fa1754351022e197f6241d3791f36476ed4151acfbe7e5e4f063a06cd69fe1b6
|
data/.circleci/config.yml
CHANGED
@@ -16,7 +16,7 @@ executors:
|
|
16
16
|
default: "2.7"
|
17
17
|
type: string
|
18
18
|
docker:
|
19
|
-
- image:
|
19
|
+
- image: cimg/ruby:<<parameters.ruby-version>>-node
|
20
20
|
environment: *env-vars
|
21
21
|
|
22
22
|
commands:
|
@@ -93,7 +93,7 @@ workflows:
|
|
93
93
|
- test:
|
94
94
|
matrix:
|
95
95
|
parameters:
|
96
|
-
ruby-version: ["2.7"]
|
96
|
+
ruby-version: ["2.7", "3.1"]
|
97
97
|
- deploy:
|
98
98
|
context: org-global
|
99
99
|
filters:
|
data/.gitignore
CHANGED
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
3.1
|
data/CHANGELOG.md
CHANGED
@@ -2,6 +2,19 @@
|
|
2
2
|
All notable changes to this project will be documented in this file.
|
3
3
|
This project adheres to [Semantic Versioning](http://semver.org/).
|
4
4
|
|
5
|
+
|
6
|
+
### v1.2.0
|
7
|
+
|
8
|
+
#### Added
|
9
|
+
|
10
|
+
* Add total coverage % to simplecov results on tests info extractor.
|
11
|
+
|
12
|
+
### v1.1.0
|
13
|
+
|
14
|
+
#### Added
|
15
|
+
|
16
|
+
* Extract code coverage using Simplecov JSON formatter's generated file.
|
17
|
+
|
5
18
|
### v1.0.0
|
6
19
|
|
7
20
|
* Initial release.
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
repo_analyzer (1.
|
4
|
+
repo_analyzer (1.2.0)
|
5
5
|
brakeman
|
6
6
|
octokit (~> 4.0)
|
7
7
|
rails (>= 6.0)
|
@@ -300,6 +300,7 @@ GEM
|
|
300
300
|
|
301
301
|
PLATFORMS
|
302
302
|
x86_64-darwin-20
|
303
|
+
x86_64-darwin-21
|
303
304
|
x86_64-linux
|
304
305
|
|
305
306
|
DEPENDENCIES
|
@@ -36,7 +36,8 @@ module RepoAnalyzer
|
|
36
36
|
swagger_tests_count: swagger_tests,
|
37
37
|
system_tests_count: system_tests_count,
|
38
38
|
jest_tests_count: jest_tests_count,
|
39
|
-
rails_code_coverage: rails_code_coverage.merge(total: coverage_total)
|
39
|
+
rails_code_coverage: rails_code_coverage.merge(total: coverage_total),
|
40
|
+
simplecov_coverage: simplecov_coverage.merge(total: simplecov_total_percentage)
|
40
41
|
}
|
41
42
|
end
|
42
43
|
|
@@ -54,6 +55,34 @@ module RepoAnalyzer
|
|
54
55
|
end
|
55
56
|
end
|
56
57
|
|
58
|
+
def simplecov_coverage
|
59
|
+
@simplecov_coverage ||= TESTEABLE_RAILS_RESOURCES.inject({}) do |data, resource|
|
60
|
+
covered_percent = coverage_file.dig(
|
61
|
+
"groups", resource.to_s.camelize, "lines", "covered_percent"
|
62
|
+
)
|
63
|
+
value = covered_percent&.to_f&.round(2)
|
64
|
+
data[resource] = value
|
65
|
+
add_value_to_simplecov_total(value) if value
|
66
|
+
data
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
def add_value_to_simplecov_total(value)
|
71
|
+
@simplecov_covered_total ||= 0
|
72
|
+
@simplecov_covered_total += value
|
73
|
+
@simplecov_total ||= 0
|
74
|
+
@simplecov_total += 100
|
75
|
+
end
|
76
|
+
|
77
|
+
def coverage_file
|
78
|
+
@coverage_file ||= begin
|
79
|
+
content = project_data_bridge.file_content("coverage/coverage.json")
|
80
|
+
return {} if content.blank?
|
81
|
+
|
82
|
+
JSON.parse(content).with_indifferent_access
|
83
|
+
end
|
84
|
+
end
|
85
|
+
|
57
86
|
def rails_code_coverage
|
58
87
|
TESTEABLE_RAILS_RESOURCES.inject({}) do |data, resource|
|
59
88
|
tests_count = project_data_bridge.dir_files("spec/#{resource}").count do |file|
|
@@ -77,6 +106,15 @@ module RepoAnalyzer
|
|
77
106
|
true
|
78
107
|
end
|
79
108
|
|
109
|
+
def simplecov_total_percentage
|
110
|
+
@simplecov_total_percentage ||= begin
|
111
|
+
return if @simplecov_covered_total.nil? || @simplecov_total.nil?
|
112
|
+
return 0.0 if @simplecov_total.zero?
|
113
|
+
|
114
|
+
(@simplecov_covered_total / @simplecov_total * 100.0).round(2)
|
115
|
+
end
|
116
|
+
end
|
117
|
+
|
80
118
|
def coverage_total
|
81
119
|
@coverage_total ||= {
|
82
120
|
files_count: 0,
|