pronto-rubocop 0.0.2 → 0.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
  SHA1:
3
- metadata.gz: eb19f1e14e4d87be1a6d925b1f52dcd2ac0407c2
4
- data.tar.gz: 7724d623805662bf78418ad4854017aa374b1f38
3
+ metadata.gz: 5cf6ded1b06de501bcfc66dbfaea7d844327600f
4
+ data.tar.gz: af0fec9b36599158e44753010ede2466c69c9f4e
5
5
  SHA512:
6
- metadata.gz: 2b85a273f981c74441fd0cbd767a4ae49f0416663b81b7afa2b643d074ba1c201e014f3950cc4569d35a7085c58a7d74ffb927961adc551d050e38f97cc18548
7
- data.tar.gz: d3ca1ffbd229656c2f3be7e39898e36702df864e61d90277b89a0b71d50c318a72cc6cea96a3656f5ac50e67cdffded61d88da7e55ffab6133375f0fa2cc3aac
6
+ metadata.gz: f36c6c9e2638cddf5b9161d888bda2c51ef7abd2b451b4b533b74242c281f7615fad46596852406aa0874a855bf63f46484dc7d1ceb710021616c5efffb914f7
7
+ data.tar.gz: 59e41f32124552ff9bd9851bf41497bd587942dd64cce08842bd068891f35ebfa86d19fd82e88c5410cc6b7f99c0d8481644630e9476622e9d349f7f1aeb8a40
data/README.md CHANGED
@@ -1 +1,4 @@
1
1
  # pronto-rubocop
2
+
3
+ [![Code Climate](https://codeclimate.com/github/mmozuras/pronto-rubocop.png)](https://codeclimate.com/github/mmozuras/pronto-rubocop)
4
+ [![Dependency Status](https://gemnasium.com/mmozuras/pronto-rubocop.png)](https://gemnasium.com/mmozuras/pronto-rubocop)
@@ -11,55 +11,33 @@ module Pronto
11
11
  return [] unless patches
12
12
 
13
13
  patches.select { |patch| patch.additions > 0 }
14
+ .select { |patch| ruby_file?(patch.new_file_full_path) }
14
15
  .map { |patch| inspect(patch) }
15
16
  .flatten.compact
16
17
  end
17
18
 
18
19
  def inspect(patch)
19
- delta = patch.delta
20
+ offences = @cli.inspect_file(patch.new_file_full_path)
20
21
 
21
- if File.extname(delta.new_file[:path]) == '.rb'
22
- create_tempfile(delta.new_blob) do |file|
23
- offences = @cli.inspect_file(file.path)
24
- messages_from(offences, patch)
25
- end
22
+ offences.map do |offence|
23
+ patch.added_lines.select { |line| line.new_lineno == offence.line }
24
+ .map { |line| new_message(offence, line) }
26
25
  end
27
26
  end
28
27
 
29
- def added_lines(patch)
30
- patch.map do |hunk|
31
- hunk.lines.select(&:addition?)
32
- end.flatten.compact
33
- end
34
-
35
- def messages_from(offences, patch)
36
- offences.map do |offence|
37
- line = added_lines(patch).select do |added_line|
38
- added_line.new_lineno == offence.line
39
- end.first
40
-
41
- path = patch.delta.new_file[:path]
42
- message_from(path, offence, line) if line
43
- end.compact
44
- end
28
+ def new_message(offence, line)
29
+ path = line.patch.delta.new_file[:path]
30
+ level = level(offence.severity)
45
31
 
46
- def message_from(path, offence, line)
47
- Pronto::Message.new(path,
48
- line,
49
- level(offence.severity),
50
- offence.message)
32
+ Message.new(path, line, level, offence.message)
51
33
  end
52
34
 
53
35
  def level(severity)
54
36
  case severity
55
37
  when :refactor, :convention
56
38
  :info
57
- when :warning
58
- :warning
59
- when :error
60
- :error
61
- when :fatal
62
- :fatal
39
+ when :warning, :error, :fatal
40
+ severity
63
41
  end
64
42
  end
65
43
  end
@@ -1,5 +1,5 @@
1
1
  module Pronto
2
2
  module RubocopVersion
3
- VERSION = '0.0.2'
3
+ VERSION = '0.1.0'
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.0.2
4
+ version: 0.1.0
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: 2013-09-01 00:00:00.000000000 Z
11
+ date: 2013-09-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rubocop
@@ -16,28 +16,28 @@ dependencies:
16
16
  requirements:
17
17
  - - ~>
18
18
  - !ruby/object:Gem::Version
19
- version: 0.9.0
19
+ version: 0.13.0
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - ~>
25
25
  - !ruby/object:Gem::Version
26
- version: 0.9.0
26
+ version: 0.13.0
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: pronto
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - ~>
32
32
  - !ruby/object:Gem::Version
33
- version: 0.0.2
33
+ version: 0.1.0
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - ~>
39
39
  - !ruby/object:Gem::Version
40
- version: 0.0.2
40
+ version: 0.1.0
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rake
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -101,3 +101,4 @@ signing_key:
101
101
  specification_version: 4
102
102
  summary: pronto-rubocop
103
103
  test_files: []
104
+ has_rdoc: