rubocop-changed 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/rubocop/changed/commands.rb +12 -1
- data/lib/rubocop/changed/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d106bb14da97436a39b5fa35944b7f08133d26cf7647b28e234e04d8feb7ff09
|
4
|
+
data.tar.gz: d39cd06b0ca38812f01b9e9820423897f519c4f35eef4d4bd861d019a728447c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 63feb9a8367541b5ed1dd919b71216c62c069773d5ed09e53417c6cf8d844f1a70952cbc0b3a91ff66853428a2a629f3f7f0be4b183b7d77e6cf0f03f0d951bd
|
7
|
+
data.tar.gz: 3bfbd434841f081d79bd134be897d57d2e2dea98a31015002e164562d6155b97ee4ce1b1075a1f20613245fa63836f6d7fde78722dd2a2a025a1d2affece5096
|
@@ -11,11 +11,16 @@ module RuboCop
|
|
11
11
|
GIT_COMMANDS = {
|
12
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
|
-
default_branch: 'git symbolic-ref refs/remotes/origin/HEAD'
|
14
|
+
default_branch: 'git symbolic-ref refs/remotes/origin/HEAD',
|
15
|
+
new_files: 'git status --porcelain=v1'
|
15
16
|
}.freeze
|
16
17
|
|
17
18
|
class << self
|
18
19
|
def changed_files(branch = compared_branch)
|
20
|
+
(diffed_files(branch) + new_files).uniq
|
21
|
+
end
|
22
|
+
|
23
|
+
def diffed_files(branch = compared_branch)
|
19
24
|
command = format(
|
20
25
|
GIT_COMMANDS.fetch(:changed_files),
|
21
26
|
compared_branch: branch,
|
@@ -34,6 +39,12 @@ module RuboCop
|
|
34
39
|
branch
|
35
40
|
end
|
36
41
|
|
42
|
+
def new_files
|
43
|
+
command = format(GIT_COMMANDS.fetch(:new_files))
|
44
|
+
run(command).split("\n")
|
45
|
+
.map { |file| File.absolute_path(file[3..]) }
|
46
|
+
end
|
47
|
+
|
37
48
|
private
|
38
49
|
|
39
50
|
def current_branch
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rubocop-changed
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Aslan Dukaev
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-09-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|
@@ -73,7 +73,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
73
73
|
- !ruby/object:Gem::Version
|
74
74
|
version: '0'
|
75
75
|
requirements: []
|
76
|
-
rubygems_version: 3.
|
76
|
+
rubygems_version: 3.4.10
|
77
77
|
signing_key:
|
78
78
|
specification_version: 4
|
79
79
|
summary: RuboCop extensions for lint only changed files in PRs
|