rubocop-changes 0.3.0 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +8 -8
- data/exe/rubocop-changes +2 -1
- data/lib/rubocop/changes/checker.rb +23 -3
- data/lib/rubocop/changes/options.rb +9 -2
- data/lib/rubocop/changes/version.rb +1 -1
- data/rubocop-changes.gemspec +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4a94905b21e4303a0e32552697c0766e15aa6caedba8a96a047f5ecc5f5393fd
|
4
|
+
data.tar.gz: 98efe986e967c29ef194427f0cab777b9d611d230b1add48f44716e475d2164e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 34ae25af5ff70f8428c54dca710d8b0e423b8f599ab4b854e73d080ccc4db008dd9a85f34feeaefa98d6c2faabb4bcef0c8ab3a30bfa371b42c1592f65779972
|
7
|
+
data.tar.gz: 392d5448f21ebe2bdf11e8b3b09bcb6d54212906bbebca4da3850efddd78e6ec3f3653b421754c9696747c76be63aeb4b75c86aa8aa60dd3bf8375c9898e6d2e
|
data/Gemfile.lock
CHANGED
@@ -1,24 +1,24 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
rubocop-changes (0.
|
4
|
+
rubocop-changes (0.4.0)
|
5
5
|
git_diff_parser (~> 3.2)
|
6
6
|
rubocop (~> 0.80)
|
7
7
|
|
8
8
|
GEM
|
9
9
|
remote: https://rubygems.org/
|
10
10
|
specs:
|
11
|
-
ast (2.4.
|
11
|
+
ast (2.4.2)
|
12
12
|
byebug (10.0.2)
|
13
13
|
diff-lcs (1.3)
|
14
14
|
git_diff_parser (3.2.0)
|
15
15
|
jaro_winkler (1.5.4)
|
16
16
|
parallel (1.19.1)
|
17
|
-
parser (
|
18
|
-
ast (~> 2.4.
|
17
|
+
parser (3.0.0.0)
|
18
|
+
ast (~> 2.4.1)
|
19
19
|
rainbow (3.0.0)
|
20
|
-
rake (
|
21
|
-
rexml (3.2.
|
20
|
+
rake (13.0.3)
|
21
|
+
rexml (3.2.5)
|
22
22
|
rspec (3.9.0)
|
23
23
|
rspec-core (~> 3.9.0)
|
24
24
|
rspec-expectations (~> 3.9.0)
|
@@ -49,9 +49,9 @@ PLATFORMS
|
|
49
49
|
DEPENDENCIES
|
50
50
|
bundler (~> 2.0)
|
51
51
|
byebug (~> 10.0)
|
52
|
-
rake (~>
|
52
|
+
rake (~> 13.0)
|
53
53
|
rspec (~> 3.0)
|
54
54
|
rubocop-changes!
|
55
55
|
|
56
56
|
BUNDLED WITH
|
57
|
-
2.
|
57
|
+
2.1.4
|
data/exe/rubocop-changes
CHANGED
@@ -11,7 +11,8 @@ args = Rubocop::Changes::Options.new.parse!
|
|
11
11
|
offenses = Rubocop::Changes::Checker.new(
|
12
12
|
format: args.format,
|
13
13
|
quiet: args.quiet,
|
14
|
-
commit: args.commit
|
14
|
+
commit: args.commit,
|
15
|
+
auto_correct: args.auto_correct
|
15
16
|
).run
|
16
17
|
|
17
18
|
exit offenses.count.positive? ? 1 : 0
|
@@ -13,10 +13,11 @@ module Rubocop
|
|
13
13
|
class UnknownForkPointError < StandardError; end
|
14
14
|
|
15
15
|
class Checker
|
16
|
-
def initialize(format:, quiet:, commit:)
|
16
|
+
def initialize(format:, quiet:, commit:, auto_correct:)
|
17
17
|
@format = format
|
18
18
|
@quiet = quiet
|
19
19
|
@commit = commit
|
20
|
+
@auto_correct = auto_correct
|
20
21
|
end
|
21
22
|
|
22
23
|
def run
|
@@ -30,7 +31,7 @@ module Rubocop
|
|
30
31
|
|
31
32
|
private
|
32
33
|
|
33
|
-
attr_reader :format, :quiet, :commit
|
34
|
+
attr_reader :format, :quiet, :commit, :auto_correct
|
34
35
|
|
35
36
|
def fork_point
|
36
37
|
@fork_point ||= Shell.run(command)
|
@@ -59,7 +60,26 @@ module Rubocop
|
|
59
60
|
end
|
60
61
|
|
61
62
|
def rubocop
|
62
|
-
|
63
|
+
shell_command = [
|
64
|
+
'rubocop',
|
65
|
+
exclussion_modifier,
|
66
|
+
formatter_modifier,
|
67
|
+
auto_correct_modifier
|
68
|
+
].compact.join(' ')
|
69
|
+
|
70
|
+
Shell.run(shell_command)
|
71
|
+
end
|
72
|
+
|
73
|
+
def exclussion_modifier
|
74
|
+
'--force-exclusion'
|
75
|
+
end
|
76
|
+
|
77
|
+
def formatter_modifier
|
78
|
+
"-f j #{ruby_changed_files.join(' ')}"
|
79
|
+
end
|
80
|
+
|
81
|
+
def auto_correct_modifier
|
82
|
+
'-a' if @auto_correct
|
63
83
|
end
|
64
84
|
|
65
85
|
def rubocop_json
|
@@ -5,10 +5,10 @@ require 'optparse'
|
|
5
5
|
module Rubocop
|
6
6
|
module Changes
|
7
7
|
class Options
|
8
|
-
Options = Struct.new(:format, :quiet, :commit)
|
8
|
+
Options = Struct.new(:format, :quiet, :commit, :auto_correct)
|
9
9
|
|
10
10
|
def initialize
|
11
|
-
@args = Options.new(:simple, false, nil) # Defaults
|
11
|
+
@args = Options.new(:simple, false, nil, false) # Defaults
|
12
12
|
end
|
13
13
|
|
14
14
|
def parse!
|
@@ -18,6 +18,7 @@ module Rubocop
|
|
18
18
|
parse_formatter!(opts)
|
19
19
|
parse_commit!(opts)
|
20
20
|
parse_quiet!(opts)
|
21
|
+
parse_auto_correct!(opts)
|
21
22
|
parse_help!(opts)
|
22
23
|
parse_version!(opts)
|
23
24
|
end.parse!
|
@@ -64,6 +65,12 @@ module Rubocop
|
|
64
65
|
end
|
65
66
|
end
|
66
67
|
|
68
|
+
def parse_auto_correct!(opts)
|
69
|
+
opts.on('-a', '--auto-correct', 'Auto correct errors') do |v|
|
70
|
+
args.auto_correct = v
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
67
74
|
def parse_help!(opts)
|
68
75
|
opts.on('-h', '--help', 'Prints this help') do
|
69
76
|
puts opts
|
data/rubocop-changes.gemspec
CHANGED
@@ -41,6 +41,6 @@ Gem::Specification.new do |spec|
|
|
41
41
|
|
42
42
|
spec.add_development_dependency 'bundler', '~> 2.0'
|
43
43
|
spec.add_development_dependency 'byebug', '~> 10.0'
|
44
|
-
spec.add_development_dependency 'rake', '~>
|
44
|
+
spec.add_development_dependency 'rake', '~> 13.0'
|
45
45
|
spec.add_development_dependency 'rspec', '~> 3.0'
|
46
46
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rubocop-changes
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ferran Basora
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-05-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: git_diff_parser
|
@@ -72,14 +72,14 @@ dependencies:
|
|
72
72
|
requirements:
|
73
73
|
- - "~>"
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version: '
|
75
|
+
version: '13.0'
|
76
76
|
type: :development
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
80
|
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version: '
|
82
|
+
version: '13.0'
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: rspec
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|