rubocop-changes 0.2.1 → 0.5.0
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 +4 -4
- data/.gitignore +2 -0
- data/.rubocop.yml +23 -1
- data/Gemfile +1 -1
- data/Gemfile.lock +22 -17
- data/Rakefile +3 -3
- data/bin/console +3 -3
- 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 +4 -4
- metadata +8 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 06a4d924f28228a2e5514caeb0f2c2f6879522e2e1fe4ca718424706ce8559ad
|
4
|
+
data.tar.gz: a4422055a7c6caffef88d1abc1bdb5e13cef6e64c077c5df5f45c72359ca1cda
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f70ab20c2eb40ba114735c1dfa4d24d2823b681ccc64b21c9e5f81497311438bb14afd050e5c4c9a387355d2fa1522004e34a7ddda46afdba979289ec7e1cf88
|
7
|
+
data.tar.gz: c2548a708550197c75f9e83b85f1c975ab55e81a6eecee9b552901724f1297fe0d1f5225b25e0f91693ea26b5c7b7a3f35d2f37b582edcef79ee63a0dc904429
|
data/.gitignore
CHANGED
data/.rubocop.yml
CHANGED
@@ -1,5 +1,27 @@
|
|
1
|
+
AllCops:
|
2
|
+
TargetRubyVersion: 2.5
|
3
|
+
NewCops: disable
|
4
|
+
|
5
|
+
Lint/RaiseException:
|
6
|
+
Enabled: false
|
7
|
+
|
8
|
+
Lint/StructNewOverride:
|
9
|
+
Enabled: false
|
10
|
+
|
11
|
+
Style/HashEachMethods:
|
12
|
+
Enabled: false
|
13
|
+
|
14
|
+
Style/HashTransformKeys:
|
15
|
+
Enabled: false
|
16
|
+
|
17
|
+
Style/HashTransformValues:
|
18
|
+
Enabled: false
|
19
|
+
|
1
20
|
Style/Documentation:
|
2
21
|
Enabled: false
|
3
22
|
|
4
|
-
|
23
|
+
Style/FrozenStringLiteralComment:
|
24
|
+
Enabled: false
|
25
|
+
|
26
|
+
Layout/LineLength:
|
5
27
|
Max: 120
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,23 +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
|
-
rubocop (~>
|
6
|
+
rubocop (~> 1.25)
|
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
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
15
|
+
parallel (1.21.0)
|
16
|
+
parser (3.1.0.0)
|
17
|
+
ast (~> 2.4.1)
|
18
|
+
rainbow (3.1.1)
|
19
|
+
rake (13.0.3)
|
20
|
+
regexp_parser (2.2.0)
|
21
|
+
rexml (3.2.5)
|
21
22
|
rspec (3.9.0)
|
22
23
|
rspec-core (~> 3.9.0)
|
23
24
|
rspec-expectations (~> 3.9.0)
|
@@ -31,15 +32,19 @@ GEM
|
|
31
32
|
diff-lcs (>= 1.2.0, < 2.0)
|
32
33
|
rspec-support (~> 3.9.0)
|
33
34
|
rspec-support (3.9.0)
|
34
|
-
rubocop (
|
35
|
-
jaro_winkler (~> 1.5.1)
|
35
|
+
rubocop (1.25.0)
|
36
36
|
parallel (~> 1.10)
|
37
|
-
parser (>=
|
37
|
+
parser (>= 3.1.0.0)
|
38
38
|
rainbow (>= 2.2.2, < 4.0)
|
39
|
+
regexp_parser (>= 1.8, < 3.0)
|
40
|
+
rexml
|
41
|
+
rubocop-ast (>= 1.15.1, < 2.0)
|
39
42
|
ruby-progressbar (~> 1.7)
|
40
|
-
unicode-display_width (>= 1.4.0, <
|
41
|
-
|
42
|
-
|
43
|
+
unicode-display_width (>= 1.4.0, < 3.0)
|
44
|
+
rubocop-ast (1.15.1)
|
45
|
+
parser (>= 3.0.1.1)
|
46
|
+
ruby-progressbar (1.11.0)
|
47
|
+
unicode-display_width (2.1.0)
|
43
48
|
|
44
49
|
PLATFORMS
|
45
50
|
ruby
|
@@ -47,9 +52,9 @@ PLATFORMS
|
|
47
52
|
DEPENDENCIES
|
48
53
|
bundler (~> 2.0)
|
49
54
|
byebug (~> 10.0)
|
50
|
-
rake (~>
|
55
|
+
rake (~> 13.0)
|
51
56
|
rspec (~> 3.0)
|
52
57
|
rubocop-changes!
|
53
58
|
|
54
59
|
BUNDLED WITH
|
55
|
-
2.
|
60
|
+
2.1.4
|
data/Rakefile
CHANGED
data/bin/console
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
|
-
require
|
4
|
-
require
|
3
|
+
require 'bundler/setup'
|
4
|
+
require 'rubocop/changes'
|
5
5
|
|
6
6
|
# You can add fixtures and/or initialization code here to make experimenting
|
7
7
|
# with your gem easier. You can also use a different console, if you like.
|
@@ -10,5 +10,5 @@ require "rubocop/changes"
|
|
10
10
|
# require "pry"
|
11
11
|
# Pry.start
|
12
12
|
|
13
|
-
require
|
13
|
+
require 'irb'
|
14
14
|
IRB.start(__FILE__)
|
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
@@ -6,7 +6,7 @@ Gem::Specification.new do |spec|
|
|
6
6
|
spec.name = 'rubocop-changes'
|
7
7
|
spec.version = Rubocop::Changes::VERSION
|
8
8
|
spec.platform = Gem::Platform::RUBY
|
9
|
-
spec.required_ruby_version = '>= 2.
|
9
|
+
spec.required_ruby_version = '>= 2.5.0'
|
10
10
|
spec.authors = ['Ferran Basora']
|
11
11
|
spec.email = ['fcsonline@gmail.com']
|
12
12
|
|
@@ -28,7 +28,7 @@ Gem::Specification.new do |spec|
|
|
28
28
|
# Specify which files should be added to the gem when it is released.
|
29
29
|
# The `git ls-files -z` loads the files in the RubyGem that have been added
|
30
30
|
# into git.
|
31
|
-
spec.files = Dir.chdir(File.expand_path(
|
31
|
+
spec.files = Dir.chdir(File.expand_path(__dir__)) do
|
32
32
|
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
33
33
|
end
|
34
34
|
spec.bindir = 'exe'
|
@@ -37,10 +37,10 @@ Gem::Specification.new do |spec|
|
|
37
37
|
spec.require_paths = ['lib']
|
38
38
|
|
39
39
|
spec.add_runtime_dependency 'git_diff_parser', '~> 3.2'
|
40
|
-
spec.add_runtime_dependency 'rubocop', '~>
|
40
|
+
spec.add_runtime_dependency 'rubocop', '~> 1.25'
|
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.5.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: 2022-01-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: git_diff_parser
|
@@ -30,14 +30,14 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
33
|
+
version: '1.25'
|
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: '
|
40
|
+
version: '1.25'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: bundler
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -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
|
@@ -141,15 +141,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
141
141
|
requirements:
|
142
142
|
- - ">="
|
143
143
|
- !ruby/object:Gem::Version
|
144
|
-
version: 2.
|
144
|
+
version: 2.5.0
|
145
145
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
146
146
|
requirements:
|
147
147
|
- - ">="
|
148
148
|
- !ruby/object:Gem::Version
|
149
149
|
version: '0'
|
150
150
|
requirements: []
|
151
|
-
|
152
|
-
rubygems_version: 2.7.6
|
151
|
+
rubygems_version: 3.0.1
|
153
152
|
signing_key:
|
154
153
|
specification_version: 4
|
155
154
|
summary: Rubocop on changed lines from git fork point
|