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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e0fdb50a8da61fabb8c8f3e568b35eeb96f7a1e2e98c1205f983337d1053f28a
4
- data.tar.gz: 830d5e846cadb95e7451acaeb9fe455cb0dd65f4299326116c439c71637162a0
3
+ metadata.gz: 8649e7a626497e84a5a036b3914c58730983db8eb18daf7ca36eaad53931c03d
4
+ data.tar.gz: 94cfdabd8eca2087ce11767a219429da91fedeeaf08de0f65564c8a99e702532
5
5
  SHA512:
6
- metadata.gz: '0780a055cf605241b78b8c498974bfd29a449a87ceec146f1605e20cd3dc5451a45f83af72d98bab96099f622ab8b4e4d2534ba14d133058525a55337e2b286b'
7
- data.tar.gz: 1e270f0df26d920df86b3c15f79b5334b58be5929b6ec9147c6389bb32714b8f21468c733d5951e0199d32035cba91856c544fe0946186a1b5fb7400c7302849
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-only head %s',
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
- run(GIT_COMMANDS.fetch(:changed_files) % branch)
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
@@ -2,6 +2,6 @@
2
2
 
3
3
  module RuboCop
4
4
  module Changed
5
- VERSION = '0.0.1'
5
+ VERSION = '0.0.2'
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rubocop-changed
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Aslan Dukaev