Merge pull request #1416 from dg-ratiodata/feature/fix_offenses

Fix rubocop offenses
This commit is contained in:
Eliott Appleford 2015-02-19 00:50:46 +00:00
commit a977f8bf20
10 changed files with 24 additions and 20 deletions

View file

@ -49,4 +49,8 @@ RegexpLiteral:
FormatString: FormatString:
Enabled: false Enabled: false
CaseIndentation: CaseIndentation:
IndentWhenRelativeTo: end IndentWhenRelativeTo: end
Metrics/AbcSize:
Enabled: false
Metrics/PerceivedComplexity:
Enabled: false

View file

@ -64,7 +64,7 @@ module Middleman::CoreExtensions
data = app.extensions[:frontmatter].data(source_file).first data = app.extensions[:frontmatter].data(source_file).first
if proxy? if proxy?
url_data = app.extensions[:frontmatter].data( File.join( app.source_dir, url ).chomp('/') ).first url_data = app.extensions[:frontmatter].data(File.join(app.source_dir, url).chomp('/')).first
data = data.deep_merge(url_data) data = data.deep_merge(url_data)
end end

View file

@ -23,7 +23,7 @@ module Middleman
# If we've already got a matching extension that passed the # If we've already got a matching extension that passed the
# version check, bail out. # version check, bail out.
return if registered.key?(name.to_sym) && return if registered.key?(name.to_sym) &&
!registered[name.to_sym].is_a?(String) !registered[name.to_sym].is_a?(String)
registered[name.to_sym] = if block_given? registered[name.to_sym] = if block_given?
block block

View file

@ -31,7 +31,7 @@ module Middleman
mail_addr = el.attr['href'].sub(/\Amailto:/, '') mail_addr = el.attr['href'].sub(/\Amailto:/, '')
href = obfuscate('mailto') << ':' << obfuscate(mail_addr) href = obfuscate('mailto') << ':' << obfuscate(mail_addr)
content = obfuscate(content) if content == mail_addr content = obfuscate(content) if content == mail_addr
return %Q(<a href="#{href}">#{content}</a>) return %(<a href="#{href}">#{content}</a>)
end end
attr = el.attr.dup attr = el.attr.dup

View file

@ -61,7 +61,7 @@ module Middleman
middleman_app.image_tag(link, title: title, alt: alt_text) middleman_app.image_tag(link, title: title, alt: alt_text)
else else
link_string = link.dup link_string = link.dup
link_string << %Q("#{title}") if title && title.length > 0 && title != alt_text link_string << %("#{title}") if title && title.length > 0 && title != alt_text
"![#{alt_text}](#{link_string})" "![#{alt_text}](#{link_string})"
end end
end end
@ -74,7 +74,7 @@ module Middleman
middleman_app.link_to(content, link, attributes) middleman_app.link_to(content, link, attributes)
else else
link_string = link.dup link_string = link.dup
link_string << %Q("#{title}") if title && title.length > 0 && title != alt_text link_string << %("#{title}") if title && title.length > 0 && title != alt_text
"[#{content}](#{link_string})" "[#{content}](#{link_string})"
end end
end end

View file

@ -21,9 +21,9 @@ module Middleman
# @return [Boolean] # @return [Boolean]
def ignored? def ignored?
@app.ignore_manager.ignored?(path) || @app.ignore_manager.ignored?(path) ||
(!proxy? && (!proxy? &&
@app.ignore_manager.ignored?(source_file.sub("#{@app.source_dir}/", '')) @app.ignore_manager.ignored?(source_file.sub("#{@app.source_dir}/", ''))
) )
end end
end end

View file

@ -53,7 +53,7 @@ module Middleman
proxy_resource proxy_resource
end end
# rubocop:disable AccessorMethodName # rubocop:disable Style/AccessorMethodName
def get_source_file def get_source_file
if proxy? if proxy?
proxied_to_resource.source_file proxied_to_resource.source_file
@ -61,16 +61,15 @@ module Middleman
super super
end end
end end
# rubocop:enable Style/AccessorMethodName
def content_type def content_type
mime_type = super mime_type = super
return mime_type if mime_type return mime_type if mime_type
if proxy? return proxied_to_resource.content_type if proxy?
proxied_to_resource.content_type
else nil
nil
end
end end
end end

View file

@ -66,9 +66,11 @@ module Middleman
super(store, path) super(store, path)
end end
# rubocop:disable Style/AccessorMethodName
def get_source_file def get_source_file
nil nil
end end
# rubocop:enable Style/AccessorMethodName
def template? def template?
true true

View file

@ -36,7 +36,6 @@ class Middleman::CoreExtensions::DefaultHelpers < ::Middleman::Extension
# The helpers # The helpers
helpers do helpers do
# Make all block content html_safe # Make all block content html_safe
# rubocop:disable Semicolon # rubocop:disable Semicolon
def content_tag(name, content=nil, options=nil, &block) def content_tag(name, content=nil, options=nil, &block)

View file

@ -226,12 +226,12 @@ class Middleman::CoreExtensions::Internationalization < ::Middleman::Extension
if lang_suffix if lang_suffix
super(suffixed_partial_name, maybe_static) || super(suffixed_partial_name, maybe_static) ||
super(File.join(locals_dir, suffixed_partial_name), maybe_static) || super(File.join(locals_dir, suffixed_partial_name), maybe_static) ||
super(partials_path, try_static) || super(partials_path, try_static) ||
super super
else else
super(partials_path, try_static) || super(partials_path, try_static) ||
super super
end end
end end
end end