danger-rubocop 0.9.0 → 0.9.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/danger_plugin.rb +1 -1
- data/lib/version.rb +1 -1
- data/spec/danger_plugin_spec.rb +20 -0
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e9a9adf95fe6fc6b0f29c5a34a521eafcb26a10791dd9fe3d4126ce55bae3ee5
|
4
|
+
data.tar.gz: c8731c9a5353f01ef27d295af64d0be6df245a75b243a428fd2373c009eeb866
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: eed612a6b9874424d3cd336acef1321b7555ec7e4920092f0c87a9af5f470c6febb9012cdd3ddd5220b2c8fcb1e20631af5f3132871f7c790de1a668f1a2e125
|
7
|
+
data.tar.gz: 6ade89d66c71e050f1938cba1e2f7827742b5ce9ac939baa73104c35f7a85723e788fd437ee91574de18732a790a2f9206d602e5ac0217bd97178f23ff37fdb1
|
data/lib/danger_plugin.rb
CHANGED
@@ -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+)
|
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?('-')
|
data/lib/version.rb
CHANGED
data/spec/danger_plugin_spec.rb
CHANGED
@@ -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.
|
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-
|
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:
|