Rubocop: Style/CaseIndentation

- Indent when as deep as case
This commit is contained in:
Pat Hawks 2016-01-04 11:15:37 -08:00
parent 2c9a349f9a
commit f6fd9014ba
No known key found for this signature in database
GPG Key ID: F1746FF5F18B3D1B
4 changed files with 35 additions and 33 deletions

View File

@ -19,9 +19,9 @@ module Jekyll
def get_processor
case @config["markdown"].downcase
when "redcarpet" then return RedcarpetParser.new(@config)
when "kramdown" then return KramdownParser.new(@config)
when "rdiscount" then return RDiscountParser.new(@config)
when "redcarpet" then return RedcarpetParser.new(@config)
when "kramdown" then return KramdownParser.new(@config)
when "rdiscount" then return RDiscountParser.new(@config)
else
get_custom_processor
end

View File

@ -13,19 +13,20 @@ module Jekyll
def update_deprecated_types(set)
return set unless set.key?('scope') && set['scope'].key?('type')
set['scope']['type'] = case set['scope']['type']
when 'page'
Deprecator.defaults_deprecate_type('page', 'pages')
'pages'
when 'post'
Deprecator.defaults_deprecate_type('post', 'posts')
'posts'
when 'draft'
Deprecator.defaults_deprecate_type('draft', 'drafts')
'drafts'
else
set['scope']['type']
end
set['scope']['type'] =
case set['scope']['type']
when 'page'
Deprecator.defaults_deprecate_type('page', 'pages')
'pages'
when 'post'
Deprecator.defaults_deprecate_type('post', 'posts')
'posts'
when 'draft'
Deprecator.defaults_deprecate_type('draft', 'drafts')
'drafts'
else
set['scope']['type']
end
set
end

View File

@ -50,13 +50,13 @@ module Jekyll
# Returns the contents of the data file.
def read_data_file(path)
case File.extname(path).downcase
when '.csv'
CSV.read(path, {
:headers => true,
:encoding => site.config['encoding']
}).map(&:to_hash)
else
SafeYAML.load_file(path)
when '.csv'
CSV.read(path, {
:headers => true,
:encoding => site.config['encoding']
}).map(&:to_hash)
else
SafeYAML.load_file(path)
end
end

View File

@ -164,16 +164,17 @@ module Jekyll
end
# Replace each character sequence with a hyphen
re = case mode
when 'raw'
SLUGIFY_RAW_REGEXP
when 'default'
SLUGIFY_DEFAULT_REGEXP
when 'pretty'
# "._~!$&'()+,;=@" is human readable (not URI-escaped) in URL
# and is allowed in both extN and NTFS.
SLUGIFY_PRETTY_REGEXP
end
re =
case mode
when 'raw'
SLUGIFY_RAW_REGEXP
when 'default'
SLUGIFY_DEFAULT_REGEXP
when 'pretty'
# "._~!$&'()+,;=@" is human readable (not URI-escaped) in URL
# and is allowed in both extN and NTFS.
SLUGIFY_PRETTY_REGEXP
end
# Strip according to the mode
slug = string.gsub(re, '-')