mirror of
https://github.com/realm/SwiftLint.git
synced 2026-05-07 20:12:49 +00:00
Report remaining fixed and new violations
Remaining are all violations that have not been put into other categories by mapping them to each other.
This commit is contained in:
+8
-4
@@ -297,6 +297,7 @@ def diff_and_report_changes_to_danger
|
||||
severity_changed = []
|
||||
rule_id_changed = []
|
||||
column_changed = []
|
||||
remaining_violations = []
|
||||
|
||||
new_violations.each do |line|
|
||||
fixed = fixed_violations.find { |other| line.equal_to?(other, [:message]) }
|
||||
@@ -315,8 +316,11 @@ def diff_and_report_changes_to_danger
|
||||
if fixed
|
||||
next column_changed << Change.new(:column, line, fixed)
|
||||
end
|
||||
remaining_violations << line
|
||||
end
|
||||
|
||||
remaining_fixed = fixed_violations - (message_changed + severity_changed + rule_id_changed + column_changed).map(&:old)
|
||||
|
||||
# Print new and fixed violations to be processed by Danger.
|
||||
new_violations.each { |line|
|
||||
warn "This PR introduced a violation in #{repo.name}: #{line.to_full_message_with_linked_path(repo)}"
|
||||
@@ -346,13 +350,13 @@ def diff_and_report_changes_to_danger
|
||||
summary.puts
|
||||
column_changed.each { |change| change.print_as_diff(repo, summary) }
|
||||
summary.puts
|
||||
summary.puts "### Fixed violations (#{fixed_violations.count})"
|
||||
summary.puts "### Other fixed violations (#{remaining_fixed.count})"
|
||||
summary.puts
|
||||
fixed_violations.each { |violation| summary.puts "- #{violation.to_full_message_with_linked_path(repo)}" }
|
||||
remaining_fixed.each { |violation| summary.puts "- #{violation.to_full_message_with_linked_path(repo)}" }
|
||||
summary.puts
|
||||
summary.puts "### New violations (#{new_violations.count})"
|
||||
summary.puts "### Other new violations (#{remaining_violations.count})"
|
||||
summary.puts
|
||||
new_violations.each { |violation| summary.puts "- #{violation.to_full_message_with_linked_path(repo)}" }
|
||||
remaining_violations.each { |violation| summary.puts "- #{violation.to_full_message_with_linked_path(repo)}" }
|
||||
summary.puts
|
||||
|
||||
summary.string
|
||||
|
||||
Reference in New Issue
Block a user