danger-rubocop 0.7.0 → 0.7.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 +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +6 -0
- data/lib/danger_plugin.rb +1 -1
- data/lib/version.rb +1 -1
- data/spec/danger_plugin_spec.rb +23 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7b288b71917f30ef97bf3fc0c1f8724b46a88e7df67b892b6150c61c17a7de98
|
4
|
+
data.tar.gz: 0cfe9c4bab2641bca6fcc424d1fe696880b1707c6d95090f0daf3329c7dd1abf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f47e4da17133f200a872614aecafed97f9ea9cd7461e46c8389fbea70f9f8ebccc74d4910ac228b76caa90f8d112a553939741c98a61c5e073d135dae7330ef4
|
7
|
+
data.tar.gz: 70268a8ab1c21d2b68ea5a4455177998562322cc3cf5d2d9b1decf710085bec6fd162bada84d1727420665d8ce49fa29afa0479921bd460775cffa76d7aa0d3b
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -30,6 +30,12 @@ public_files = (git.modified_files + git.added_files).select { |path| path.inclu
|
|
30
30
|
rubocop.lint public_files
|
31
31
|
```
|
32
32
|
|
33
|
+
> Submit comments only for changed lines
|
34
|
+
|
35
|
+
```ruby
|
36
|
+
github.dismiss_out_of_range_messages
|
37
|
+
rubocop.lint inline_comment: true
|
38
|
+
```
|
33
39
|
|
34
40
|
#### Methods
|
35
41
|
|
data/lib/danger_plugin.rb
CHANGED
@@ -86,8 +86,8 @@ module Danger
|
|
86
86
|
# Get start from diff.
|
87
87
|
lineno = first_line.match(/\+(\d+),(\d+)/).captures.first.to_i
|
88
88
|
diff.each_with_object([]) do |current_line, added_lines|
|
89
|
-
lineno += 1 unless current_line.start_with?('-')
|
90
89
|
added_lines << lineno if current_line.start_with?('+')
|
90
|
+
lineno += 1 unless current_line.start_with?('-')
|
91
91
|
added_lines
|
92
92
|
end
|
93
93
|
end
|
data/lib/version.rb
CHANGED
data/spec/danger_plugin_spec.rb
CHANGED
@@ -20,7 +20,7 @@ module Danger
|
|
20
20
|
'offenses' => [
|
21
21
|
{
|
22
22
|
'message' => 'No.',
|
23
|
-
'location' => { 'line' =>
|
23
|
+
'location' => { 'line' => 41 }
|
24
24
|
}
|
25
25
|
]
|
26
26
|
}
|
@@ -79,7 +79,7 @@ module Danger
|
|
79
79
|
'offenses' => [
|
80
80
|
{
|
81
81
|
'message' => 'No.',
|
82
|
-
'location' => { 'line' =>
|
82
|
+
'location' => { 'line' => 41 }
|
83
83
|
}
|
84
84
|
]
|
85
85
|
}
|
@@ -88,6 +88,27 @@ module Danger
|
|
88
88
|
end
|
89
89
|
end
|
90
90
|
|
91
|
+
describe :added_lines do
|
92
|
+
before do
|
93
|
+
allow(@rubocop.git).to receive(:diff_for_file).with('SAMPLE') do
|
94
|
+
instance_double('Git::Diff::DiffFile', patch: <<~DIFF)
|
95
|
+
diff --git a/SAMPLE b/SAMPLE
|
96
|
+
new file mode 100644
|
97
|
+
index 0000000..7bba8c8
|
98
|
+
--- /dev/null
|
99
|
+
+++ b/SAMPLE
|
100
|
+
@@ -0,0 +1,2 @@
|
101
|
+
+line 1
|
102
|
+
+line 2
|
103
|
+
DIFF
|
104
|
+
end
|
105
|
+
end
|
106
|
+
|
107
|
+
it 'handles git diff' do
|
108
|
+
expect(@rubocop.send(:added_lines, 'SAMPLE')).to eq([1, 2])
|
109
|
+
end
|
110
|
+
end
|
111
|
+
|
91
112
|
describe :lint_files do
|
92
113
|
let(:response_ruby_file) do
|
93
114
|
{
|
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.7.
|
4
|
+
version: 0.7.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ash Furrow
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-11-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: danger
|