danger-swiftlint 0.23.0 → 0.24.4
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 +8 -17
- data/lib/version.rb +2 -2
- data/spec/danger_plugin_spec.rb +2 -1
- metadata +3 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 683d845df224c2d9d4739b53011fa985ec25808d941781d82329761e9a5f4a08
|
4
|
+
data.tar.gz: bf54a06f76d88406230b451440aae8b42bbca2c2b517140e3fb20b533826be75
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cf25410d65d64ca8bc7e55a6482ab06d1e2d50b7ab30ef8ab6a3fc0951bd689948169e3b9d5f33ddd2dd4bbb8224f4a8290927fe8042a1e63c5437c49699f46a
|
7
|
+
data.tar.gz: 43a48cd8e46d7fd0474047252f5c8ac75a50de2647922d6251f1ba57f820af083234583b89465b0bda957a86208a96078c8c6d94b0d665b9d193ad1aadb428a0
|
data/lib/danger_plugin.rb
CHANGED
@@ -216,6 +216,8 @@ module Danger
|
|
216
216
|
Dir.glob(files)
|
217
217
|
end
|
218
218
|
# Filter files to lint
|
219
|
+
excluded_paths_list = Find.find(*excluded_paths).to_a
|
220
|
+
included_paths_list = Find.find(*included_paths).to_a
|
219
221
|
files.
|
220
222
|
# Ensure only swift files are selected
|
221
223
|
select { |file| file.end_with?('.swift') }.
|
@@ -226,12 +228,12 @@ module Danger
|
|
226
228
|
# Ensure only files in the selected directory
|
227
229
|
select { |file| file.start_with?(dir_selected) }.
|
228
230
|
# Reject files excluded on configuration
|
229
|
-
reject { |file|
|
231
|
+
reject { |file| excluded_paths_list.include?(file) }.
|
230
232
|
# Accept files included on configuration
|
231
233
|
select do |file|
|
232
|
-
|
233
|
-
|
234
|
-
|
234
|
+
next true if included_paths.empty?
|
235
|
+
included_paths_list.include?(file)
|
236
|
+
end
|
235
237
|
end
|
236
238
|
|
237
239
|
# Get the configuration file
|
@@ -256,16 +258,6 @@ module Danger
|
|
256
258
|
end
|
257
259
|
end
|
258
260
|
|
259
|
-
# Return whether the file exists within a specified collection of paths
|
260
|
-
#
|
261
|
-
# @return [Bool] file exists within specified collection of paths
|
262
|
-
def file_exists?(paths, file)
|
263
|
-
paths.any? do |path|
|
264
|
-
Find.find(path)
|
265
|
-
.include?(file)
|
266
|
-
end
|
267
|
-
end
|
268
|
-
|
269
261
|
# Parses the configuration file and return the specified files in path
|
270
262
|
#
|
271
263
|
# @return [Array] list of files specified in path
|
@@ -362,8 +354,7 @@ module Danger
|
|
362
354
|
def git_modified_lines(file)
|
363
355
|
git_range_info_line_regex = /^@@ .+\+(?<line_number>\d+),/
|
364
356
|
git_modified_line_regex = /^\+(?!\+|\+)/
|
365
|
-
git_removed_line_regex =
|
366
|
-
git_not_removed_line_regex = /^[^-]/
|
357
|
+
git_removed_line_regex = /^\-(?!\-|\-)/
|
367
358
|
file_info = git.diff_for_file(file)
|
368
359
|
line_number = 0
|
369
360
|
lines = []
|
@@ -375,7 +366,7 @@ module Danger
|
|
375
366
|
when git_modified_line_regex
|
376
367
|
lines << line_number
|
377
368
|
end
|
378
|
-
line_number += 1 if line_number > 0
|
369
|
+
line_number += 1 if line_number > 0 && !git_removed_line_regex.match?(line)
|
379
370
|
line_number = starting_line_number if line_number == 0 && starting_line_number > 0
|
380
371
|
end
|
381
372
|
lines
|
data/lib/version.rb
CHANGED
data/spec/danger_plugin_spec.rb
CHANGED
@@ -419,7 +419,8 @@ module Danger
|
|
419
419
|
allow(@swiftlint.git.diff_for_file).to receive(:patch).and_return(git_diff)
|
420
420
|
modified_lines = @swiftlint.git_modified_lines("spec/fixtures/SwiftFile.swift")
|
421
421
|
expect(modified_lines).to_not be_empty
|
422
|
-
expect(modified_lines.length).to eql(
|
422
|
+
expect(modified_lines.length).to eql(24)
|
423
|
+
expect(modified_lines).to eql([15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 42])
|
423
424
|
end
|
424
425
|
|
425
426
|
it 'Get git modified files info' do
|
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.24.4
|
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:
|
15
|
+
date: 2020-08-27 00:00:00.000000000 Z
|
16
16
|
dependencies:
|
17
17
|
- !ruby/object:Gem::Dependency
|
18
18
|
name: danger
|
@@ -180,8 +180,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
180
180
|
- !ruby/object:Gem::Version
|
181
181
|
version: '0'
|
182
182
|
requirements: []
|
183
|
-
|
184
|
-
rubygems_version: 2.7.10
|
183
|
+
rubygems_version: 3.0.6
|
185
184
|
signing_key:
|
186
185
|
specification_version: 4
|
187
186
|
summary: A Danger plugin for linting Swift with SwiftLint.
|