lib/swiftformat/plugin.rb in danger-swiftformat-0.5.0 vs lib/swiftformat/plugin.rb in danger-swiftformat-0.6.0
- old
+ new
@@ -72,10 +72,15 @@
# Find the files on which SwiftFormat should be run
#
# @return [Array<String]
def find_swift_files
- files = (git.modified_files - git.deleted_files) + git.added_files
+ renamed_files_hash = git.renamed_files.map { |rename| [rename[:before], rename[:after]] }.to_h
+
+ post_rename_modified_files = git.modified_files
+ .map { |modified_file| renamed_files_hash[modified_file] || modified_file }
+
+ files = (post_rename_modified_files - git.deleted_files) + git.added_files
@exclude = %w() if @exclude.nil?
files
.select { |file| file.end_with?(".swift") }