danger-rubocop 0.9.1 → 0.9.2

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: e9a9adf95fe6fc6b0f29c5a34a521eafcb26a10791dd9fe3d4126ce55bae3ee5
4
- data.tar.gz: c8731c9a5353f01ef27d295af64d0be6df245a75b243a428fd2373c009eeb866
3
+ metadata.gz: b8b4d92dd5ddd493b1d27553041631f01e18d822778ff653d6efbede8c9df7b9
4
+ data.tar.gz: d925de6ae7e157a46ebdaa8194666d1bc0347f8c6c5fd964dd910b5a9151d934
5
5
  SHA512:
6
- metadata.gz: eed612a6b9874424d3cd336acef1321b7555ec7e4920092f0c87a9af5f470c6febb9012cdd3ddd5220b2c8fcb1e20631af5f3132871f7c790de1a668f1a2e125
7
- data.tar.gz: 6ade89d66c71e050f1938cba1e2f7827742b5ce9ac939baa73104c35f7a85723e788fd437ee91574de18732a790a2f9206d602e5ac0217bd97178f23ff37fdb1
6
+ metadata.gz: 52c59f565ea64473fccfb198c570949a781f54c34bb063f6db0627133ce83d4e928990d93c7d5dc53e8a9936f7c50e5ab5f7d2c3a06577cc07a53d3a073753a3
7
+ data.tar.gz: ffb3de2dbead86c8a1fd98974cac247c96dcc639e6d510cd3c377ada6fca2857246664e6e4a41e4728ddf0f7e06449611abd7377b65572328269291269eddea7
data/README.md CHANGED
@@ -46,10 +46,10 @@ Runs Ruby files through Rubocop. Generates a `markdown` list of warnings.
46
46
  This method accepts a configuration hash.
47
47
  The following keys are supported:
48
48
 
49
- * `files`: array of file names or glob patterns to determine files to lint
49
+ * `files`: array of file names or glob patterns to determine files to lint. If omitted, this will lint only the files changed in the pull request. To lint all files every time, pass an empty string; this is the equivalent of typing `rubocop` without specifying any files, and will follow the rules in your `.rubocop.yml`.
50
50
  * `force_exclusion`: pass `true` to pass `--force-exclusion` argument to Rubocop.
51
51
  (this option will instruct rubocop to ignore the files that your rubocop config ignores,
52
- despite the plugin providing the list of files explicitely)
52
+ despite the plugin providing the list of files explicitly)
53
53
  * `inline_comment`: pass `true` to comment inline of the diffs.
54
54
  * `fail_on_inline_comment`: pass `true` to use `fail` instead of `warn` on inline comment.
55
55
  * `report_danger`: pass true to report errors to Danger, and break CI.
@@ -78,7 +78,10 @@ module Danger
78
78
  end
79
79
 
80
80
  def added_lines(path)
81
- git.diff_for_file(path)
81
+ diff_for_file = git.diff_for_file(path)
82
+ return [] if diff_for_file.nil?
83
+
84
+ diff_for_file
82
85
  .patch
83
86
  .split("\n@@")
84
87
  .tap(&:shift)
@@ -1,3 +1,3 @@
1
1
  module DangerRubocop
2
- VERSION = '0.9.1'.freeze
2
+ VERSION = '0.9.2'.freeze
3
3
  end
@@ -127,6 +127,16 @@ module Danger
127
127
  expect(@rubocop.send(:added_lines, 'SAMPLE')).to eq([1])
128
128
  end
129
129
  end
130
+
131
+ context 'no such file' do
132
+ before do
133
+ allow(@rubocop.git).to receive(:diff_for_file).with('SAMPLE').and_return(nil)
134
+ end
135
+
136
+ it 'return empty array' do
137
+ expect(@rubocop.send(:added_lines, 'SAMPLE')).to eq([])
138
+ end
139
+ end
130
140
  end
131
141
 
132
142
  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.1
4
+ version: 0.9.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ash Furrow
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-10-21 00:00:00.000000000 Z
11
+ date: 2020-11-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: danger