danger-swiftlint 0.18.2 → 0.19.0

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
2
  SHA256:
3
- metadata.gz: d4c0b4923083394fe45f7ee1eb9414639bcfc2bfa5fda1becc73022ade36dcd7
4
- data.tar.gz: f5f68fcf0e044494561231f3725160c41419fc94ae1aa32907732cf801147ecf
3
+ metadata.gz: 5f03db994724833541ddc2d5739357d6f5f47d6fc73a38814e2d86e146b3471c
4
+ data.tar.gz: f8b967bdc04517e881f45e0b582f1fcab79a3f2c376ce0f81e6e9192b0108cb7
5
5
  SHA512:
6
- metadata.gz: e7a3ecc77e594072fa0e7b34b5725c8d1748fb375cfa6b492d7f7011a53af2601e011c6117f4eb17a9ffe5d920e81bb73ae5e4c3fcf3d7ce25a41e7ca41bb25f
7
- data.tar.gz: f1c31d69887736f1fef1308bcc3a6d6539f5682969e84049e9cf1146cc25289b2f372e8f285ea3024b26c696f978455b78e57e5f4306cc3b6aeafa9af11bb690
6
+ metadata.gz: 48e1cd28d5cddba7200822c51690017f6b7fe765f13e69e89176ff9aa9fcccbe6af5651f7e8823290722cce8589b605854678bb48abe4986aaf8c57011a2e642
7
+ data.tar.gz: 49dcd564a26a78499985c14e5474704704d2fbd29520e6ae4cc1a454e6e41a0ee272582e9e13af4d0f71deab3c9bec31f0073dac1e08ab0ebbfc52fdbc094f98
data/lib/danger_plugin.rb CHANGED
@@ -234,8 +234,9 @@ module Danger
234
234
  filename = r['file'].split('/').last
235
235
  line = r['line']
236
236
  reason = r['reason']
237
-
238
- message << "#{filename} | #{line} | #{reason} \n"
237
+ rule = r['rule_id']
238
+ # Other available properties can be found int SwiftLint/…/JSONReporter.swift
239
+ message << "#{filename} | #{line} | #{reason} (#{rule})\n"
239
240
  end
240
241
 
241
242
  message
@@ -247,8 +248,16 @@ module Danger
247
248
  def send_inline_comment(results, method)
248
249
  dir = "#{Dir.pwd}/"
249
250
  results.each do |r|
250
- filename = r['file'].gsub(dir, '')
251
- send(method, r['reason'], file: filename, line: r['line'])
251
+ github_filename = r['file'].gsub(dir, '')
252
+ message = "#{r['reason']}".dup
253
+
254
+ # extended content here
255
+ filename = r['file'].split('/').last
256
+ message << "\n"
257
+ message << "`#{r['rule_id']}`" # helps writing exceptions // swiftlint:disable:this rule_id
258
+ message << " `#{filename}:#{r['line']}`" # file:line for pasting into Xcode Quick Open
259
+
260
+ send(method, message, file: github_filename, line: r['line'])
252
261
  end
253
262
  end
254
263
 
data/lib/version.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module DangerSwiftlint
4
- VERSION = '0.18.2'
4
+ VERSION = '0.19.0'
5
5
  SWIFTLINT_VERSION = '0.28.1'
6
6
  end
@@ -57,7 +57,7 @@ module Danger
57
57
 
58
58
  output = @swiftlint.status_report[:markdowns].first.to_s
59
59
  expect(output).to include('SwiftLint found issues')
60
- expect(output).to include('SwiftFile.swift | 13 | Force casts should be avoided.')
60
+ expect(output).to include('SwiftFile.swift | 13 | Force casts should be avoided. (force_cast)')
61
61
  end
62
62
 
63
63
  it 'accept files as arguments' do
@@ -69,7 +69,7 @@ module Danger
69
69
 
70
70
  output = @swiftlint.status_report[:markdowns].first.to_s
71
71
  expect(output).to include('SwiftLint found issues')
72
- expect(output).to include('SwiftFile.swift | 13 | Force casts should be avoided.')
72
+ expect(output).to include('SwiftFile.swift | 13 | Force casts should be avoided. (force_cast)')
73
73
  end
74
74
 
75
75
  it 'sets maxium number of violations' do
@@ -83,9 +83,9 @@ module Danger
83
83
 
84
84
  output = @swiftlint.status_report[:markdowns].first.to_s
85
85
  expect(output).to include('SwiftLint found issues')
86
- expect(output).to include('SwiftFile.swift | 13 | Force casts should be avoided.')
86
+ expect(output).to include('SwiftFile.swift | 13 | Force casts should be avoided. (force_cast)')
87
87
  expect(output).to include('SwiftLint also found 1 more violation with this PR.')
88
- expect(output).to_not include('SwiftFile.swift | 14 | Force casts should be avoided.')
88
+ expect(output).to_not include('SwiftFile.swift | 14 | Force casts should be avoided. (force_cast)')
89
89
  end
90
90
 
91
91
  it 'accepts additional cli arguments' do
@@ -312,6 +312,17 @@ module Danger
312
312
  expect(status[:markdowns]).to be_empty
313
313
  end
314
314
 
315
+ it 'renders rule_id and file:line indicators in inline mode' do
316
+ allow_any_instance_of(Swiftlint).to receive(:lint)
317
+ .with(hash_including(path: File.expand_path('spec/fixtures/SwiftFile.swift')), '')
318
+ .and_return(@swiftlint_response)
319
+
320
+ @swiftlint.lint_files('spec/fixtures/*.swift', inline_mode: true, additional_swiftlint_args: '')
321
+
322
+ status = @swiftlint.status_report
323
+ expect(status[:warnings]).to eql(["Force casts should be avoided.\n`force_cast` `SwiftFile.swift:13`"])
324
+ end
325
+
315
326
  it 'generate errors in inline_mode when fail_on_error' do
316
327
  allow_any_instance_of(Swiftlint).to receive(:lint)
317
328
  .with(hash_including(path: File.expand_path('spec/fixtures/SwiftFile.swift')), '')
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: danger-swiftlint
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.18.2
4
+ version: 0.19.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ash Furrow
@@ -12,7 +12,7 @@ authors:
12
12
  autorequire:
13
13
  bindir: bin
14
14
  cert_chain: []
15
- date: 2019-01-18 00:00:00.000000000 Z
15
+ date: 2019-02-21 00:00:00.000000000 Z
16
16
  dependencies:
17
17
  - !ruby/object:Gem::Dependency
18
18
  name: danger