class RuboCop::CLI::Command::ShowDocsUrl
Prints out url to documentation of provided cops or documentation base url by default. @api private
Public Class Methods
new(env)
click to toggle source
Calls superclass method
RuboCop::CLI::Command::Base::new
# File lib/rubocop/cli/command/show_docs_url.rb, line 12 def initialize(env) super @config = @config_store.for(Dir.pwd) end
Public Instance Methods
run()
click to toggle source
# File lib/rubocop/cli/command/show_docs_url.rb, line 18 def run print_documentation_url end
Private Instance Methods
cops_array()
click to toggle source
# File lib/rubocop/cli/command/show_docs_url.rb, line 38 def cops_array @cops_array ||= @options[:show_docs_url] end
print_documentation_url()
click to toggle source
# File lib/rubocop/cli/command/show_docs_url.rb, line 24 def print_documentation_url puts Cop::Documentation.default_base_url if cops_array.empty? cops_array.each do |cop_name| cop = registry_hash[cop_name] next if cop.empty? url = Cop::Documentation.url_for(cop.first, @config) puts url if url end puts end
registry_hash()
click to toggle source
# File lib/rubocop/cli/command/show_docs_url.rb, line 42 def registry_hash @registry_hash ||= Cop::Registry.global.to_h end