danger-rubocop 0.9.0 → 0.9.1

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: a3abbdb817a34c89263a3e43389e0ad1c241eceb220da6ff60d4171dbd82724b
4
- data.tar.gz: 7790b03ff4cffe993a9e21ada5831169e55af7811bb06b2b6dc800ee0eab72c4
3
+ metadata.gz: e9a9adf95fe6fc6b0f29c5a34a521eafcb26a10791dd9fe3d4126ce55bae3ee5
4
+ data.tar.gz: c8731c9a5353f01ef27d295af64d0be6df245a75b243a428fd2373c009eeb866
5
5
  SHA512:
6
- metadata.gz: a6532f9058d5f6f5db6fd27c1197b84966ef5e786fd9213c24974d618477c5f7eabfadb8f072585a3e6c413f08d2f67aa94610486c599e91fc8fc528e2a2d36e
7
- data.tar.gz: c678e3db688d226c8d25c43bc895f046519b14751bb0b3b670b124ca8a90f884d9695b2fb936c98cd38ad7899127b4539d8eb3b9e4a39d622a23f758f9e27c34
6
+ metadata.gz: eed612a6b9874424d3cd336acef1321b7555ec7e4920092f0c87a9af5f470c6febb9012cdd3ddd5220b2c8fcb1e20631af5f3132871f7c790de1a668f1a2e125
7
+ data.tar.gz: 6ade89d66c71e050f1938cba1e2f7827742b5ce9ac939baa73104c35f7a85723e788fd437ee91574de18732a790a2f9206d602e5ac0217bd97178f23ff37fdb1
@@ -85,7 +85,7 @@ module Danger
85
85
  .flat_map do |chunk|
86
86
  first_line, *diff = chunk.split("\n")
87
87
  # Get start from diff.
88
- lineno = first_line.match(/\+(\d+),(\d+)/).captures.first.to_i
88
+ lineno = first_line.match(/\+(\d+),?(\d?)/).captures.first.to_i
89
89
  diff.each_with_object([]) do |current_line, added_lines|
90
90
  added_lines << lineno if current_line.start_with?('+')
91
91
  lineno += 1 unless current_line.start_with?('-')
@@ -1,3 +1,3 @@
1
1
  module DangerRubocop
2
- VERSION = '0.9.0'.freeze
2
+ VERSION = '0.9.1'.freeze
3
3
  end
@@ -107,6 +107,26 @@ module Danger
107
107
  it 'handles git diff' do
108
108
  expect(@rubocop.send(:added_lines, 'SAMPLE')).to eq([1, 2])
109
109
  end
110
+
111
+ context "single line added to a new file" do
112
+ before do
113
+ allow(@rubocop.git).to receive(:diff_for_file).with('SAMPLE') do
114
+ instance_double('Git::Diff::DiffFile', patch: <<~DIFF)
115
+ diff --git a/SAMPLE b/SAMPLE
116
+ new file mode 100644
117
+ index 0000000..7bba8c8
118
+ --- /dev/null
119
+ +++ b/SAMPLE
120
+ @@ -0,0 +1 @@
121
+ +line 1
122
+ DIFF
123
+ end
124
+ end
125
+
126
+ it 'handles git diff' do
127
+ expect(@rubocop.send(:added_lines, 'SAMPLE')).to eq([1])
128
+ end
129
+ end
110
130
  end
111
131
 
112
132
  describe :lint_files do
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: danger-rubocop
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.0
4
+ version: 0.9.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ash Furrow
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-08-12 00:00:00.000000000 Z
11
+ date: 2020-10-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: danger
@@ -177,7 +177,7 @@ homepage: https://github.com/ashfurrow/danger-rubocop
177
177
  licenses:
178
178
  - MIT
179
179
  metadata: {}
180
- post_install_message:
180
+ post_install_message:
181
181
  rdoc_options: []
182
182
  require_paths:
183
183
  - lib
@@ -193,7 +193,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
193
193
  version: '0'
194
194
  requirements: []
195
195
  rubygems_version: 3.0.8
196
- signing_key:
196
+ signing_key:
197
197
  specification_version: 4
198
198
  summary: A Danger plugin for running Ruby files through Rubocop.
199
199
  test_files: