danger-swiftlint 0.24.0 → 0.24.5

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
  SHA256:
3
- metadata.gz: 8bd5ffb51afbb7836e76cfc8bd0c6a0df09f8344ad5bacd69bba455c8ab73513
4
- data.tar.gz: 1df24c142a6c18201aa6acc6f01a00bea3d0bec6b34082101a466ec7427bf903
3
+ metadata.gz: a35b57008bbb1fa32b8b8c156bacc1b6610c0148c9c608287d6cf7f42d172792
4
+ data.tar.gz: c430570ca1990bb89e90d8b6c9fcb38e557d40e3307b4e7dc331e173bc68d2ac
5
5
  SHA512:
6
- metadata.gz: 55da087dc9bdace268e2ec965f3bbda84e8ae0af891b05f4404ca53e69056a44c257e03546c776dce379fcf451926905df9d17060cd8d59de51e00433ce24ac7
7
- data.tar.gz: fe2140a9eaed8f7a335241fde6eaa8d83895476d430f1541f4046a32f4e9bb23b31bfe8d783c41862b1d7add1812fcb123f6cd4ac01cecd25c94b14e78a996f1
6
+ metadata.gz: a276e2b26378e2b8ac740e6af1afc7430d622a3e02fda4f25eff08875149d51ee38887d30b58ff03b1356a55b0563041af2dfb7211599876023b8a56d72ffd14
7
+ data.tar.gz: 601e1a6e0b8ed52863740aef8aadda2427ac10a456a3c47b8472451b4c6d7ea9710148bfd2d63770c1f8637d09372875fcce04a7fa0b843d49ce26e8f03efb51
@@ -69,7 +69,7 @@ module Danger
69
69
 
70
70
  config_file_path = if config_file
71
71
  config_file
72
- elsif File.file?('.swiftlint.yml')
72
+ elsif !lint_all_files && File.file?('.swiftlint.yml')
73
73
  File.expand_path('.swiftlint.yml')
74
74
  end
75
75
  log "Using config file: #{config_file_path}"
@@ -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.24.0'
5
- SWIFTLINT_VERSION = '0.38.0'
4
+ VERSION = '0.24.5'
5
+ SWIFTLINT_VERSION = '0.41.0'
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.24.0
4
+ version: 0.24.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ash Furrow
@@ -9,10 +9,10 @@ authors:
9
9
  - Orta Therox
10
10
  - Thiago Felix
11
11
  - Giovanni Lodi
12
- autorequire:
12
+ autorequire:
13
13
  bindir: bin
14
14
  cert_chain: []
15
- date: 2020-01-07 00:00:00.000000000 Z
15
+ date: 2020-11-10 00:00:00.000000000 Z
16
16
  dependencies:
17
17
  - !ruby/object:Gem::Dependency
18
18
  name: danger
@@ -165,7 +165,7 @@ homepage: https://github.com/ashfurrow/danger-ruby-swiftlint
165
165
  licenses:
166
166
  - MIT
167
167
  metadata: {}
168
- post_install_message:
168
+ post_install_message:
169
169
  rdoc_options: []
170
170
  require_paths:
171
171
  - lib
@@ -181,7 +181,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
181
181
  version: '0'
182
182
  requirements: []
183
183
  rubygems_version: 3.0.3
184
- signing_key:
184
+ signing_key:
185
185
  specification_version: 4
186
186
  summary: A Danger plugin for linting Swift with SwiftLint.
187
187
  test_files: