Sha256: 3e1b8678fa1e67acb9c1a2324d4d595ac3273e41bdf6d0dc723fe45a17d532e8
Contents?: true
Size: 910 Bytes
Versions: 9
Compression:
Stored size: 910 Bytes
Contents
# frozen_string_literal: true require_relative 'simple_warning_formatter' module Reek module Report module Formatter # # Formatter that adds a link to the wiki to the basic message from # SimpleWarningFormatter. # class WikiLinkWarningFormatter < SimpleWarningFormatter BASE_URL_FOR_HELP_LINK = 'https://github.com/troessner/reek/blob/master/docs/'.freeze def format(warning) "#{super} [#{explanatory_link(warning)}]" end def format_hash(warning) super.merge('wiki_link' => explanatory_link(warning)) end private def explanatory_link(warning) "#{BASE_URL_FOR_HELP_LINK}#{class_name_to_param(warning.smell_type)}.md" end # :reek:UtilityFunction def class_name_to_param(name) name.split(/(?=[A-Z])/).join('-') end end end end end
Version data entries
9 entries across 9 versions & 1 rubygems