Rubocop: Style/PercentLiteralDelimiters

- %w-literals should be delimited by ( and )
Rubocop: Style/WordArray
 - Use %w or %W for array of words
This commit is contained in:
Pat Hawks 2016-01-03 15:32:11 -08:00
parent fb0457bf3d
commit 98a19cdf2b
No known key found for this signature in database
GPG Key ID: F1746FF5F18B3D1B
13 changed files with 19 additions and 19 deletions

View File

@ -1,7 +1,7 @@
#!/usr/bin/env ruby
STDOUT.sync = true
$LOAD_PATH.unshift File.join(File.dirname(__FILE__), *%w{ .. lib })
$LOAD_PATH.unshift File.join(File.dirname(__FILE__), *%w( .. lib ))
require 'jekyll'
require 'mercenary'

View File

@ -128,7 +128,7 @@ module Jekyll
# Get configuration from <source>/_config.yml or <source>/<config_file>
config_files = override.delete('config')
if config_files.to_s.empty?
default = %w[yml yaml].find(Proc.new { 'yml' }) do |ext|
default = %w(yml yaml).find(Proc.new { 'yml' }) do |ext|
File.exist?(Jekyll.sanitized_path(source(override), "_config.#{ext}"))
end
config_files = Jekyll.sanitized_path(source(override), "_config.#{default}")
@ -227,7 +227,7 @@ module Jekyll
config.delete('pygments')
end
%w[include exclude].each do |option|
%w(include exclude).each do |option|
config[option] ||= []
if config[option].is_a?(String)
Jekyll::Deprecator.deprecation_message "The '#{option}' configuration option" \

View File

@ -41,7 +41,7 @@ module Jekyll
def third_party_processors
self.class.constants - \
%w[KramdownParser RDiscountParser RedcarpetParser PRIORITIES].map(
%w(KramdownParser RDiscountParser RedcarpetParser PRIORITIES).map(
&:to_sym
)
end

View File

@ -71,10 +71,10 @@ module Jekyll
end
when "rouge"
Class.new(Redcarpet::Render::HTML) do
Jekyll::External.require_with_graceful_fail(%w[
Jekyll::External.require_with_graceful_fail(%w(
rouge
rouge/plugins/redcarpet
])
))
unless Gem::Version.new(Rouge.version) > Gem::Version.new("1.3.0")
abort "Please install Rouge 1.3.0 or greater and try running Jekyll again."

View File

@ -160,7 +160,7 @@ module Jekyll
#
# Returns true if extname == .sass or .scss, false otherwise.
def sass_file?
%w[.sass .scss].include?(ext)
%w(.sass .scss).include?(ext)
end
# Determine whether the document is a CoffeeScript file.

View File

@ -21,7 +21,7 @@ module Jekyll
end
def no_subcommand(args)
if args.size > 0 && args.first =~ /^--/ && !%w[--help --version].include?(args.first)
if args.size > 0 && args.first =~ /^--/ && !%w(--help --version).include?(args.first)
deprecation_message "Jekyll now uses subcommands instead of just switches. Run `jekyll --help` to find out more."
abort
end

View File

@ -127,7 +127,7 @@ module Jekyll
#
# Returns true if the extname is either .yml or .yaml, false otherwise.
def yaml_file?
%w[.yaml .yml].include?(extname)
%w(.yaml .yml).include?(extname)
end
# Determine whether the document is an asset file.
@ -143,7 +143,7 @@ module Jekyll
#
# Returns true if extname == .sass or .scss, false otherwise.
def sass_file?
%w[.sass .scss].include?(extname)
%w(.sass .scss).include?(extname)
end
# Determine whether the document is a CoffeeScript file.

View File

@ -7,10 +7,10 @@ module Jekyll
# Usually contain subcommands.
#
def blessed_gems
%w{
%w(
jekyll-docs
jekyll-import
}
)
end
#

View File

@ -72,7 +72,7 @@ module Jekyll
sorted = @stats.sort_by{ |filename, file_stats| -file_stats[:time] }
sorted = sorted.slice(0, n)
table = [[ 'Filename', 'Count', 'Bytes', 'Time' ]]
table = [%w(Filename Count Bytes Time)]
sorted.each do |filename, file_stats|
row = []

View File

@ -8,13 +8,13 @@ module Jekyll
attr_accessor :data, :content, :output
# Attributes for Liquid templates
ATTRIBUTES_FOR_LIQUID = %w[
ATTRIBUTES_FOR_LIQUID = %w(
content
dir
name
path
url
]
)
# A set of extensions that are considered HTML or HTML-like so we
# should not alter them, this includes .xhtml through XHTM5.

View File

@ -1,6 +1,6 @@
module Jekyll
class CollectionReader
SPECIAL_COLLECTIONS = %w{posts data}.freeze
SPECIAL_COLLECTIONS = %w(posts data).freeze
attr_reader :site, :content
def initialize(site)

View File

@ -19,8 +19,8 @@ module Jekyll
def initialize(config)
@config = config.clone
%w[safe lsi highlighter baseurl exclude include future unpublished
show_drafts limit_posts keep_files gems].each do |opt|
%w(safe lsi highlighter baseurl exclude include future unpublished
show_drafts limit_posts keep_files gems).each do |opt|
self.send("#{opt}=", config[opt])
end

View File

@ -4,7 +4,7 @@ module Jekyll
autoload :Ansi, "jekyll/utils/ansi"
# Constants for use in #slugify
SLUGIFY_MODES = %w{raw default pretty}
SLUGIFY_MODES = %w(raw default pretty)
SLUGIFY_RAW_REGEXP = Regexp.new('\\s+').freeze
SLUGIFY_DEFAULT_REGEXP = Regexp.new('[^[:alnum:]]+').freeze
SLUGIFY_PRETTY_REGEXP = Regexp.new("[^[:alnum:]._~!$&'()+,;=@]+").freeze