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 +4 -4
- data/lib/danger_plugin.rb +13 -4
- data/lib/version.rb +1 -1
- data/spec/danger_plugin_spec.rb +15 -4
- 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: 5f03db994724833541ddc2d5739357d6f5f47d6fc73a38814e2d86e146b3471c
|
4
|
+
data.tar.gz: f8b967bdc04517e881f45e0b582f1fcab79a3f2c376ce0f81e6e9192b0108cb7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
-
|
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
|
-
|
251
|
-
|
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
data/spec/danger_plugin_spec.rb
CHANGED
@@ -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.
|
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-
|
15
|
+
date: 2019-02-21 00:00:00.000000000 Z
|
16
16
|
dependencies:
|
17
17
|
- !ruby/object:Gem::Dependency
|
18
18
|
name: danger
|