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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8649e7a626497e84a5a036b3914c58730983db8eb18daf7ca36eaad53931c03d
4
- data.tar.gz: 94cfdabd8eca2087ce11767a219429da91fedeeaf08de0f65564c8a99e702532
3
+ metadata.gz: d106bb14da97436a39b5fa35944b7f08133d26cf7647b28e234e04d8feb7ff09
4
+ data.tar.gz: d39cd06b0ca38812f01b9e9820423897f519c4f35eef4d4bd861d019a728447c
5
5
  SHA512:
6
- metadata.gz: 4d85ad0827e304a6c83fd8fc59c703a0c13b3ce1670c56e97873f81f96264ff8c05acc9838f16b62318ab2aaa0889469c896365491aa6a2a414403172f55ed38
7
- data.tar.gz: 979f5697bcda191823041b345adbc3e63ccfdc19eb1a7e8c6a253f8f0a78c9fd706fe39ab5f3dd2e24d8ae5bb00b07499153c1620f564d507a85074d47e4cbbd
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
@@ -2,6 +2,6 @@
2
2
 
3
3
  module RuboCop
4
4
  module Changed
5
- VERSION = '0.0.2'
5
+ VERSION = '0.0.3'
6
6
  end
7
7
  end
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.2
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: 2022-12-13 00:00:00.000000000 Z
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.1.4
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