rubocop-changes 0.6.0 → 0.7.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/ci.yml +1 -1
- data/Gemfile.lock +13 -11
- data/lib/rubocop/changes/checker.rb +7 -3
- data/lib/rubocop/changes/options.rb +9 -2
- data/lib/rubocop/changes/version.rb +1 -1
- data/rubocop-changes.gemspec +1 -1
- metadata +7 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2d17f6a268625b8b30740a9e1409576f00374bf777632a3c1e6b068678a70d9c
|
4
|
+
data.tar.gz: 16eaed76c02755b4a0239c52f36ad8c2ab7369098abd2cdf77fc7bfa8f8d13e6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7e611a8344770358d7690dc7cf58d0421b06853e696d03e0bc99ae42d6c9e3b5e24f2de7c0fef195f6fd54c14d64527cc0ba2a3190187645f713c4a6e8ef6c17
|
7
|
+
data.tar.gz: 4c7b4eb56b4eaa7f7a59c5016b9e26f5d3b4d60246804a67481c94e35cdd0334f1799fc88b2cb34189a0ec8bf57a51a72940d5ca114bab95b32be33c5ade3842
|
data/.github/workflows/ci.yml
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
rubocop-changes (0.
|
4
|
+
rubocop-changes (0.7.0)
|
5
5
|
git_diff_parser (~> 3.2)
|
6
|
-
rubocop (
|
6
|
+
rubocop (>= 1.0)
|
7
7
|
|
8
8
|
GEM
|
9
9
|
remote: https://rubygems.org/
|
@@ -12,12 +12,13 @@ GEM
|
|
12
12
|
byebug (10.0.2)
|
13
13
|
diff-lcs (1.3)
|
14
14
|
git_diff_parser (3.2.0)
|
15
|
-
|
16
|
-
|
15
|
+
json (2.6.2)
|
16
|
+
parallel (1.22.1)
|
17
|
+
parser (3.1.2.0)
|
17
18
|
ast (~> 2.4.1)
|
18
19
|
rainbow (3.1.1)
|
19
20
|
rake (13.0.3)
|
20
|
-
regexp_parser (2.
|
21
|
+
regexp_parser (2.5.0)
|
21
22
|
rexml (3.2.5)
|
22
23
|
rspec (3.9.0)
|
23
24
|
rspec-core (~> 3.9.0)
|
@@ -32,19 +33,20 @@ GEM
|
|
32
33
|
diff-lcs (>= 1.2.0, < 2.0)
|
33
34
|
rspec-support (~> 3.9.0)
|
34
35
|
rspec-support (3.9.0)
|
35
|
-
rubocop (1.
|
36
|
+
rubocop (1.31.2)
|
37
|
+
json (~> 2.3)
|
36
38
|
parallel (~> 1.10)
|
37
39
|
parser (>= 3.1.0.0)
|
38
40
|
rainbow (>= 2.2.2, < 4.0)
|
39
41
|
regexp_parser (>= 1.8, < 3.0)
|
40
|
-
rexml
|
41
|
-
rubocop-ast (>= 1.
|
42
|
+
rexml (>= 3.2.5, < 4.0)
|
43
|
+
rubocop-ast (>= 1.18.0, < 2.0)
|
42
44
|
ruby-progressbar (~> 1.7)
|
43
45
|
unicode-display_width (>= 1.4.0, < 3.0)
|
44
|
-
rubocop-ast (1.
|
45
|
-
parser (>= 3.
|
46
|
+
rubocop-ast (1.19.1)
|
47
|
+
parser (>= 3.1.1.0)
|
46
48
|
ruby-progressbar (1.11.0)
|
47
|
-
unicode-display_width (2.
|
49
|
+
unicode-display_width (2.2.0)
|
48
50
|
|
49
51
|
PLATFORMS
|
50
52
|
ruby
|
@@ -10,6 +10,7 @@ require 'rubocop/changes/shell'
|
|
10
10
|
module Rubocop
|
11
11
|
module Changes
|
12
12
|
class UnknownFormat < StandardError; end
|
13
|
+
class UnknownBaseBranchError < StandardError; end
|
13
14
|
class UnknownForkPointError < StandardError; end
|
14
15
|
|
15
16
|
class Checker
|
@@ -22,6 +23,7 @@ module Rubocop
|
|
22
23
|
end
|
23
24
|
|
24
25
|
def run
|
26
|
+
raise UnknownBaseBranchError if base_branch.empty?
|
25
27
|
raise UnknownForkPointError if fork_point.empty?
|
26
28
|
raise UnknownFormat if formatter_klass.nil?
|
27
29
|
|
@@ -32,14 +34,14 @@ module Rubocop
|
|
32
34
|
|
33
35
|
private
|
34
36
|
|
35
|
-
attr_reader :format, :quiet, :commit, :auto_correct
|
37
|
+
attr_reader :format, :quiet, :commit, :auto_correct, :base_branch
|
36
38
|
|
37
39
|
def fork_point
|
38
40
|
@fork_point ||= Shell.run(command)
|
39
41
|
end
|
40
42
|
|
41
43
|
def command
|
42
|
-
return "git merge-base HEAD origin/#{
|
44
|
+
return "git merge-base HEAD origin/#{base_branch}" unless commit
|
43
45
|
|
44
46
|
"git log -n 1 --pretty=format:\"%h\" #{commit}"
|
45
47
|
end
|
@@ -121,7 +123,9 @@ module Rubocop
|
|
121
123
|
end
|
122
124
|
|
123
125
|
def formatter_klass
|
124
|
-
|
126
|
+
return formatters[format] unless formatters[format].is_a? String
|
127
|
+
|
128
|
+
Kernel.const_get("RuboCop::Formatter::#{formatters[format]}")
|
125
129
|
end
|
126
130
|
|
127
131
|
def formatters
|
@@ -8,7 +8,13 @@ module Rubocop
|
|
8
8
|
Options = Struct.new(:format, :quiet, :commit, :auto_correct, :base_branch)
|
9
9
|
|
10
10
|
def initialize
|
11
|
-
@args = Options.new(
|
11
|
+
@args = Options.new(
|
12
|
+
:simple,
|
13
|
+
false,
|
14
|
+
nil,
|
15
|
+
false,
|
16
|
+
ENV.fetch('RUBOCOP_CHANGES_BASE_BRANCH', 'main')
|
17
|
+
) # Defaults
|
12
18
|
end
|
13
19
|
|
14
20
|
def parse!
|
@@ -73,7 +79,8 @@ module Rubocop
|
|
73
79
|
end
|
74
80
|
|
75
81
|
def parse_base_branch!(opts)
|
76
|
-
|
82
|
+
env_message = 'Also, you can set RUBOCOP_CHANGES_BASE_BRANCH environment variable'
|
83
|
+
opts.on('-b', '--base-branch [BRANCH]', "Base branch to compare. #{env_message}") do |v|
|
77
84
|
args.base_branch = v
|
78
85
|
end
|
79
86
|
end
|
data/rubocop-changes.gemspec
CHANGED
@@ -37,7 +37,7 @@ 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.0'
|
41
41
|
|
42
42
|
spec.add_development_dependency 'bundler', '~> 2.0'
|
43
43
|
spec.add_development_dependency 'byebug', '~> 10.0'
|
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.7.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: 2022-
|
11
|
+
date: 2022-07-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: git_diff_parser
|
@@ -28,16 +28,16 @@ dependencies:
|
|
28
28
|
name: rubocop
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - "
|
31
|
+
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '1.
|
33
|
+
version: '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: '1.
|
40
|
+
version: '1.0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: bundler
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -148,7 +148,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
148
148
|
- !ruby/object:Gem::Version
|
149
149
|
version: '0'
|
150
150
|
requirements: []
|
151
|
-
rubygems_version: 3.
|
151
|
+
rubygems_version: 3.3.5
|
152
152
|
signing_key:
|
153
153
|
specification_version: 4
|
154
154
|
summary: Rubocop on changed lines from git fork point
|