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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d124a22a2db51e5527b4a8032d543ed75904a0fcf01fc539686bddceaddb25c2
4
- data.tar.gz: fbd279ea07e0ee226252862b25bb459babe781da4e7466654b4361376d72fefc
3
+ metadata.gz: 683d845df224c2d9d4739b53011fa985ec25808d941781d82329761e9a5f4a08
4
+ data.tar.gz: bf54a06f76d88406230b451440aae8b42bbca2c2b517140e3fb20b533826be75
5
5
  SHA512:
6
- metadata.gz: 6cc159309e6692bc75cb8f55b81b5baa5fc01c8942d5b7738d3ea51b41e402cf01ffa9d4a1f0fce2b5a53210609f9d2d4e044dbbf901dec7d360922d1e0c9a6f
7
- data.tar.gz: 372946ca17a1f473a699833c103946aec9a47b8eda7b5d400fc26547358becef01ac7c2a85536911ec7f7ecd7835071938df70c7ffc3db7faec505116c533892
6
+ metadata.gz: cf25410d65d64ca8bc7e55a6482ab06d1e2d50b7ab30ef8ab6a3fc0951bd689948169e3b9d5f33ddd2dd4bbb8224f4a8290927fe8042a1e63c5437c49699f46a
7
+ data.tar.gz: 43a48cd8e46d7fd0474047252f5c8ac75a50de2647922d6251f1ba57f820af083234583b89465b0bda957a86208a96078c8c6d94b0d665b9d193ad1aadb428a0
@@ -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| file_exists?(excluded_paths, file) }.
231
+ reject { |file| excluded_paths_list.include?(file) }.
230
232
  # Accept files included on configuration
231
233
  select do |file|
232
- next true if included_paths.empty?
233
- file_exists?(included_paths, file)
234
- end
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
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module DangerSwiftlint
4
- VERSION = '0.23.0'
5
- SWIFTLINT_VERSION = '0.33.1'
4
+ VERSION = '0.24.4'
5
+ SWIFTLINT_VERSION = '0.40.1'
6
6
  end
@@ -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(23)
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.23.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: 2019-07-29 00:00:00.000000000 Z
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
- rubyforge_project:
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.