pronto-rubocop-autocorrect 0.9.1 → 0.9.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +6 -0
- data/lib/pronto/rubocop-autocorrect.rb +10 -13
- data/lib/pronto/rubocop-autocorrect/version.rb +1 -1
- data/pronto-rubocop-autocorrect.gemspec +2 -8
- metadata +14 -14
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f3d03a42fa9e867799fdf9b038f23f0181355814
|
4
|
+
data.tar.gz: 6e3a2fe3a3433db72d57c7936997a7e90175a098
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 643d5edc3e23b9fb5c0423125a28ebec1d26b8dc2be64684a57afe2a1aea6c285c3a941ea832ca7952c9bcdf802aef820e734e10934cc5985fc31104f47f87d1
|
7
|
+
data.tar.gz: a581cc41117bf94a41724958cb64c4f952a5f392f475101a8580ae3ddebcf7a5ec6b3af0f1982d5502eaece8041ac4f7c01f08b1041d90077b12d65def31671d
|
data/README.md
CHANGED
@@ -11,3 +11,9 @@ Pronto runner for [Rubocop](https://github.com/bbatsov/rubocop), ruby code analy
|
|
11
11
|
|
12
12
|
Configuring Rubocop via .rubocop.yml will work just fine with pronto-rubocop.
|
13
13
|
You can also specify a custom `.rubocop.yml` location with the environment variable `RUBOCOP_CONFIG`
|
14
|
+
|
15
|
+
You can also provide additional configuration via `.pronto.yml`:
|
16
|
+
|
17
|
+
rubocop:
|
18
|
+
# Auto-correct issues
|
19
|
+
auto-correct: true
|
@@ -10,7 +10,7 @@ module Pronto
|
|
10
10
|
if ENV['RUBOCOP_CONFIG']
|
11
11
|
@config_store.options_config = ENV['RUBOCOP_CONFIG']
|
12
12
|
end
|
13
|
-
|
13
|
+
|
14
14
|
options = { auto_correct: @auto_correct }
|
15
15
|
@inspector = ::RuboCop::Runner.new(options, @config_store)
|
16
16
|
end
|
@@ -21,29 +21,27 @@ module Pronto
|
|
21
21
|
messages = @patches.select { |patch| valid_patch?(patch) }
|
22
22
|
.map { |patch| process(patch) }
|
23
23
|
.flatten.compact
|
24
|
-
|
25
24
|
_add_corrected_message_total(messages) if @auto_correct
|
26
25
|
messages
|
27
|
-
|
26
|
+
end
|
28
27
|
|
29
28
|
def valid_patch?(patch)
|
30
29
|
return false if patch.additions < 1
|
31
30
|
|
32
31
|
config_store = config_store_for(patch)
|
33
32
|
path = patch.new_file_full_path
|
34
|
-
|
35
33
|
return false if config_store.file_to_exclude?(path.to_s)
|
36
34
|
return true if config_store.file_to_include?(path.to_s)
|
37
35
|
|
38
36
|
ruby_file?(path)
|
39
|
-
|
37
|
+
end
|
40
38
|
|
41
39
|
def process(patch)
|
42
40
|
processed_source = processed_source_for(patch)
|
43
41
|
file = patch.delta.new_file[:path]
|
44
42
|
offences = @inspector.send(:do_inspection_loop, file, processed_source)[1]
|
45
43
|
_messages_for_offences(offences, patch)
|
46
|
-
|
44
|
+
end
|
47
45
|
|
48
46
|
def new_message(offence, line)
|
49
47
|
path = line.patch.delta.new_file[:path]
|
@@ -53,19 +51,18 @@ module Pronto
|
|
53
51
|
message = "[Corrected] #{message}"
|
54
52
|
level = :info
|
55
53
|
end
|
56
|
-
|
57
54
|
Message.new(path, line, level, message, nil, self.class)
|
58
|
-
|
55
|
+
end
|
59
56
|
|
60
57
|
def config_store_for(patch)
|
61
58
|
path = patch.new_file_full_path.to_s
|
62
59
|
@config_store.for(path)
|
63
|
-
|
60
|
+
end
|
64
61
|
|
65
62
|
def processed_source_for(patch)
|
66
63
|
path = patch.new_file_full_path.to_s
|
67
64
|
::RuboCop::ProcessedSource.from_file(path, RUBY_VERSION[0..2].to_f)
|
68
|
-
|
65
|
+
end
|
69
66
|
|
70
67
|
def level(severity)
|
71
68
|
case severity
|
@@ -74,7 +71,7 @@ module Pronto
|
|
74
71
|
when :warning, :error, :fatal
|
75
72
|
severity
|
76
73
|
end
|
77
|
-
|
74
|
+
end
|
78
75
|
|
79
76
|
private
|
80
77
|
|
@@ -83,7 +80,7 @@ module Pronto
|
|
83
80
|
total = "Total offenses: #{messages.size} " \
|
84
81
|
" Corrected: #{corrected_messages.size}"
|
85
82
|
messages << Message.new(nil, nil, :info, total, nil, self.class)
|
86
|
-
|
83
|
+
end
|
87
84
|
|
88
85
|
def _messages_for_offences(offences, patch)
|
89
86
|
offences.sort.reject(&:disabled?).map do |offence|
|
@@ -91,6 +88,6 @@ module Pronto
|
|
91
88
|
.select { |line| line.new_lineno == offence.line }
|
92
89
|
.map { |line| new_message(offence, line) }
|
93
90
|
end
|
94
|
-
|
91
|
+
end
|
95
92
|
end
|
96
93
|
end
|
@@ -1,9 +1,6 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
$LOAD_PATH.push File.expand_path('../lib', __FILE__)
|
1
|
+
$LOAD_PATH.push File.expand_path('lib', __dir__)
|
4
2
|
require 'pronto/rubocop-autocorrect/version'
|
5
3
|
require 'English'
|
6
|
-
|
7
4
|
Gem::Specification.new do |s|
|
8
5
|
s.name = 'pronto-rubocop-autocorrect'
|
9
6
|
s.version = Pronto::RubocopAutocorrectVersion::VERSION
|
@@ -12,11 +9,9 @@ Gem::Specification.new do |s|
|
|
12
9
|
s.email = 'mindaugas.mozuras@gmail.com'
|
13
10
|
s.homepage = 'http://github.com/mmozuras/pronto-rubocop'
|
14
11
|
s.summary = 'Pronto runner for Rubocop, ruby code analyzer'
|
15
|
-
|
16
12
|
s.licenses = ['MIT']
|
17
13
|
s.required_ruby_version = '>= 2.0.0'
|
18
14
|
s.rubygems_version = '1.8.23'
|
19
|
-
|
20
15
|
s.files = `git ls-files`.split($RS).reject do |file|
|
21
16
|
file =~ %r{^(?:
|
22
17
|
spec/.*
|
@@ -31,9 +26,8 @@ Gem::Specification.new do |s|
|
|
31
26
|
s.test_files = []
|
32
27
|
s.extra_rdoc_files = ['LICENSE', 'README.md']
|
33
28
|
s.require_paths = ['lib']
|
34
|
-
|
35
|
-
s.add_runtime_dependency('rubocop', '~> 0.50', '>= 0.49.1')
|
36
29
|
s.add_runtime_dependency('pronto', '~> 0.9.0')
|
30
|
+
s.add_runtime_dependency('rubocop', '~> 0.50', '>= 0.49.1')
|
37
31
|
s.add_development_dependency('rake', '~> 12.0')
|
38
32
|
s.add_development_dependency('rspec', '~> 3.4')
|
39
33
|
s.add_development_dependency('rspec-its', '~> 1.2')
|
metadata
CHANGED
@@ -1,49 +1,49 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pronto-rubocop-autocorrect
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.9.1
|
4
|
+
version: 0.9.1.1
|
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: 2018-10-
|
11
|
+
date: 2018-10-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
-
name:
|
14
|
+
name: pronto
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
20
|
-
- - ">="
|
21
|
-
- !ruby/object:Gem::Version
|
22
|
-
version: 0.49.1
|
19
|
+
version: 0.9.0
|
23
20
|
type: :runtime
|
24
21
|
prerelease: false
|
25
22
|
version_requirements: !ruby/object:Gem::Requirement
|
26
23
|
requirements:
|
27
24
|
- - "~>"
|
28
25
|
- !ruby/object:Gem::Version
|
29
|
-
version:
|
30
|
-
- - ">="
|
31
|
-
- !ruby/object:Gem::Version
|
32
|
-
version: 0.49.1
|
26
|
+
version: 0.9.0
|
33
27
|
- !ruby/object:Gem::Dependency
|
34
|
-
name:
|
28
|
+
name: rubocop
|
35
29
|
requirement: !ruby/object:Gem::Requirement
|
36
30
|
requirements:
|
37
31
|
- - "~>"
|
38
32
|
- !ruby/object:Gem::Version
|
39
|
-
version: 0.
|
33
|
+
version: '0.50'
|
34
|
+
- - ">="
|
35
|
+
- !ruby/object:Gem::Version
|
36
|
+
version: 0.49.1
|
40
37
|
type: :runtime
|
41
38
|
prerelease: false
|
42
39
|
version_requirements: !ruby/object:Gem::Requirement
|
43
40
|
requirements:
|
44
41
|
- - "~>"
|
45
42
|
- !ruby/object:Gem::Version
|
46
|
-
version: 0.
|
43
|
+
version: '0.50'
|
44
|
+
- - ">="
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: 0.49.1
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: rake
|
49
49
|
requirement: !ruby/object:Gem::Requirement
|