pronto-undercover 0.1.1 → 0.1.2

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: 3de1d2e492a7103e77d719748a7271d48bb3030413bc226ff9d709fb10bbd198
4
- data.tar.gz: 35a280e62e729d415cb8763ad10671dce35db4127da44319c8be6d51e146a8f1
3
+ metadata.gz: 8885bbb4623337f4d0fb6b1205b76552afad8af6f0d93f232aca0f1713b53b7c
4
+ data.tar.gz: a6ea1c17d975522f572b1d62d744c03778d4615675808065afde92b04a03e67b
5
5
  SHA512:
6
- metadata.gz: d468fe8c175ecbe4ded4431e8f0102258166f1dbadaa33ed28b93d0f8c88fcface1ca4c4f3c8c21b3063f6c6844fb565067824f0133a99482289e126cbecaedc
7
- data.tar.gz: 7f3472e588da2f7f3028cde205a903a7e7d3d64e8ec1e83f59542df2d4c2aa0a70ee4829789719c7817d01ad5fb8d2e7272e5f7cb8224f68ef00a2d6a34fe0e1
6
+ metadata.gz: f38a67d942e78b7344a6d77592a85823512bd02c15be57c2676cb6a98f3095f42e67708094730a3043fa2a9d2b7f02cee960ec7b172db99f100c6926790fb5ec
7
+ data.tar.gz: 22e14d21eb45ac770e2c53e9e6d512ec83091717ed06a09bd472937c23c83f5a1d22ccc4aa663a5bf54e8906ae95815a3739a775582e5c8edb2b8f283987a296
@@ -17,6 +17,7 @@ module Pronto
17
17
  def last_modified
18
18
  mod = file_paths.map do |f|
19
19
  next T_ZERO unless File.exist?(f)
20
+
20
21
  File.mtime(f)
21
22
  end.max
22
23
  mod || T_ZERO
@@ -20,7 +20,7 @@ module Pronto
20
20
  return [] if !@patches || @patches.count.zero?
21
21
 
22
22
  @patches
23
- .select { |patch| patch.additions.positive? }
23
+ .select { |patch| valid_patch?(patch) }
24
24
  .map { |patch| patch_to_undercover_message(patch) }
25
25
  .flatten.compact
26
26
  rescue Errno::ENOENT => e
@@ -30,6 +30,10 @@ module Pronto
30
30
 
31
31
  private
32
32
 
33
+ def valid_patch?(patch)
34
+ patch.additions.positive? && ruby_file?(patch.new_file_full_path)
35
+ end
36
+
33
37
  # rubocop:disable Metrics/MethodLength, Metrics/AbcSize
34
38
  def patch_to_undercover_message(patch)
35
39
  offending_line_numbers(patch).map do |warning, msg_line_no|
@@ -55,7 +59,7 @@ module Pronto
55
59
  end
56
60
 
57
61
  def offending_line_numbers(patch)
58
- patch_lines = patch.added_lines.map(&:position)
62
+ patch_lines = patch.added_lines.map(&:new_lineno)
59
63
  path = patch.new_file_full_path.to_s
60
64
  undercover_warnings
61
65
  .select { |warning| File.expand_path(warning.file_path) == path }
@@ -71,13 +75,17 @@ module Pronto
71
75
  end.compact
72
76
  end
73
77
 
78
+ # rubocop:disable Metrics/AbcSize
74
79
  def undercover_options
75
- config = Pronto::ConfigFile.new.to_h
80
+ config = Pronto::ConfigFile.new.to_h['pronto-undercover']
81
+ return ::Undercover::Options.new.parse([]) unless config
82
+
76
83
  opts = []
77
84
  opts << "-l#{config['lcov']}" if config['lcov']
78
85
  opts << "-r#{config['ruby-syntax']}" if config['ruby-syntax']
79
86
  opts << "-p#{config['path']}" if config['path']
80
87
  ::Undercover::Options.new.parse(opts)
81
88
  end
89
+ # rubocop:enable Metrics/AbcSize
82
90
  end
83
91
  end
data/lib/version.rb CHANGED
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Pronto
4
4
  module UndercoverVersion
5
- VERSION = '0.1.1'
5
+ VERSION = '0.1.2'
6
6
  end
7
7
  end
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.1
4
+ version: 0.1.2
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-14 00:00:00.000000000 Z
11
+ date: 2018-09-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: pronto