repo_analyzer 1.0.0 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1c041d9cb3adb2da0b9f65b650ac2cea07e03b5cb9c18f91bc088e0d64fdf0aa
4
- data.tar.gz: 7256cb29b42d8be0cf7debeee505b96c038226e5de44718cb10978b75c255472
3
+ metadata.gz: a60dbbb94a7f27c25a22c5ccf343f51417776bcb831a5ce09b182935bcd47747
4
+ data.tar.gz: e98fc9a0bc751b6820e33fda6748886117e18a5eee6001db35564b9d51be3c5d
5
5
  SHA512:
6
- metadata.gz: db7ef6fbb1f035680630a1c31f89ff9e323b2ca0cf37daf43fbdb790a1d7b7cb45eb808f10ab3c3cb5826d5df61302f416a3f8c6417b22d73534591049a0ab50
7
- data.tar.gz: 68e5aa2262cbf3b463c30d4b6f595eeaa6bdd547996f7f1802ab48cf5e92170ff11a0157a2dc5303b07c942ad6137d9b073d10e243eb20741c527c8079b4c88f
6
+ metadata.gz: d44705ef852496e883102f16de06035d749fe94aefb4b5f871193d31d26e08e349f8090707c2feafd63ace0148e04a457931a705813bd0d50ab37b79d9e18b1a
7
+ data.tar.gz: 4115478f54237810e9c89483e14fb2633d9954315b2c895a86cf61ee7f44b7e63856310f89d594110c5ad2d8a1d2f1023ce04037f314f1a0c358996028fb32b7
data/.gitignore CHANGED
@@ -6,4 +6,4 @@ spec/dummy/db/*.sqlite3-journal
6
6
  spec/dummy/log/*.log
7
7
  spec/dummy/tmp/
8
8
  spec/dummy/.sass-cache
9
- coverage/
9
+ /coverage
data/CHANGELOG.md CHANGED
@@ -2,6 +2,12 @@
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
+ ### v1.1.0
6
+
7
+ #### Added
8
+
9
+ * Extract code coverage using Simplecov JSON formatter's generated file.
10
+
5
11
  ### v1.0.0
6
12
 
7
13
  * Initial release.
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- repo_analyzer (1.0.0)
4
+ repo_analyzer (1.1.0)
5
5
  brakeman
6
6
  octokit (~> 4.0)
7
7
  rails (>= 6.0)
@@ -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
40
41
  }
41
42
  end
42
43
 
@@ -54,6 +55,25 @@ 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
+ data[resource] = covered_percent&.to_f&.round(2)
64
+ data
65
+ end
66
+ end
67
+
68
+ def coverage_file
69
+ @coverage_file ||= begin
70
+ content = project_data_bridge.file_content("coverage/coverage.json")
71
+ return {} if content.blank?
72
+
73
+ JSON.parse(content).with_indifferent_access
74
+ end
75
+ end
76
+
57
77
  def rails_code_coverage
58
78
  TESTEABLE_RAILS_RESOURCES.inject({}) do |data, resource|
59
79
  tests_count = project_data_bridge.dir_files("spec/#{resource}").count do |file|
@@ -1,3 +1,3 @@
1
1
  module RepoAnalyzer
2
- VERSION = '1.0.0'
2
+ VERSION = '1.1.0'
3
3
  end