parent
e083f93ed8
commit
00bad8bfe5
14
.rubocop.yml
14
.rubocop.yml
|
@ -21,7 +21,7 @@ Layout/EmptyLinesAroundAccessModifier:
|
|||
Layout/EmptyLinesAroundModuleBody:
|
||||
Enabled: false
|
||||
Layout/EndOfLine:
|
||||
EnforcedStyle: lf
|
||||
EnforcedStyle: native
|
||||
Layout/ExtraSpacing:
|
||||
AllowForAlignment: true
|
||||
Layout/FirstParameterIndentation:
|
||||
|
@ -44,10 +44,14 @@ Layout/SpaceInsideBrackets:
|
|||
Enabled: false
|
||||
Lint/EndAlignment:
|
||||
Severity: error
|
||||
Lint/RescueWithoutErrorClass:
|
||||
Enabled: false
|
||||
Lint/UnreachableCode:
|
||||
Severity: error
|
||||
Lint/UselessAccessModifier:
|
||||
Enabled: false
|
||||
Lint/Void:
|
||||
Enabled: false
|
||||
Metrics/AbcSize:
|
||||
Max: 21
|
||||
Metrics/BlockLength:
|
||||
|
@ -82,6 +86,10 @@ Metrics/ParameterLists:
|
|||
Max: 4
|
||||
Metrics/PerceivedComplexity:
|
||||
Max: 8
|
||||
Naming/FileName:
|
||||
Enabled: false
|
||||
Naming/HeredocDelimiterNaming:
|
||||
Enabled: false
|
||||
Security/MarshalLoad:
|
||||
Exclude:
|
||||
- !ruby/regexp /test\/.*.rb$/
|
||||
|
@ -109,8 +117,8 @@ Style/Documentation:
|
|||
- !ruby/regexp /features\/.*.rb$/
|
||||
Style/DoubleNegation:
|
||||
Enabled: false
|
||||
Style/FileName:
|
||||
Enabled: false
|
||||
Style/Encoding:
|
||||
EnforcedStyle: when_needed
|
||||
Style/GuardClause:
|
||||
Enabled: false
|
||||
Style/HashSyntax:
|
||||
|
|
2
Gemfile
2
Gemfile
|
@ -30,7 +30,7 @@ group :test do
|
|||
gem "nokogiri", RUBY_VERSION >= "2.2" ? "~> 1.7" : "~> 1.7.0"
|
||||
gem "rspec"
|
||||
gem "rspec-mocks"
|
||||
gem "rubocop", "~> 0.49.1"
|
||||
gem "rubocop", "~> 0.50.0"
|
||||
gem "test-dependency-theme", :path => File.expand_path("test/fixtures/test-dependency-theme", __dir__)
|
||||
gem "test-theme", :path => File.expand_path("test/fixtures/test-theme", __dir__)
|
||||
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
# coding: utf-8
|
||||
# frozen_string_literal: true
|
||||
|
||||
lib = File.expand_path("lib", __dir__)
|
||||
|
|
|
@ -119,7 +119,7 @@ module Jekyll
|
|||
# timezone - the IANA Time Zone
|
||||
#
|
||||
# Returns nothing
|
||||
# rubocop:disable Style/AccessorMethodName
|
||||
# rubocop:disable Naming/AccessorMethodName
|
||||
def set_timezone(timezone)
|
||||
ENV["TZ"] = if Utils::Platforms.really_windows?
|
||||
Utils::WinTZ.calculate(timezone)
|
||||
|
@ -127,7 +127,7 @@ module Jekyll
|
|||
timezone
|
||||
end
|
||||
end
|
||||
# rubocop:enable Style/AccessorMethodName
|
||||
# rubocop:enable Naming/AccessorMethodName
|
||||
|
||||
# Public: Fetch the logger instance for this Jekyll process.
|
||||
#
|
||||
|
|
|
@ -86,7 +86,7 @@ module Jekyll
|
|||
def urls_only_differ_by_case(site)
|
||||
urls_only_differ_by_case = false
|
||||
urls = case_insensitive_urls(site.pages + site.docs_to_write, site.dest)
|
||||
urls.each do |_case_insensitive_url, real_urls|
|
||||
urls.each_value do |real_urls|
|
||||
next unless real_urls.uniq.size > 1
|
||||
urls_only_differ_by_case = true
|
||||
Jekyll.logger.warn "Warning:", "The following URLs only differ" \
|
||||
|
|
|
@ -27,7 +27,7 @@ module Jekyll
|
|||
super || super(req, res, ".html") || super(req, res, "#{basename}.html")
|
||||
end
|
||||
|
||||
# rubocop:disable Style/MethodName
|
||||
# rubocop:disable Naming/MethodName
|
||||
def do_GET(req, res)
|
||||
rtn = super
|
||||
validate_and_ensure_charset(req, res)
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
# encoding: UTF-8
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Jekyll
|
||||
|
|
|
@ -27,7 +27,7 @@ module Jekyll
|
|||
# Rubocop does not allow reader methods to have names starting with `get_`
|
||||
# To ensure compatibility, this check has been disabled on this method
|
||||
#
|
||||
# rubocop:disable Style/AccessorMethodName
|
||||
# rubocop:disable Naming/AccessorMethodName
|
||||
def get_processor
|
||||
case @config["markdown"].downcase
|
||||
when "redcarpet" then return RedcarpetParser.new(@config)
|
||||
|
@ -37,7 +37,7 @@ module Jekyll
|
|||
custom_processor
|
||||
end
|
||||
end
|
||||
# rubocop:enable Style/AccessorMethodName
|
||||
# rubocop:enable Naming/AccessorMethodName
|
||||
|
||||
# Public: Provides you with a list of processors, the ones we
|
||||
# support internally and the ones that you have provided to us (if you
|
||||
|
|
|
@ -42,12 +42,14 @@ module Jekyll
|
|||
end
|
||||
|
||||
private
|
||||
# rubocop:disable Performance/HashEachMethods
|
||||
def make_accessible(hash = @config)
|
||||
hash.keys.each do |key|
|
||||
hash[key.to_sym] = hash[key]
|
||||
make_accessible(hash[key]) if hash[key].is_a?(Hash)
|
||||
end
|
||||
end
|
||||
# rubocop:enable Performance/HashEachMethods
|
||||
|
||||
# config[kramdown][syntax_higlighter] >
|
||||
# config[kramdown][enable_coderay] >
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
# encoding: UTF-8
|
||||
# frozen_string_literal: true
|
||||
|
||||
require "set"
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
# encoding: UTF-8
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Jekyll
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
# encoding: UTF-8
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Jekyll
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
# encoding: UTF-8
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Jekyll
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
# encoding: UTF-8
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Jekyll
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
# encoding: UTF-8
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Jekyll
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
# encoding: UTF-8
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Jekyll
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
# encoding: UTF-8
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Jekyll
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
# encoding: UTF-8
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Jekyll
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
# encoding: UTF-8
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Jekyll
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
# encoding: UTF-8
|
||||
# frozen_string_literal: true
|
||||
|
||||
require "csv"
|
||||
|
@ -25,7 +24,7 @@ module Jekyll
|
|||
|
||||
# Sorts posts, pages, and static files.
|
||||
def sort_files!
|
||||
site.collections.values.each { |c| c.docs.sort! }
|
||||
site.collections.each_value { |c| c.docs.sort! }
|
||||
site.pages.sort_by!(&:name)
|
||||
site.static_files.sort_by!(&:relative_path)
|
||||
end
|
||||
|
|
|
@ -14,7 +14,7 @@ module Jekyll
|
|||
#
|
||||
# Returns nothing.
|
||||
def read
|
||||
site.collections.each do |_, collection|
|
||||
site.collections.each_value do |collection|
|
||||
collection.read unless SPECIAL_COLLECTIONS.include?(collection.label)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
# encoding: UTF-8
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Jekyll
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
# encoding: UTF-8
|
||||
# frozen_string_literal: true
|
||||
|
||||
require "csv"
|
||||
|
@ -85,11 +84,11 @@ module Jekyll
|
|||
#
|
||||
# Returns nothing
|
||||
def reset
|
||||
if config["time"]
|
||||
self.time = Utils.parse_date(config["time"].to_s, "Invalid time in _config.yml.")
|
||||
else
|
||||
self.time = Time.now
|
||||
end
|
||||
self.time = if config["time"]
|
||||
Utils.parse_date(config["time"].to_s, "Invalid time in _config.yml.")
|
||||
else
|
||||
Time.now
|
||||
end
|
||||
self.layouts = {}
|
||||
self.pages = []
|
||||
self.static_files = []
|
||||
|
@ -238,7 +237,7 @@ module Jekyll
|
|||
posts.docs.each do |p|
|
||||
p.data[post_attr].each { |t| hash[t] << p } if p.data[post_attr]
|
||||
end
|
||||
hash.values.each { |posts| posts.sort!.reverse! }
|
||||
hash.each_value { |posts| posts.sort!.reverse! }
|
||||
hash
|
||||
end
|
||||
|
||||
|
@ -449,7 +448,7 @@ module Jekyll
|
|||
|
||||
private
|
||||
def render_docs(payload)
|
||||
collections.each do |_, collection|
|
||||
collections.each_value do |collection|
|
||||
collection.docs.each do |document|
|
||||
if regenerator.regenerate?(document)
|
||||
document.output = Jekyll::Renderer.new(self, document, payload).run
|
||||
|
|
|
@ -18,13 +18,13 @@ module Jekyll
|
|||
@lang = Regexp.last_match(1).downcase
|
||||
@highlight_options = parse_options(Regexp.last_match(2))
|
||||
else
|
||||
raise SyntaxError, <<-eos
|
||||
raise SyntaxError, <<-MSG
|
||||
Syntax Error in tag 'highlight' while parsing the following markup:
|
||||
|
||||
#{markup}
|
||||
|
||||
Valid syntax: highlight <lang> [linenos]
|
||||
eos
|
||||
MSG
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -95,14 +95,14 @@ eos
|
|||
)
|
||||
|
||||
if highlighted_code.nil?
|
||||
Jekyll.logger.error <<eos
|
||||
Jekyll.logger.error <<-MSG
|
||||
There was an error highlighting your code:
|
||||
|
||||
#{code}
|
||||
|
||||
While attempting to convert the above code, Pygments.rb returned an unacceptable value.
|
||||
This is usually a timeout problem solved by running `jekyll build` again.
|
||||
eos
|
||||
MSG
|
||||
raise ArgumentError, "Pygments.rb returned an unacceptable value "\
|
||||
"when attempting to highlight some code."
|
||||
end
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
# encoding: UTF-8
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Jekyll
|
||||
|
@ -61,7 +60,7 @@ module Jekyll
|
|||
|
||||
def validate_file_name(file)
|
||||
if file !~ %r!^[a-zA-Z0-9_/\.-]+$! || file =~ %r!\./! || file =~ %r!/\.!
|
||||
raise ArgumentError, <<-eos
|
||||
raise ArgumentError, <<-MSG
|
||||
Invalid syntax for include tag. File contains invalid characters or sequences:
|
||||
|
||||
#{file}
|
||||
|
@ -70,14 +69,14 @@ Valid syntax:
|
|||
|
||||
#{syntax_example}
|
||||
|
||||
eos
|
||||
MSG
|
||||
end
|
||||
end
|
||||
|
||||
def validate_params
|
||||
full_valid_syntax = %r!\A\s*(?:#{VALID_SYNTAX}(?=\s|\z)\s*)*\z!
|
||||
unless @params =~ full_valid_syntax
|
||||
raise ArgumentError, <<-eos
|
||||
raise ArgumentError, <<-MSG
|
||||
Invalid syntax for include tag:
|
||||
|
||||
#{@params}
|
||||
|
@ -86,7 +85,7 @@ Valid syntax:
|
|||
|
||||
#{syntax_example}
|
||||
|
||||
eos
|
||||
MSG
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -24,11 +24,11 @@ module Jekyll
|
|||
return item.url if item.relative_path == "/#{@relative_path}"
|
||||
end
|
||||
|
||||
raise ArgumentError, <<eos
|
||||
raise ArgumentError, <<-MSG
|
||||
Could not find document '#{@relative_path}' in tag '#{self.class.tag_name}'.
|
||||
|
||||
Make sure the document exists and the path is correct.
|
||||
eos
|
||||
MSG
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -60,13 +60,13 @@ module Jekyll
|
|||
begin
|
||||
@post = PostComparer.new(@orig_post)
|
||||
rescue => e
|
||||
raise Jekyll::Errors::PostURLError, <<-eos
|
||||
raise Jekyll::Errors::PostURLError, <<-MSG
|
||||
Could not parse name of post "#{@orig_post}" in tag 'post_url'.
|
||||
|
||||
Make sure the post exists and the name is correct.
|
||||
|
||||
#{e.class}: #{e.message}
|
||||
eos
|
||||
MSG
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -90,11 +90,11 @@ eos
|
|||
return p.url
|
||||
end
|
||||
|
||||
raise Jekyll::Errors::PostURLError, <<-eos
|
||||
raise Jekyll::Errors::PostURLError, <<-MSG
|
||||
Could not find post "#{@orig_post}" in tag 'post_url'.
|
||||
|
||||
Make sure the post exists and the name is correct.
|
||||
eos
|
||||
MSG
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -8,7 +8,7 @@ class TestAnsi < JekyllUnitTest
|
|||
@subject = Jekyll::Utils::Ansi
|
||||
end
|
||||
|
||||
Jekyll::Utils::Ansi::COLORS.each do |color, _val|
|
||||
Jekyll::Utils::Ansi::COLORS.each_key do |color|
|
||||
should "respond_to? #{color}" do
|
||||
assert @subject.respond_to?(color)
|
||||
end
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
# encoding: utf-8
|
||||
# frozen_string_literal: true
|
||||
|
||||
require "helper"
|
||||
|
|
Loading…
Reference in New Issue