pronto-rubocop 0.4.6 → 0.4.7

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: bec80a7235e959814713c3d8542bbb21027e4a71
4
- data.tar.gz: ac22f1fa393226b10f8ed295260302e36b08e18d
3
+ metadata.gz: b0798d8be503387f7c82fd03ec3f62583ec0b37a
4
+ data.tar.gz: 1149663e0f9e558aa9978786aea8a46ba6eb9c90
5
5
  SHA512:
6
- metadata.gz: 58f00f8781bc51de8143b8f3437f834d53a513610c61dc6c8ca2978e9c0a3c5a71bcba2cba7e8956cb5a0d2cef004470415533fd57d6e463a5bd15c1839051b1
7
- data.tar.gz: 5ef79b2ed7f64854fa215103131ec7a19bc7aea385345d2a3ac31c1aa862cfed2bff746c2ab46d835d7c62f4ddccb31db88ff5af0406180169478d8c90564fb3
6
+ metadata.gz: 21d83a83a93c7f35c5ea076eb7870d3e80303c3b1d71539a6c970170c97e5c87d626b8e0eddc1e27920051836a0f91e98dc9af12fba93e494d1b36bb8ff21d80
7
+ data.tar.gz: 05c4e0af675b7c347900b6f9fa84032f83981dc4d875e9dbbf8e49297e5d5748da728fba36bdcd510b725ed3694366010cf243ef92683b3d4e2610a19e01a3ff
@@ -11,13 +11,21 @@ module Pronto
11
11
  def run(patches, _)
12
12
  return [] unless patches
13
13
 
14
- valid_patches = patches.select do |patch|
15
- patch.additions > 0 &&
16
- ruby_file?(patch.new_file_full_path) &&
17
- !excluded?(patch)
18
- end
14
+ patches.select { |patch| valid_patch?(patch) }
15
+ .map { |patch| inspect(patch) }
16
+ .flatten.compact
17
+ end
18
+
19
+ def valid_patch?(patch)
20
+ return false if patch.additions < 1
21
+
22
+ config_store = config_store_for(patch)
23
+ path = patch.new_file_full_path
24
+
25
+ return false if config_store.file_to_exclude?(path.to_s)
26
+ return true if config_store.file_to_include?(path.to_s)
19
27
 
20
- valid_patches.map { |patch| inspect(patch) }.flatten.compact
28
+ ruby_file?(path)
21
29
  end
22
30
 
23
31
  def inspect(patch)
@@ -37,9 +45,9 @@ module Pronto
37
45
  Message.new(path, line, level, offence.message)
38
46
  end
39
47
 
40
- def excluded?(patch)
48
+ def config_store_for(patch)
41
49
  path = patch.new_file_full_path.to_s
42
- @config_store.for(path).file_to_exclude?(path)
50
+ @config_store.for(path)
43
51
  end
44
52
 
45
53
  def level(severity)
@@ -1,5 +1,5 @@
1
1
  module Pronto
2
2
  module RubocopVersion
3
- VERSION = '0.4.6'
3
+ VERSION = '0.4.7'
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pronto-rubocop
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.6
4
+ version: 0.4.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mindaugas Mozūras
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-09-06 00:00:00.000000000 Z
11
+ date: 2015-10-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rubocop
@@ -115,4 +115,3 @@ signing_key:
115
115
  specification_version: 4
116
116
  summary: Pronto runner for Rubocop, ruby code analyzer
117
117
  test_files: []
118
- has_rdoc: