danger-rubocop 0.7.0 → 0.7.1

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: ad658f09ac619e760282d3c744fb30c479711f934919fa337561a890cc810348
4
- data.tar.gz: f85f21294bdbf3e1878fab539fbc5d0edc8cdc4a6b47880af049b756693b33e4
3
+ metadata.gz: 7b288b71917f30ef97bf3fc0c1f8724b46a88e7df67b892b6150c61c17a7de98
4
+ data.tar.gz: 0cfe9c4bab2641bca6fcc424d1fe696880b1707c6d95090f0daf3329c7dd1abf
5
5
  SHA512:
6
- metadata.gz: 85c71ea2747fab34cdc91ebf7183ff8d18100416e11338a6207f7fe7a31cce0763fc6e7af63f4aec5e0b687042d208a02e92d88599e71c47c867a0468e55b0cf
7
- data.tar.gz: 0aec485ea365fd126af04967a0f8267ed268bce85a3ba5ca5fd6513cbe76222d7e76de73ba2fe442855af462966da72aacbc79fbce791a4912ae23184b0869d3
6
+ metadata.gz: f47e4da17133f200a872614aecafed97f9ea9cd7461e46c8389fbea70f9f8ebccc74d4910ac228b76caa90f8d112a553939741c98a61c5e073d135dae7330ef4
7
+ data.tar.gz: 70268a8ab1c21d2b68ea5a4455177998562322cc3cf5d2d9b1decf710085bec6fd162bada84d1727420665d8ce49fa29afa0479921bd460775cffa76d7aa0d3b
data/Gemfile.lock CHANGED
@@ -125,7 +125,7 @@ GEM
125
125
  unicode-display_width (~> 1.1, >= 1.1.1)
126
126
  thor (0.19.1)
127
127
  unicode-display_width (1.6.0)
128
- yard (0.9.12)
128
+ yard (0.9.20)
129
129
 
130
130
  PLATFORMS
131
131
  ruby
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
@@ -1,3 +1,3 @@
1
1
  module DangerRubocop
2
- VERSION = '0.7.0'.freeze
2
+ VERSION = '0.7.1'.freeze
3
3
  end
@@ -20,7 +20,7 @@ module Danger
20
20
  'offenses' => [
21
21
  {
22
22
  'message' => 'No.',
23
- 'location' => { 'line' => 42 }
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' => 42 }
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.0
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-09-19 00:00:00.000000000 Z
11
+ date: 2019-11-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: danger