rubocop-changes 0.7.0 → 0.8.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/Gemfile.lock +10 -10
- data/README.md +3 -1
- data/lib/rubocop/changes/checker.rb +22 -3
- data/lib/rubocop/changes/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: '09daace2e31cf1451cba68fe23ac1c6ab439f281b23d1634c004fe316b67cd8e'
|
4
|
+
data.tar.gz: dc982a2074301f56ad4658c97cd09b9e2f657498476d52c60d2bea242f60b32e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cc9ccaf62d221526a6405f8e57a8b4c7b5ede8963a43b5793ab4013914da4eca6535f4c00c55d32038dddde15e7966f5e7c280615ab8900f57fdfb308db19f2c
|
7
|
+
data.tar.gz: a1d648e0776098ceb27e23d0f3efb6742d7b71fef4cfb28e628e8e0f9f4cd5d64daf829a8782196306519322cba50afa6c2c2585c896612595674b2f85e6565a
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
rubocop-changes (0.
|
4
|
+
rubocop-changes (0.8.0)
|
5
5
|
git_diff_parser (~> 3.2)
|
6
6
|
rubocop (>= 1.0)
|
7
7
|
|
@@ -12,13 +12,13 @@ GEM
|
|
12
12
|
byebug (10.0.2)
|
13
13
|
diff-lcs (1.3)
|
14
14
|
git_diff_parser (3.2.0)
|
15
|
-
json (2.6.
|
15
|
+
json (2.6.3)
|
16
16
|
parallel (1.22.1)
|
17
|
-
parser (3.
|
17
|
+
parser (3.2.0.0)
|
18
18
|
ast (~> 2.4.1)
|
19
19
|
rainbow (3.1.1)
|
20
20
|
rake (13.0.3)
|
21
|
-
regexp_parser (2.
|
21
|
+
regexp_parser (2.6.2)
|
22
22
|
rexml (3.2.5)
|
23
23
|
rspec (3.9.0)
|
24
24
|
rspec-core (~> 3.9.0)
|
@@ -33,20 +33,20 @@ GEM
|
|
33
33
|
diff-lcs (>= 1.2.0, < 2.0)
|
34
34
|
rspec-support (~> 3.9.0)
|
35
35
|
rspec-support (3.9.0)
|
36
|
-
rubocop (1.
|
36
|
+
rubocop (1.44.0)
|
37
37
|
json (~> 2.3)
|
38
38
|
parallel (~> 1.10)
|
39
|
-
parser (>= 3.
|
39
|
+
parser (>= 3.2.0.0)
|
40
40
|
rainbow (>= 2.2.2, < 4.0)
|
41
41
|
regexp_parser (>= 1.8, < 3.0)
|
42
42
|
rexml (>= 3.2.5, < 4.0)
|
43
|
-
rubocop-ast (>= 1.
|
43
|
+
rubocop-ast (>= 1.24.1, < 2.0)
|
44
44
|
ruby-progressbar (~> 1.7)
|
45
|
-
unicode-display_width (>=
|
46
|
-
rubocop-ast (1.
|
45
|
+
unicode-display_width (>= 2.4.0, < 3.0)
|
46
|
+
rubocop-ast (1.24.1)
|
47
47
|
parser (>= 3.1.1.0)
|
48
48
|
ruby-progressbar (1.11.0)
|
49
|
-
unicode-display_width (2.2
|
49
|
+
unicode-display_width (2.4.2)
|
50
50
|
|
51
51
|
PLATFORMS
|
52
52
|
ruby
|
data/README.md
CHANGED
@@ -32,7 +32,9 @@ Or install it yourself as:
|
|
32
32
|
|
33
33
|
## Usage
|
34
34
|
|
35
|
-
$ bundle exec rubocop-changes
|
35
|
+
$ bundle exec rubocop-changes -b master
|
36
|
+
|
37
|
+
When you run `rubocop-changes`, you have to specify which is your base branch with `-b` argument. By default is `main`. If you want to avoid to pass this argument everytime you execute this command, you can also set the `RUBOCOP_CHANGES_BASE_BRANCH` environment variable.
|
36
38
|
|
37
39
|
## Other gems
|
38
40
|
|
@@ -36,6 +36,15 @@ module Rubocop
|
|
36
36
|
|
37
37
|
attr_reader :format, :quiet, :commit, :auto_correct, :base_branch
|
38
38
|
|
39
|
+
def path_prefix
|
40
|
+
return @path_prefix if defined?(@path_prefix)
|
41
|
+
@path_prefix = local_git_root_path && Dir.pwd.gsub(local_git_root_path, '')[1..-1]
|
42
|
+
end
|
43
|
+
|
44
|
+
def local_git_root_path
|
45
|
+
@local_git_root_path ||= Shell.run("git rev-parse --show-toplevel")
|
46
|
+
end
|
47
|
+
|
39
48
|
def fork_point
|
40
49
|
@fork_point ||= Shell.run(command)
|
41
50
|
end
|
@@ -59,7 +68,17 @@ module Rubocop
|
|
59
68
|
end
|
60
69
|
|
61
70
|
def ruby_changed_files
|
62
|
-
changed_files.select { |changed_file| changed_file =~
|
71
|
+
changed_files.select { |changed_file| changed_file =~ /\.rb$/ }
|
72
|
+
end
|
73
|
+
|
74
|
+
def ruby_changed_files_from_pwd
|
75
|
+
ruby_changed_files.map do |path|
|
76
|
+
if path_prefix
|
77
|
+
path.gsub(/^#{path_prefix}\//, '')
|
78
|
+
else
|
79
|
+
path
|
80
|
+
end
|
81
|
+
end
|
63
82
|
end
|
64
83
|
|
65
84
|
def rubocop
|
@@ -78,11 +97,11 @@ module Rubocop
|
|
78
97
|
end
|
79
98
|
|
80
99
|
def formatter_modifier
|
81
|
-
"-f j #{
|
100
|
+
"-f j #{ruby_changed_files_from_pwd.join(' ')}"
|
82
101
|
end
|
83
102
|
|
84
103
|
def auto_correct_modifier
|
85
|
-
'-
|
104
|
+
'-A' if @auto_correct
|
86
105
|
end
|
87
106
|
|
88
107
|
def rubocop_json
|
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.8.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: 2023-01-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: git_diff_parser
|