Skip to content

Commit 454b534

Browse files
authored
Merge pull request #52 from fabio-gallonetto/patch-1
Fix a bug that was causing a huge amount of calls to git APIs
2 parents 020d670 + 045226a commit 454b534

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

lib/xcode_summary/plugin.rb

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,13 @@ def inline_mode
9898
def ignores_warnings
9999
@ignores_warnings || false
100100
end
101+
102+
def plugin
103+
# Pick a Dangerfile plugin for a chosen request_source
104+
# based on https://github.com/danger/danger/blob/master/lib/danger/plugin_support/plugin.rb#L31
105+
plugins = Plugin.all_plugins.select { |plugin| Dangerfile.essential_plugin_classes.include? plugin }
106+
@plugin ||= plugins.select { |p| p.method_defined? :html_link }.map { |p| p.new(@dangerfile) }.compact.first
107+
end
101108
# rubocop:enable Lint/DuplicateMethods
102109

103110
# Reads a file with JSON Xcode summary and reports it.
@@ -210,11 +217,6 @@ def parse_test_location(failure)
210217
end
211218

212219
def format_path(path)
213-
# Pick a Dangerfile plugin for a chosen request_source
214-
# based on https://github.com/danger/danger/blob/master/lib/danger/plugin_support/plugin.rb#L31
215-
plugins = Plugin.all_plugins.select { |plugin| Dangerfile.essential_plugin_classes.include? plugin }
216-
plugin = plugins.select { |p| p.method_defined? :html_link }.map { |p| p.new(@dangerfile) }.compact.first
217-
218220
if plugin
219221
clean_path, line = parse_filename(path)
220222
path = clean_path + '#L' + line if clean_path && line

0 commit comments

Comments
 (0)