pronto-undercover 0.1.0 → 0.1.1
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/.rubocop.yml +4 -0
- data/lib/pronto/undercover.rb +39 -18
- data/lib/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3de1d2e492a7103e77d719748a7271d48bb3030413bc226ff9d709fb10bbd198
|
4
|
+
data.tar.gz: 35a280e62e729d415cb8763ad10671dce35db4127da44319c8be6d51e146a8f1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d468fe8c175ecbe4ded4431e8f0102258166f1dbadaa33ed28b93d0f8c88fcface1ca4c4f3c8c21b3063f6c6844fb565067824f0133a99482289e126cbecaedc
|
7
|
+
data.tar.gz: 7f3472e588da2f7f3028cde205a903a7e7d3d64e8ec1e83f59542df2d4c2aa0a70ee4829789719c7817d01ad5fb8d2e7272e5f7cb8224f68ef00a2d6a34fe0e1
|
data/.rubocop.yml
CHANGED
data/lib/pronto/undercover.rb
CHANGED
@@ -17,11 +17,12 @@ module Pronto
|
|
17
17
|
|
18
18
|
# @return Array[Pronto::Message]
|
19
19
|
def run
|
20
|
-
return []
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
20
|
+
return [] if !@patches || @patches.count.zero?
|
21
|
+
|
22
|
+
@patches
|
23
|
+
.select { |patch| patch.additions.positive? }
|
24
|
+
.map { |patch| patch_to_undercover_message(patch) }
|
25
|
+
.flatten.compact
|
25
26
|
rescue Errno::ENOENT => e
|
26
27
|
warn("Could not open file! #{e}")
|
27
28
|
[]
|
@@ -29,20 +30,40 @@ module Pronto
|
|
29
30
|
|
30
31
|
private
|
31
32
|
|
32
|
-
# rubocop:disable Metrics/AbcSize
|
33
|
-
def
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
33
|
+
# rubocop:disable Metrics/MethodLength, Metrics/AbcSize
|
34
|
+
def patch_to_undercover_message(patch)
|
35
|
+
offending_line_numbers(patch).map do |warning, msg_line_no|
|
36
|
+
patch
|
37
|
+
.added_lines
|
38
|
+
.select { |line| line.new_lineno == msg_line_no }
|
39
|
+
.map do |line|
|
40
|
+
lines = untested_lines_for(warning)
|
41
|
+
path = line.patch.delta.new_file[:path]
|
42
|
+
msg = "#{warning.node.human_name} #{warning.node.name} missing tests" \
|
43
|
+
" for line#{'s' if lines.size > 1} #{lines.join(', ')}" \
|
44
|
+
" (coverage: #{warning.coverage_f})"
|
45
|
+
Message.new(path, line, DEFAULT_LEVEL, msg)
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
# rubocop:enable Metrics/MethodLength, Metrics/AbcSize
|
50
|
+
|
51
|
+
def undercover_warnings
|
52
|
+
@undercover_warnings ||= ::Undercover::Report.new(
|
53
|
+
@patch_changeset, undercover_options
|
54
|
+
).build.build_warnings
|
55
|
+
end
|
56
|
+
|
57
|
+
def offending_line_numbers(patch)
|
58
|
+
patch_lines = patch.added_lines.map(&:position)
|
59
|
+
path = patch.new_file_full_path.to_s
|
60
|
+
undercover_warnings
|
61
|
+
.select { |warning| File.expand_path(warning.file_path) == path }
|
62
|
+
.map do |warning|
|
63
|
+
first_line_no = patch_lines.find { |l| warning.uncovered?(l) }
|
64
|
+
[warning, first_line_no] if first_line_no
|
65
|
+
end.compact
|
44
66
|
end
|
45
|
-
# rubocop:enable Metrics/AbcSize
|
46
67
|
|
47
68
|
def untested_lines_for(warning)
|
48
69
|
warning.coverage.map do |ln, _cov|
|
data/lib/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pronto-undercover
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jan Grodowski
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-09-
|
11
|
+
date: 2018-09-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: pronto
|