danger-swiftlint 0.21.0 → 0.21.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.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/lib/danger_plugin.rb +29 -21
  3. data/lib/version.rb +1 -1
  4. metadata +3 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4c683ebc4b9a3a612c68eee9889d766458b4e1a4517b7f2022d3107175adad46
4
- data.tar.gz: dacd9783690561139fb4f4fd5ce1d100dbb82e49c881a64e5c454962abee046e
3
+ metadata.gz: 6e30637e9b9981efedc2a18d8acdf8f9957a0f813f714b131601f43dce07ec0d
4
+ data.tar.gz: b0c6033a1291893cc3b871cfd3f7d6fb631d89431ca3724d0f187e5ef69bdfc0
5
5
  SHA512:
6
- metadata.gz: 72a01b3969c23207a994a932d0829fc9f1954c5dc37a1686e44d9496ee885cc15be1cfa4fafbbe42a6b08507c638f6055043455692d03af2c54fcd559e417c7c
7
- data.tar.gz: d4e0b33363e8cced89e749e954e59d1ad3afb5e20fd788677436b1bebeb9ba7404f4db7cbd54647068bbf0579a02fbe6ccec9b1995ab791065f195b14063f245
6
+ metadata.gz: 1417540992b6d0b2ccd7a1b9dacd57235f66e3e495ef826af54168e0686434efaf80eb552a35f212091cd5f8d297b6252810c0be1074214d4b19c2c7c680a992
7
+ data.tar.gz: aef461f9368041b4c0f8e9d30d64e3eb42e4110578cf009660234d05e6c1e026d1a3c09f1a80fa88e96bee7602f0cb5d9e9c2822add4c4dea554c04e8bbf67c5
@@ -87,10 +87,6 @@ module Danger
87
87
 
88
88
  log "Swiftlint includes the following paths: #{included_paths}"
89
89
 
90
- # Extract swift files (ignoring excluded ones)
91
- files = find_swift_files(dir_selected, files, excluded_paths, included_paths)
92
- log "Swiftlint will lint the following files: #{files.join(', ')}"
93
-
94
90
  # Prepare swiftlint options
95
91
  options = {
96
92
  # Make sure we don't fail when config path has spaces
@@ -102,8 +98,17 @@ module Danger
102
98
  }
103
99
  log "linting with options: #{options}"
104
100
 
105
- # Lint each file and collect the results
106
- issues = run_swiftlint(files, lint_all_files, options, additional_swiftlint_args)
101
+ if lint_all_files
102
+ issues = run_swiftlint(options, additional_swiftlint_args)
103
+ else
104
+ # Extract swift files (ignoring excluded ones)
105
+ files = find_swift_files(dir_selected, files, excluded_paths, included_paths)
106
+ log "Swiftlint will lint the following files: #{files.join(', ')}"
107
+
108
+ # Lint each file and collect the results
109
+ issues = run_swiftlint_for_each(files, options, additional_swiftlint_args)
110
+ end
111
+
107
112
  @issues = issues
108
113
  other_issues_count = 0
109
114
  unless @max_num_violations.nil? || no_comment
@@ -147,27 +152,30 @@ module Danger
147
152
  end
148
153
  end
149
154
 
150
- # Run swiftlint on each file and aggregate collect the issues
155
+ # Run swiftlint on all files and returns the issues
151
156
  #
152
157
  # @return [Array] swiftlint issues
153
- def run_swiftlint(files, lint_all_files, options, additional_swiftlint_args)
154
- if lint_all_files
155
- result = swiftlint.lint(options, additional_swiftlint_args)
156
- if result == ''
157
- {}
158
- else
159
- JSON.parse(result).flatten
160
- end
158
+ def run_swiftlint(options, additional_swiftlint_args)
159
+ result = swiftlint.lint(options, additional_swiftlint_args)
160
+ if result == ''
161
+ {}
161
162
  else
162
- files
163
- .map { |file| options.merge(path: file) }
164
- .map { |full_options| swiftlint.lint(full_options, additional_swiftlint_args) }
165
- .reject { |s| s == '' }
166
- .map { |s| JSON.parse(s).flatten }
167
- .flatten
163
+ JSON.parse(result).flatten
168
164
  end
169
165
  end
170
166
 
167
+ # Run swiftlint on each file and aggregate collect the issues
168
+ #
169
+ # @return [Array] swiftlint issues
170
+ def run_swiftlint_for_each(files, options, additional_swiftlint_args)
171
+ files
172
+ .map { |file| options.merge(path: file) }
173
+ .map { |full_options| swiftlint.lint(full_options, additional_swiftlint_args) }
174
+ .reject { |s| s == '' }
175
+ .map { |s| JSON.parse(s).flatten }
176
+ .flatten
177
+ end
178
+
171
179
  # Find swift files from the files glob
172
180
  # If files are not provided it will use git modifield and added files
173
181
  #
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module DangerSwiftlint
4
- VERSION = '0.21.0'
4
+ VERSION = '0.21.1'
5
5
  SWIFTLINT_VERSION = '0.31.0'
6
6
  end
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.21.0
4
+ version: 0.21.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: 2019-05-02 00:00:00.000000000 Z
15
+ date: 2019-05-21 00:00:00.000000000 Z
16
16
  dependencies:
17
17
  - !ruby/object:Gem::Dependency
18
18
  name: danger
@@ -181,7 +181,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
181
181
  version: '0'
182
182
  requirements: []
183
183
  rubyforge_project:
184
- rubygems_version: 2.7.8
184
+ rubygems_version: 2.7.6
185
185
  signing_key:
186
186
  specification_version: 4
187
187
  summary: A Danger plugin for linting Swift with SwiftLint.