danger-rubocop 0.6.0 → 0.6.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
- SHA1:
3
- metadata.gz: c59cd45d4ce8230e467669d6b3a3ffdfe3c1e7f9
4
- data.tar.gz: f151f971948bba931f159166bc01cc4ad00d21c6
2
+ SHA256:
3
+ metadata.gz: 541340d181c21fb3a3c0f3ca5274df9a89610380ecf1572453cfbfd480e07f4a
4
+ data.tar.gz: 740f0a0e8da3d6c77c62a888984ec5636eddca707806c09674366bcc89aafe24
5
5
  SHA512:
6
- metadata.gz: e10b05bfaf61a28f2d36208ca1bd1136fcad1106b8114586fc8cfc6e5a2282782fe9a30a07e962a12df3856791bdab2eb340a818e5689b1a372fedc468c35b5e
7
- data.tar.gz: f742ec5a40f95ad439a01d9026216ca14643fd3ffec8b2f836c792f7e83da7939fbf3c10e0aca42f83cf08f46a8622b4041b493815066d0293752db21c5c1feb
6
+ metadata.gz: 2bde76c6fa48ecc75aa06805c5d04ed84504d15def8685e05ffd62cb1e50aa417fb55e536c621cb2cff0af1e93222652436462d7719f5d5aa39a5b2e4e8d32de
7
+ data.tar.gz: 909df7927367d9fc75389ffdfef64764ae38165828c82e40500667f167912d408000c03fcf6eb21241ec08c92add6dc4235ccfd4589b88fe1267925d9b335e2e
@@ -1,39 +1,40 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- danger-rubocop (0.3.0)
4
+ danger-rubocop (0.6.0)
5
5
  danger
6
6
  rubocop
7
7
 
8
8
  GEM
9
9
  remote: https://rubygems.org/
10
10
  specs:
11
- addressable (2.5.0)
12
- public_suffix (~> 2.0, >= 2.0.2)
11
+ addressable (2.5.2)
12
+ public_suffix (>= 2.0.2, < 4.0)
13
13
  ast (2.3.0)
14
14
  bacon (1.2.0)
15
- claide (1.0.1)
15
+ claide (1.0.2)
16
16
  claide-plugins (0.9.2)
17
17
  cork
18
18
  nap
19
19
  open4 (~> 1.3)
20
20
  coderay (1.1.1)
21
- colored (1.2)
22
- cork (0.2.0)
23
- colored (~> 1.2)
24
- danger (4.0.2)
21
+ colored2 (3.1.2)
22
+ cork (0.3.0)
23
+ colored2 (~> 3.1)
24
+ danger (5.5.5)
25
25
  claide (~> 1.0)
26
26
  claide-plugins (>= 0.9.2)
27
- colored (~> 1.2)
27
+ colored2 (~> 3.1)
28
28
  cork (~> 0.1)
29
29
  faraday (~> 0.9)
30
30
  faraday-http-cache (~> 1.0)
31
31
  git (~> 1)
32
32
  kramdown (~> 1.5)
33
- octokit (~> 4.2)
33
+ no_proxy_fix
34
+ octokit (~> 4.7)
34
35
  terminal-table (~> 1)
35
36
  diff-lcs (1.2.5)
36
- faraday (0.10.0)
37
+ faraday (0.13.1)
37
38
  multipart-post (>= 1.2, < 3)
38
39
  faraday-http-cache (1.3.1)
39
40
  faraday (~> 0.8)
@@ -54,7 +55,7 @@ GEM
54
55
  guard (~> 2.1)
55
56
  guard-compat (~> 1.1)
56
57
  rspec (>= 2.99.0, < 4.0)
57
- kramdown (1.13.1)
58
+ kramdown (1.16.2)
58
59
  listen (3.0.7)
59
60
  rb-fsevent (>= 0.9.3)
60
61
  rb-inotify (>= 0.9.7)
@@ -68,14 +69,16 @@ GEM
68
69
  multipart-post (2.0.0)
69
70
  nap (1.1.0)
70
71
  nenv (0.3.0)
72
+ no_proxy_fix (0.1.2)
71
73
  notiffany (0.1.0)
72
74
  nenv (~> 0.1)
73
75
  shellany (~> 0.0)
74
- octokit (4.6.2)
76
+ octokit (4.8.0)
75
77
  sawyer (~> 0.8.0, >= 0.5.3)
76
78
  open4 (1.3.4)
77
- parser (2.3.3.1)
78
- ast (~> 2.2)
79
+ parallel (1.12.1)
80
+ parser (2.4.0.2)
81
+ ast (~> 2.3)
79
82
  powerpack (0.1.1)
80
83
  prettybacon (0.0.2)
81
84
  bacon (~> 1.2)
@@ -83,8 +86,8 @@ GEM
83
86
  coderay (~> 1.1.0)
84
87
  method_source (~> 0.8.1)
85
88
  slop (~> 3.4)
86
- public_suffix (2.0.4)
87
- rainbow (2.1.0)
89
+ public_suffix (3.0.1)
90
+ rainbow (3.0.0)
88
91
  rake (10.5.0)
89
92
  rb-fsevent (0.9.7)
90
93
  rb-inotify (0.9.7)
@@ -102,23 +105,24 @@ GEM
102
105
  diff-lcs (>= 1.2.0, < 2.0)
103
106
  rspec-support (~> 3.4.0)
104
107
  rspec-support (3.4.1)
105
- rubocop (0.46.0)
106
- parser (>= 2.3.1.1, < 3.0)
108
+ rubocop (0.52.0)
109
+ parallel (~> 1.10)
110
+ parser (>= 2.4.0.2, < 3.0)
107
111
  powerpack (~> 0.1)
108
- rainbow (>= 1.99.1, < 3.0)
112
+ rainbow (>= 2.2.2, < 4.0)
109
113
  ruby-progressbar (~> 1.7)
110
114
  unicode-display_width (~> 1.0, >= 1.0.1)
111
- ruby-progressbar (1.8.1)
115
+ ruby-progressbar (1.9.0)
112
116
  sawyer (0.8.1)
113
117
  addressable (>= 2.3.5, < 2.6)
114
118
  faraday (~> 0.8, < 1.0)
115
119
  shellany (0.0.1)
116
120
  slop (3.6.0)
117
- terminal-table (1.7.3)
118
- unicode-display_width (~> 1.1.1)
121
+ terminal-table (1.8.0)
122
+ unicode-display_width (~> 1.1, >= 1.1.1)
119
123
  thor (0.19.1)
120
- unicode-display_width (1.1.1)
121
- yard (0.9.5)
124
+ unicode-display_width (1.3.0)
125
+ yard (0.9.12)
122
126
 
123
127
  PLATFORMS
124
128
  ruby
@@ -142,4 +146,4 @@ RUBY VERSION
142
146
  ruby 2.3.1p112
143
147
 
144
148
  BUNDLED WITH
145
- 1.13.6
149
+ 1.15.4
data/README.md CHANGED
@@ -42,11 +42,12 @@ The following keys are supported:
42
42
 
43
43
  * `files`: array of file names or glob patterns to determine files to lint
44
44
  * `force_exclusion`: pass `true` to pass `--force-exclusion` argument to Rubocop.
45
- * `inline_comment`: pass `true` to comment inline of the diffs.
46
- * `report_danger`: pass true to report errors to Danger, and break CI.
47
-
48
45
  (this option will instruct rubocop to ignore the files that your rubocop config ignores,
49
46
  despite the plugin providing the list of files explicitely)
47
+ * `inline_comment`: pass `true` to comment inline of the diffs.
48
+ * `fail_on_inline_comment`: pass `true` to use `fail` instead of `warn` on inline comment.
49
+ * `report_danger`: pass true to report errors to Danger, and break CI.
50
+
50
51
 
51
52
  Passing `files` as only argument is also supported for backward compatibility.
52
53
 
@@ -33,6 +33,7 @@ module Danger
33
33
 
34
34
  report_danger = config[:report_danger] || false
35
35
  inline_comment = config[:inline_comment] || false
36
+ fail_on_inline_comment = config[:fail_on_inline_comment] || false
36
37
 
37
38
  files_to_lint = fetch_files_to_lint(files)
38
39
  files_to_report = rubocop(files_to_lint, force_exclusion)
@@ -41,7 +42,7 @@ module Danger
41
42
  return report_failures files_to_report if report_danger
42
43
 
43
44
  if inline_comment
44
- warn_each_line(files_to_report)
45
+ add_violation_for_each_line(files_to_report, fail_on_inline_comment)
45
46
  else
46
47
  markdown offenses_message(files_to_report)
47
48
  end
@@ -86,10 +87,21 @@ module Danger
86
87
  end
87
88
  end
88
89
 
89
- def warn_each_line(offending_files)
90
+ def add_violation_for_each_line(offending_files, fail_on_inline_comment)
90
91
  offending_files.flat_map do |file|
91
92
  file['offenses'].map do |offense|
92
- warn(offense['message'], file: file['path'], line: offense['location']['line'])
93
+ arguments = [
94
+ offense['message'],
95
+ {
96
+ file: file['path'],
97
+ line: offense['location']['line']
98
+ }
99
+ ]
100
+ if fail_on_inline_comment
101
+ fail(*arguments)
102
+ else
103
+ warn(*arguments)
104
+ end
93
105
  end
94
106
  end
95
107
  end
@@ -1,3 +1,3 @@
1
1
  module DangerRubocop
2
- VERSION = '0.6.0'.freeze
2
+ VERSION = '0.6.1'.freeze
3
3
  end
@@ -130,18 +130,38 @@ EOS
130
130
  expect(@rubocop).not_to receive(:fail)
131
131
  end
132
132
 
133
- it 'is reported as line by line' do
134
- allow(@rubocop.git).to receive(:modified_files)
135
- .and_return(['spec/fixtures/ruby_file.rb'])
136
- allow(@rubocop.git).to receive(:added_files).and_return([])
137
- allow(@rubocop).to receive(:`)
138
- .with('bundle exec rubocop -f json spec/fixtures/ruby_file.rb')
139
- .and_return(response_ruby_file)
133
+ context 'with inline_comment option' do
134
+ context 'without fail_on_inline_comment option' do
135
+ it 'reports violations as line by line warnings' do
136
+ allow(@rubocop.git).to receive(:modified_files)
137
+ .and_return(['spec/fixtures/ruby_file.rb'])
138
+ allow(@rubocop.git).to receive(:added_files).and_return([])
139
+ allow(@rubocop).to receive(:`)
140
+ .with('bundle exec rubocop -f json spec/fixtures/ruby_file.rb')
141
+ .and_return(response_ruby_file)
142
+
143
+ @rubocop.lint(inline_comment: true)
144
+
145
+ expect(@rubocop.violation_report[:warnings].first.to_s)
146
+ .to eq("Violation Don't do that! { sticky: false, file: spec/fixtures/ruby_file.rb, line: 13 }")
147
+ end
148
+ end
140
149
 
141
- @rubocop.lint(inline_comment: true)
150
+ context 'with fail_on_inline_comment option' do
151
+ it 'reports violations as line by line failures' do
152
+ allow(@rubocop.git).to receive(:modified_files)
153
+ .and_return(['spec/fixtures/ruby_file.rb'])
154
+ allow(@rubocop.git).to receive(:added_files).and_return([])
155
+ allow(@rubocop).to receive(:`)
156
+ .with('bundle exec rubocop -f json spec/fixtures/ruby_file.rb')
157
+ .and_return(response_ruby_file)
142
158
 
143
- expect(@rubocop.violation_report[:warnings].first.to_s)
144
- .to eq("Violation Don't do that! { sticky: false, file: spec/fixtures/ruby_file.rb, line: 13 }")
159
+ @rubocop.lint(fail_on_inline_comment: true, inline_comment: true)
160
+
161
+ expect(@rubocop.violation_report[:errors].first.to_s)
162
+ .to eq("Violation Don't do that! { sticky: false, file: spec/fixtures/ruby_file.rb, line: 13 }")
163
+ end
164
+ end
145
165
  end
146
166
 
147
167
  describe 'a filename with special characters' 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.6.0
4
+ version: 0.6.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: 2017-10-13 00:00:00.000000000 Z
11
+ date: 2018-11-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: danger
@@ -193,7 +193,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
193
193
  version: '0'
194
194
  requirements: []
195
195
  rubyforge_project:
196
- rubygems_version: 2.6.11
196
+ rubygems_version: 2.7.6
197
197
  signing_key:
198
198
  specification_version: 4
199
199
  summary: A Danger plugin for running Ruby files through Rubocop.