danger-swiftlint 0.21.0 → 0.21.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/danger_plugin.rb +29 -21
- data/lib/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6e30637e9b9981efedc2a18d8acdf8f9957a0f813f714b131601f43dce07ec0d
|
4
|
+
data.tar.gz: b0c6033a1291893cc3b871cfd3f7d6fb631d89431ca3724d0f187e5ef69bdfc0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1417540992b6d0b2ccd7a1b9dacd57235f66e3e495ef826af54168e0686434efaf80eb552a35f212091cd5f8d297b6252810c0be1074214d4b19c2c7c680a992
|
7
|
+
data.tar.gz: aef461f9368041b4c0f8e9d30d64e3eb42e4110578cf009660234d05e6c1e026d1a3c09f1a80fa88e96bee7602f0cb5d9e9c2822add4c4dea554c04e8bbf67c5
|
data/lib/danger_plugin.rb
CHANGED
@@ -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
|
-
|
106
|
-
|
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
|
155
|
+
# Run swiftlint on all files and returns the issues
|
151
156
|
#
|
152
157
|
# @return [Array] swiftlint issues
|
153
|
-
def run_swiftlint(
|
154
|
-
|
155
|
-
|
156
|
-
|
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
|
-
|
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
|
#
|
data/lib/version.rb
CHANGED
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.
|
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-
|
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.
|
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.
|