Applied Rubocop feedback.

v3-stable
Mauro Otonelli 2015-07-19 20:45:45 -03:00
parent c11a9e6f39
commit dcc52d967c
9 changed files with 11 additions and 16 deletions

View File

@ -35,13 +35,13 @@ module Middleman::Cli
# Output a .gitignore file
class_option :git, type: :boolean, default: true
no_tasks {
no_tasks do
# Write a .gitignore file for project
# @return [void]
def generate_gitignore!
return unless options[:git]
copy_file 'gitignore', File.join(name, '.gitignore')
end
}
end
end
end

View File

@ -118,7 +118,6 @@ module Middleman
# Set the value of a setting by key. Creates the setting if it doesn't exist.
# @param [Symbol] key
# @param [Object] val
# rubocop:disable UselessSetterCall
def []=(key, val)
setting_obj = setting(key) || define_setting(key)
setting_obj.value = val
@ -228,7 +227,6 @@ module Middleman
end
# Whether or not there has been a value set beyond the default
# rubocop:disable TrivialAccessors
def value_set?
@value_set
end

View File

@ -428,7 +428,7 @@ module Middleman
layout_path = locate_layout(layout_name, current_engine)
if !layout_path
unless layout_path
raise ::Middleman::CoreExtensions::Rendering::TemplateNotFound, "Could not locate layout: #{layout_name}"
end
@ -462,7 +462,6 @@ module Middleman
end
# The currently rendering engine
# rubocop:disable TrivialAccessors
# @return [Symbol, nil]
def current_engine=(v)
@_current_engine = v

View File

@ -130,7 +130,6 @@ module Middleman
@klass.after_configuration do
ext.after_configuration if ext.respond_to?(:after_configuration)
# rubocop:disable IfUnlessModifier
if ext.respond_to?(:manipulate_resource_list)
ext.app.sitemap.register_resource_list_manipulator(ext.class.extension_name, ext)
end

View File

@ -17,7 +17,6 @@ module Middleman
module ResourceInstanceMethods
# Whether this page is a proxy
# rubocop:disable TrivialAccessors
# @return [Boolean]
def proxy?
@proxied_to

View File

@ -102,13 +102,13 @@ class Middleman::CoreExtensions::DefaultHelpers < ::Middleman::Extension
# Override helper to add `relative` opt-out.
def stylesheet_link_tag(*sources)
options = {
:rel => 'stylesheet'
rel: 'stylesheet'
}.update(sources.extract_options!.symbolize_keys)
path_options = {}
path_options[:relative] = options.delete(:relative) if options.key?(:relative)
sources.flatten.inject(ActiveSupport::SafeBuffer.new) do |all,source|
sources.flatten.inject(ActiveSupport::SafeBuffer.new) do |all, source|
all << tag(:link, {
href: asset_path(:css, source, path_options)
}.update(options))
@ -122,7 +122,7 @@ class Middleman::CoreExtensions::DefaultHelpers < ::Middleman::Extension
path_options = {}
path_options[:relative] = options.delete(:relative) if options.key?(:relative)
sources.flatten.inject(::ActiveSupport::SafeBuffer.new) do |all,source|
sources.flatten.inject(::ActiveSupport::SafeBuffer.new) do |all, source|
all << content_tag(:script, nil, {
src: asset_path(:js, source, path_options)
}.update(options))

View File

@ -245,10 +245,10 @@ class Middleman::CoreExtensions::Internationalization < ::Middleman::Extension
::I18n.locale = lang
localized_page_id = ::I18n.t("paths.#{page_id}", default: page_id, fallback: [])
partially_localized_path = ""
partially_localized_path = ''
File.dirname(path).split('/').each do |path_sub|
next if path_sub == ""
next if path_sub == ''
partially_localized_path = "#{partially_localized_path}/#{(::I18n.t("paths.#{path_sub}", default: path_sub).to_s)}"
end

View File

@ -152,8 +152,8 @@ class Middleman::Extensions::Lorem < ::Middleman::Extension
color = options[:color]
if options[:random_color]
background_color = hex.shuffle[0...6].join
color = hex.shuffle[0...6].join
background_color = hex.sample(6).join
color = hex.sample(6).join
end
src << "/#{background_color.sub(/^#/, '')}" if background_color

View File

@ -18,7 +18,7 @@ class Middleman::Extensions::RelativeAssets < ::Middleman::Extension
def asset_url(path, prefix='', options={})
options[:relative] = true unless options.key?(:relative)
path = super(path, prefix, options)
super(path, prefix, options)
end
end
end