Skip to content

Commit

Permalink
Fix lint names
Browse files Browse the repository at this point in the history
  • Loading branch information
lsegal committed May 3, 2020
1 parent e62989e commit 651917f
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 14 deletions.
35 changes: 22 additions & 13 deletions lib/yard/cli/server.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# frozen_string_literal: true

module YARD
module CLI
# A local documentation server
Expand Down Expand Up @@ -58,11 +59,13 @@ def load_scripts

def load_template_paths
return if YARD::Config.options[:safe_mode]

Templates::Engine.template_paths |= template_paths
end

def select_adapter
return adapter if adapter

require 'rubygems'
require 'rack'
self.adapter = YARD::Server::RackAdapter
Expand Down Expand Up @@ -129,7 +132,8 @@ def add_gems
require 'rubygems'
YARD::GemIndex.each do |spec|
libraries[spec.name] ||= []
libraries[spec.name] |= [YARD::Server::LibraryVersion.new(spec.name, spec.version.to_s, nil, :gem)]
libraries[spec.name] |= [YARD::Server::LibraryVersion.new(spec.name, spec.version.to_s,
nil, :gem)]
end
end

Expand All @@ -139,7 +143,8 @@ def add_gems_from_gemfile(gemfile = nil)
if File.exist?("#{gemfile}.lock")
Bundler::LockfileParser.new(File.read("#{gemfile}.lock")).specs.each do |spec|
libraries[spec.name] ||= []
libraries[spec.name] |= [YARD::Server::LibraryVersion.new(spec.name, spec.version.to_s, nil, :gem)]
libraries[spec.name] |= [YARD::Server::LibraryVersion.new(spec.name,
spec.version.to_s, nil, :gem)]
end
else
log.warn "Cannot find #{gemfile}.lock, ignoring --gemfile option"
Expand Down Expand Up @@ -171,7 +176,8 @@ def optparse(*args)
opts.on('-g', '--gems', 'Serves documentation for installed gems') do
add_gems
end
opts.on('-G', '--gemfile [GEMFILE]', 'Serves documentation for gems from Gemfile') do |gemfile|
opts.on('-G', '--gemfile [GEMFILE]',
'Serves documentation for gems from Gemfile') do |gemfile|
add_gems_from_gemfile(gemfile)
end
opts.on('-t', '--template-path PATH',
Expand All @@ -192,23 +198,26 @@ def optparse(*args)
opts.on('--docroot DOCROOT', 'Uses DOCROOT as document root') do |docroot|
server_options[:DocumentRoot] = File.expand_path(docroot)
end
opts.on('-a', '--adapter ADAPTER', 'Use the ADAPTER (full Ruby class) for web server') do |adapter|
if adapter.casecmp('webrick') == 0
self.adapter = YARD::Server::WebrickAdapter
elsif adapter.casecmp('rack') == 0
self.adapter = YARD::Server::RackAdapter
else
self.adapter = eval(adapter) # rubocop:disable Lint/Eval
end
opts.on('-a', '--adapter ADAPTER',
'Use the ADAPTER (full Ruby class) for web server') do |adapter|
self.adapter = if adapter.casecmp('webrick') == 0
YARD::Server::WebrickAdapter
elsif adapter.casecmp('rack') == 0
YARD::Server::RackAdapter
else
eval(adapter) # rubocop:disable Security/Eval
end
end
opts.on('-s', '--server TYPE', 'Use a specific server type eg. thin,mongrel,cgi (Rack specific)') do |type|
opts.on('-s', '--server TYPE',
'Use a specific server type eg. thin,mongrel,cgi (Rack specific)') do |type|
server_options[:server] = type
end
opts.on('--fork', 'Use process forking when serving requests') do
options[:use_fork] = true
end
common_options(opts)
opts.on('-e', '--load FILE', 'A Ruby script to load before the source tree is parsed.') do |file|
opts.on('-e', '--load FILE',
'A Ruby script to load before the source tree is parsed.') do |file|
scripts << file
end
parse_options(opts, args)
Expand Down
2 changes: 1 addition & 1 deletion lib/yard/globals.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#
# @see YARD::CodeObjects::Proxy
# @see YARD::Registry.resolve
def P(namespace, name = nil, type = nil) # rubocop:disable Style/MethodName
def P(namespace, name = nil, type = nil) # rubocop:disable Naming/MethodName
if name.nil?
name = namespace
namespace = nil
Expand Down

0 comments on commit 651917f

Please sign in to comment.