Skip to content

Commit a309a46

Browse files
committed
Fix missing plugin.html_link
1 parent 661bd03 commit a309a46

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

lib/xcode_summary/plugin.rb

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -208,15 +208,18 @@ def parse_test_location(failure)
208208
end
209209

210210
def format_path(path)
211-
clean_path, line = parse_filename(path)
212-
path = clean_path + '#L' + line if clean_path && line
213-
214211
# Pick a Dangerfile plugin for a chosen request_source
215212
# based on https://github.com/danger/danger/blob/master/lib/danger/plugin_support/plugin.rb#L31
216213
plugins = Plugin.all_plugins.select { |plugin| Dangerfile.essential_plugin_classes.include? plugin }
217214
plugin = plugins.select { |p| p.method_defined? :html_link }.map { |p| p.new(@dangerfile) }.compact.first
218215

219-
plugin.html_link(path)
216+
if plugin
217+
clean_path, line = parse_filename(path)
218+
path = clean_path + '#L' + line if clean_path && line
219+
plugin.html_link(path)
220+
else
221+
path
222+
end
220223
end
221224

222225
def parse_filename(path)

spec/xcode_summary_spec.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -204,9 +204,9 @@ module Danger
204204

205205
describe 'where request source' do
206206
it 'should be bitbucket' do
207-
path = @xcode_summary.send(:format_path, 'lib/xcode_summary/plugin.rb#L3')
207+
path = @xcode_summary.send(:format_path, 'lib/xcode_summary/plugin.rb:3')
208208
# rubocop:disable LineLength
209-
expect(path).to eq "<a href='https://github.com/diogot/danger-xcode_summary/lib/xcode_summary/plugin.rb?at=4d4c0f31857e3185b51b6865a0700525bc0cb2bb#L3'>lib/xcode_summary/plugin.rb</a>"
209+
expect(path).to eq "lib/xcode_summary/plugin.rb:3"
210210
# rubocop:enable LineLength
211211
end
212212
end

0 commit comments

Comments
 (0)