rubocop-changed 0.0.1 → 0.0.2
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/lib/rubocop/changed/commands.rb +9 -4
- data/lib/rubocop/changed/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8649e7a626497e84a5a036b3914c58730983db8eb18daf7ca36eaad53931c03d
|
4
|
+
data.tar.gz: 94cfdabd8eca2087ce11767a219429da91fedeeaf08de0f65564c8a99e702532
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4d85ad0827e304a6c83fd8fc59c703a0c13b3ce1670c56e97873f81f96264ff8c05acc9838f16b62318ab2aaa0889469c896365491aa6a2a414403172f55ed38
|
7
|
+
data.tar.gz: 979f5697bcda191823041b345adbc3e63ccfdc19eb1a7e8c6a253f8f0a78c9fd706fe39ab5f3dd2e24d8ae5bb00b07499153c1620f564d507a85074d47e4cbbd
|
@@ -9,15 +9,21 @@ module RuboCop
|
|
9
9
|
'fatal:'
|
10
10
|
].freeze
|
11
11
|
GIT_COMMANDS = {
|
12
|
-
changed_files: 'git diff-tree -r --no-commit-id --name-
|
12
|
+
changed_files: 'git diff-tree -r --no-commit-id --name-status %<compared_branch>s %<current_branch>s',
|
13
13
|
current_branch: 'git rev-parse --abbrev-ref HEAD',
|
14
14
|
default_branch: 'git symbolic-ref refs/remotes/origin/HEAD'
|
15
15
|
}.freeze
|
16
16
|
|
17
17
|
class << self
|
18
18
|
def changed_files(branch = compared_branch)
|
19
|
-
|
19
|
+
command = format(
|
20
|
+
GIT_COMMANDS.fetch(:changed_files),
|
21
|
+
compared_branch: branch,
|
22
|
+
current_branch: current_branch
|
23
|
+
)
|
24
|
+
run(command)
|
20
25
|
.split("\n")
|
26
|
+
.filter_map { |line| line.split("\t").last unless line.match?(/D\t/) }
|
21
27
|
.map { |file| File.absolute_path(file) }
|
22
28
|
end
|
23
29
|
|
@@ -31,8 +37,7 @@ module RuboCop
|
|
31
37
|
private
|
32
38
|
|
33
39
|
def current_branch
|
34
|
-
run(GIT_COMMANDS.fetch(:current_branch))
|
35
|
-
.gsub("\n", '')
|
40
|
+
run(GIT_COMMANDS.fetch(:current_branch)).gsub("\n", '')
|
36
41
|
end
|
37
42
|
|
38
43
|
def setted_branch
|