danger-apple_swift_format 0.0.3 → 0.0.4

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: 494d23e2c6ae28b259433709e1fdcea4030dc310f5f9825fc3beeabb93b91db6
4
- data.tar.gz: ca2e3a6cadcf6eaceaa8aea8e1f31f8f31a3594ec58a3cceffe7e49229973725
3
+ metadata.gz: f075411a9894c1cf228b475effd8a2a2985960336244826f417f8de5b4b54d56
4
+ data.tar.gz: 7b4d4a58170fbb90b330c0ece2142873952294c45c3337c7ac9e9c47921b3e28
5
5
  SHA512:
6
- metadata.gz: bdf198c8c6c896ae75ed41e04ff7d577edebe329fda3b8c69702ad800576210486dd74ce2c9aecd31ab579070cdfcb982519c65f35368d3812da70cd9e52b1ca
7
- data.tar.gz: 8df1be375aac78caaf4e3c5597ca2339b897cee9a568d23bf482d40e0c8f04da1b750fe223a354e31ac2327761ec245f45ca44aac84fd6a8df3a45e50ea6ebaf
6
+ metadata.gz: 1a024a85dc4c2b1f65d0c28f714d2d525146063460598c6194233d7869243637767f0fdc277d2caa4ee79082e1ca5af120efeb05ce6b3f737d9d8f9dd8bff0ac
7
+ data.tar.gz: 7a6858fc4e3e24e078576751a488004da93b14c8bbc3e90e7ba59892f47d898c443e6de323ab04aced26afa5b27d8156c5afd00bbfd31c51426d56fb13e528ca
data/Dangerfile CHANGED
@@ -1,3 +1,3 @@
1
1
  swift_format.binary_path = ".build/x86_64-apple-macosx/release/swift-format"
2
2
  swift_format.configuration = "swift-format.json"
3
- swift_format.lint("example/example.swift Dangerfile")
3
+ swift_format.lint(["example/example.swift", "Dangerfile"])
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- danger-apple_swift_format (0.0.3)
4
+ danger-apple_swift_format (0.0.4)
5
5
  danger-plugin-api (~> 1.0)
6
6
 
7
7
  GEM
@@ -1,3 +1,3 @@
1
1
  module SwiftFormat
2
- VERSION = "0.0.3".freeze
2
+ VERSION = "0.0.4".freeze
3
3
  end
@@ -29,7 +29,10 @@ module Danger
29
29
  # @return [Array<String>]
30
30
  #
31
31
  def lint(files)
32
- o, e, s = Open3.capture3("#{binary_path} lint -r --configuration #{configuration} #{target_file(files)}")
32
+ target = target_file(files)
33
+ return if target.empty?
34
+
35
+ o, e, s = Open3.capture3("#{binary_path} lint -r --configuration #{configuration} #{target}")
33
36
  return if e == ''
34
37
  warn e
35
38
  end
@@ -40,7 +43,11 @@ module Danger
40
43
  def format(files, in_place = false)
41
44
  in_place_option = "-i"
42
45
  in_place_option = '' if !in_place
43
- o, e, s = Open3.capture3("#{binary_path} format -r #{in_place_option} --configuration #{configuration} #{target_file(files)}")
46
+
47
+ target = target_file(files)
48
+ return if target.empty?
49
+
50
+ o, e, s = Open3.capture3("#{binary_path} format -r #{in_place_option} --configuration #{configuration} #{target}")
44
51
  return if e == ''
45
52
  warn e
46
53
  end
@@ -48,10 +55,10 @@ module Danger
48
55
  def target_file(files)
49
56
  target_files = []
50
57
 
51
- if files.instance_of?(Array)
52
- target_files = files
53
- elsif files.instance_of?(String)
58
+ if files.instance_of?(String)
54
59
  target_files = files.split(' ')
60
+ else
61
+ target_files = files
55
62
  end
56
63
 
57
64
  target_files.select { |f| f.include? '.swift' } .join(' ')
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: danger-apple_swift_format
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - kaito watanabe