lib/xcode_summary/plugin.rb in danger-ikr-xcode_summary-1.2.0 vs lib/xcode_summary/plugin.rb in danger-ikr-xcode_summary-1.2.1

- old
+ new

@@ -19,10 +19,11 @@ # @tags xcode, xcodebuild, format # class DangerXcodeSummary < Plugin Location = Struct.new(:file_name, :file_path, :line) Result = Struct.new(:message, :location) + Warning = Struct.new(:message, :sticky, :location) # The project root, which will be used to make the paths relative. # Defaults to `pwd`. # @param [String] value # @return [String] @@ -132,16 +133,22 @@ end private def format_summary(xcode_summary) + # Warning = Struct.new(:message, :sticky, :location) + all_warnings = [] xcode_summary.actions_invocation_record.actions.each do |action| warnings(action).each do |result| if inline_mode && result.location - warn(result.message, sticky: false, file: result.location.file_path, line: result.location.line) + # warn(result.message, sticky: false, file: result.location.file_path, line: result.location.line) + warning_object = Warning.new(result.message, false, result.location) + all_warnings << warning else - warn(result.message, sticky: false) + # warn(result.message, sticky: false) + warning_object = Warning.new(result.message, false, nil) + all_warnings << warning end end errors(action).each do |result| if inline_mode && result.location if strict @@ -156,10 +163,25 @@ warn(result.message, sticky: false) end end end end + all_warnings = all_warnings.sort_by do |warning| + if warning.message.include?("is deprecated:") + 1 + else + 0 + end + end + + all_warnings.each do |warning| + if inline_mode && warning.location + warn(warning.message, sticky: warning.sticky, file: warning.location.file_path, line: warning.location.line) + else + warn(result.message, sticky: warning.sticky) + end + end end def warnings(action) return [] if ignores_warnings @@ -169,17 +191,9 @@ ].flatten.compact.map do |summary| result = Result.new(summary.message, parse_location(summary.document_location_in_creating_workspace)) Result.new(format_warning(result), result.location) end warnings = warnings.uniq.reject { |result| result.message.nil? } - warnings = warnings.uniq.reject { |result| result.message.nil? } - warnings = warnings.sort_by do |result| - if result.message.include?("is deprecated:") - 1 - else - 0 - end - end warnings.delete_if(&ignored_results) end def errors(action) errors = [