danger-swiftlint 0.11.0 → 0.11.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
2
  SHA1:
3
- metadata.gz: c3e7ed119f894d13115a6147e512b018678edd8e
4
- data.tar.gz: 9ead229790970463d5f2e7c8afcf03067a6decad
3
+ metadata.gz: 801ca7331651b5d31e403630ca6e5a7770da6e49
4
+ data.tar.gz: ad870c7c8b02c63f5ce0a51030ccb9eef85b346e
5
5
  SHA512:
6
- metadata.gz: 36d6752da9448acccea5208d1eb5453163cc1b5b17308a2c230840ae4bce72c3bd70681c83f71f2f7f2aef156edd570eeb37e50ff37b779b83685fffce5d2cd1
7
- data.tar.gz: b4eae3d9a68e20dc5c1551862fd154f626edad9af58af3a2ad5d5e3adfebdf8ca14fdd0a501fc4a05ecb753bcb2fe04bd78da60bd878a20cd5a77c653a2f05dc
6
+ metadata.gz: 724d304989202a0703445c167377db51e6307261cf9d8939a9aaeac19da08f539b90e8deecdef7f959cb6e009fccbf820972fd7df367fad24f6135a8b78a8a5f
7
+ data.tar.gz: 65deb8b5a903315562c330aa156d87ac6a244f1220f6dbaeeb2979012099742b8ea2f99da6fdf7010be64d281344205c430a1e987082723a46b20432728c3269
data/lib/danger_plugin.rb CHANGED
@@ -50,13 +50,13 @@ module Danger
50
50
  raise 'swiftlint is not installed' unless swiftlint.installed?
51
51
 
52
52
  config = if config_file
53
- File.expand_path(config_file)
53
+ config_file
54
54
  elsif File.file?('.swiftlint.yml')
55
55
  File.expand_path('.swiftlint.yml')
56
56
  end
57
57
  log "Using config file: #{config}"
58
58
 
59
- dir_selected = directory ? File.expand_path(directory) : Shellwords.escape(Dir.pwd)
59
+ dir_selected = directory ? File.expand_path(directory) : Dir.pwd
60
60
  log "Swiftlint will be run from #{dir_selected}"
61
61
 
62
62
  # Extract excluded paths
@@ -68,7 +68,8 @@ module Danger
68
68
 
69
69
  # Prepare swiftlint options
70
70
  options = {
71
- config: config,
71
+ # Make sure we don't fail when config path has spaces
72
+ config: config ? Shellwords.escape(config) : nil,
72
73
  reporter: 'json',
73
74
  quiet: true,
74
75
  pwd: dir_selected
@@ -125,22 +126,23 @@ module Danger
125
126
  #
126
127
  # @return [Array] swift files
127
128
  def find_swift_files(dir_selected, files = nil, excluded_paths = [])
129
+ # Needs to be escaped before comparsion with escaped file paths
130
+ dir_selected = Shellwords.escape(dir_selected)
131
+
128
132
  # Assign files to lint
129
133
  files = if files.nil?
130
134
  (git.modified_files - git.deleted_files) + git.added_files
131
135
  else
132
136
  Dir.glob(files)
133
137
  end
134
-
135
138
  # Filter files to lint
136
139
  files.
137
140
  # Ensure only swift files are selected
138
141
  select { |file| file.end_with?('.swift') }.
139
142
  # Make sure we don't fail when paths have spaces
140
- map { |file| Shellwords.escape(file) }.
143
+ map { |file| Shellwords.escape(File.expand_path(file)) }.
141
144
  # Remove dups
142
- uniq
143
- .map { |file| File.expand_path(file) }.
145
+ uniq.
144
146
  # Ensure only files in the selected directory
145
147
  select { |file| file.start_with?(dir_selected) }.
146
148
  # Reject files excluded on configuration
data/lib/version.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module DangerSwiftlint
4
- VERSION = '0.11.0'
4
+ VERSION = '0.11.1'
5
5
  SWIFTLINT_VERSION = '0.20.1'
6
6
  end
@@ -221,7 +221,7 @@ module Danger
221
221
  ])
222
222
 
223
223
  expect_any_instance_of(Swiftlint).to receive(:lint)
224
- .with(hash_including(config: File.expand_path('spec/fixtures/some_config.yml')), '')
224
+ .with(hash_including(config: 'spec/fixtures/some_config.yml'), '')
225
225
  .once
226
226
  .and_return(@swiftlint_response)
227
227
 
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.11.0
4
+ version: 0.11.1
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: 2017-10-26 00:00:00.000000000 Z
15
+ date: 2017-12-05 00:00:00.000000000 Z
16
16
  dependencies:
17
17
  - !ruby/object:Gem::Dependency
18
18
  name: danger