danger-swiftlint 0.37.0 → 0.37.2

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: 987b2a3150cb10aa455265b5cca6967137700eb895a4798f20288b127017b353
4
- data.tar.gz: 7430c06da63ec29bd90d43a9deb30d5b7b87ef6ab2f413f88c50e617ea4b0e83
3
+ metadata.gz: 02b34e05139324558e9d68627f29aa02267bd6f51ffc27ce5353025d7e10a9ee
4
+ data.tar.gz: dad01485de11e1422c5c6be1386dc0c31d9795056cefbb3a2178c54d9353d319
5
5
  SHA512:
6
- metadata.gz: b9ea2c1233ab1bf566a0a882102a20b2f45302c841ab12df2b4f83b89b8d466775abe71a0a72e7dafce16e684579984a2c7aef10fd1af6080180e3f50011aea0
7
- data.tar.gz: f74c8b96027314efa6c8d8696ff44eba19fe7b0e40b5bdb034aa19ff3493e8a9d82d673d549fb968ae3fe99b45719a2584ae259a5cacfb0f563cebcb2780e8b5
6
+ metadata.gz: b4c7de228e8a0e6ec2406a33050124109d4fff8074b0d0bf04e9e8a109f438010c723254432c59aa0793ad46709064374aec411ec5eed4d9160f8b5bb64ca8ed
7
+ data.tar.gz: d82958a0169fc68812e0b78c95f01dbe085c0fa49b8175f6e720b78727881d4024e8e5927edf4470da32a59bcd0407675c5ac9c57535ffa54ed11044637f07f9
data/lib/danger_plugin.rb CHANGED
@@ -332,7 +332,7 @@ module Danger
332
332
  # @return [Array] swiftlint issues
333
333
  def filter_git_diff_issues(issues)
334
334
  modified_files_info = git_modified_files_info()
335
- return issues.select { |i|
335
+ return issues.select { |i|
336
336
  modified_files_info["#{i['file']}"] != nil && modified_files_info["#{i['file']}"].include?(i['line'].to_i)
337
337
  }
338
338
  end
@@ -347,6 +347,13 @@ module Danger
347
347
  modified_lines = git_modified_lines(file)
348
348
  modified_files_info[File.expand_path(file)] = modified_lines
349
349
  }
350
+ git.renamed_files.each { |pair|
351
+ before_file = pair[:before]
352
+ after_file = pair[:after]
353
+ modified_lines = git_modified_lines(before_file)
354
+ modified_files_info[File.expand_path(after_file)] = modified_lines
355
+ }
356
+
350
357
  modified_files_info
351
358
  end
352
359
 
data/lib/version.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module DangerSwiftlint
4
- VERSION = '0.37.0'
4
+ VERSION = '0.37.2'
5
5
  SWIFTLINT_VERSION = '0.57.0'
6
6
  SWIFTLINT_HASH = '100b4379098dc6760ef83424c2c2093b'
7
7
  end
@@ -444,6 +444,7 @@ module Danger
444
444
  allow(@swiftlint.git).to receive(:deleted_files).and_return([
445
445
  'spec/fixtures/DeletedFile.swift'
446
446
  ])
447
+ allow(@swiftlint.git).to receive(:renamed_files).and_return([])
447
448
  git_diff = File.read("spec/fixtures/SwiftFile.diff")
448
449
  allow(@swiftlint.git).to receive(:diff_for_file).and_return(git_diff)
449
450
  allow(@swiftlint.git.diff_for_file).to receive(:patch).and_return(git_diff)
@@ -461,6 +462,7 @@ module Danger
461
462
  allow(@swiftlint.git).to receive(:deleted_files).and_return([
462
463
  'spec/fixtures/DeletedFile.swift'
463
464
  ])
465
+ allow(@swiftlint.git).to receive(:renamed_files).and_return([])
464
466
  git_diff = File.read("spec/fixtures/SwiftFile.diff")
465
467
  allow(@swiftlint.git).to receive(:diff_for_file).and_return(git_diff)
466
468
  allow(@swiftlint.git.diff_for_file).to receive(:patch).and_return(git_diff)
@@ -485,6 +487,39 @@ module Danger
485
487
  expect(status[:warnings]).to eql(["Force casts should be avoided.\n`force_cast` `SwiftFile.swift:16`"])
486
488
  end
487
489
 
490
+ it 'issues violations in renamed_files' do
491
+ allow(@swiftlint.git).to receive(:added_files).and_return([])
492
+ allow(@swiftlint.git).to receive(:modified_files).and_return([])
493
+ allow(@swiftlint.git).to receive(:deleted_files).and_return([])
494
+ renamed_info = {
495
+ before: "spec/fixtures/BeforeRenamedSwiftFile.swift",
496
+ after: "spec/fixtures/SwiftFile.swift"
497
+ }
498
+ allow(@swiftlint.git).to receive(:renamed_files).and_return([renamed_info])
499
+ git_diff = File.read("spec/fixtures/SwiftFile.diff")
500
+ allow(@swiftlint.git).to receive(:diff_for_file).and_return(git_diff)
501
+ allow(@swiftlint.git.diff_for_file).to receive(:patch).and_return(git_diff)
502
+
503
+ swiftlint_violations_response = '[{ "rule_id" : "force_cast", "reason" : "Force casts should be avoided.", "character" : 19, "file" : "/Users/me/this_repo/spec/fixtures/SwiftFile.swift", "severity" : "Error", "type" : "Force Cast", "line" : 14 },
504
+ { "rule_id" : "force_cast", "reason" : "Force casts should be avoided.", "character" : 10, "file" : "/Users/me/this_repo/spec/fixtures/SwiftFile.swift", "severity" : "Error", "type" : "Force Cast", "line" : 16 }]'
505
+
506
+ violations_json = JSON.parse(swiftlint_violations_response)
507
+ violations_json[0][:file] = File.expand_path('spec/fixtures/SwiftFile.swift')
508
+ violations_json[1][:file] = File.expand_path('spec/fixtures/SwiftFile.swift')
509
+ swiftlint_violations_response= violations_json.to_json
510
+ allow_any_instance_of(Swiftlint).to receive(:lint)
511
+ .with(anything, '',
512
+ { 'SCRIPT_INPUT_FILE_COUNT' => '1',
513
+ 'SCRIPT_INPUT_FILE_0' => a_string_ending_with('spec/fixtures/SwiftFile.swift') })
514
+ .and_return(swiftlint_violations_response)
515
+
516
+ @swiftlint.filter_issues_in_diff = true
517
+ @swiftlint.lint_files('spec/fixtures/*.swift', inline_mode: true, fail_on_error: false, additional_swiftlint_args: '')
518
+
519
+ status = @swiftlint.status_report
520
+ expect(status[:warnings]).to eql(["Force casts should be avoided.\n`force_cast` `SwiftFile.swift:16`"])
521
+ end
522
+
488
523
  context '#strict' do
489
524
  before(:each) do
490
525
  allow_any_instance_of(Swiftlint).to receive(:lint)
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.37.0
4
+ version: 0.37.2
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: 2024-10-08 00:00:00.000000000 Z
15
+ date: 2025-07-24 00:00:00.000000000 Z
16
16
  dependencies:
17
17
  - !ruby/object:Gem::Dependency
18
18
  name: danger
@@ -34,14 +34,14 @@ dependencies:
34
34
  requirements:
35
35
  - - "~>"
36
36
  - !ruby/object:Gem::Version
37
- version: 1.0.0
37
+ version: '1.4'
38
38
  type: :runtime
39
39
  prerelease: false
40
40
  version_requirements: !ruby/object:Gem::Requirement
41
41
  requirements:
42
42
  - - "~>"
43
43
  - !ruby/object:Gem::Version
44
- version: 1.0.0
44
+ version: '1.4'
45
45
  - !ruby/object:Gem::Dependency
46
46
  name: rake
47
47
  requirement: !ruby/object:Gem::Requirement
@@ -90,14 +90,14 @@ dependencies:
90
90
  requirements:
91
91
  - - "~>"
92
92
  - !ruby/object:Gem::Version
93
- version: '2.14'
93
+ version: '2.19'
94
94
  type: :development
95
95
  prerelease: false
96
96
  version_requirements: !ruby/object:Gem::Requirement
97
97
  requirements:
98
98
  - - "~>"
99
99
  - !ruby/object:Gem::Version
100
- version: '2.14'
100
+ version: '2.19'
101
101
  - !ruby/object:Gem::Dependency
102
102
  name: guard-rspec
103
103
  requirement: !ruby/object:Gem::Requirement
@@ -166,7 +166,7 @@ homepage: https://github.com/ashfurrow/danger-ruby-swiftlint
166
166
  licenses:
167
167
  - MIT
168
168
  metadata: {}
169
- post_install_message:
169
+ post_install_message:
170
170
  rdoc_options: []
171
171
  require_paths:
172
172
  - lib
@@ -181,8 +181,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
181
181
  - !ruby/object:Gem::Version
182
182
  version: '0'
183
183
  requirements: []
184
- rubygems_version: 3.0.3.1
185
- signing_key:
184
+ rubygems_version: 3.5.21
185
+ signing_key:
186
186
  specification_version: 4
187
187
  summary: A Danger plugin for linting Swift with SwiftLint.
188
188
  test_files: