diff --git a/lib/coverband/utils/html_formatter.rb b/lib/coverband/utils/html_formatter.rb index 7e5bedb1..562337b5 100644 --- a/lib/coverband/utils/html_formatter.rb +++ b/lib/coverband/utils/html_formatter.rb @@ -169,7 +169,16 @@ def shortened_filename(source_file) def link_to_source_file(source_file) data_loader_url = "#{base_path}load_file_details?filename=#{source_file.filename}" - %(#{shortened_filename source_file}) + %(#{truncate(shortened_filename(source_file))}) + end + + def truncate(text, length: 50) + if text.length <= length + text + else + omission = "..." + "#{text[0, length - omission.length]}#{omission}" + end end end end