Skip to content
Permalink
Browse files

Rubocop version upgrade (#7846)

Merge pull request 7846
  • Loading branch information...
donquxiote authored and jekyllbot committed Oct 16, 2019
1 parent 4d0457b commit 22a974200d21a5476e92ee9e33312c583f001271
@@ -1,4 +1,5 @@
---
inherit_from: .rubocop_todo.yml

require:
- rubocop-performance
@@ -119,6 +120,7 @@ Style/DoubleNegation:
Style/FormatStringToken:
Exclude:
- lib/jekyll/utils/ansi.rb
- lib/jekyll/liquid_renderer/table.rb
Style/GuardClause:
Enabled: false
Style/HashSyntax:
@@ -0,0 +1,17 @@
# This configuration was generated by
# `rubocop --auto-gen-config`
# on 2019-10-16 00:55:37 -0500 using RuboCop version 0.75.1.
# The point is for the user to remove these configuration records
# one by one as the offenses are removed from the code base.
# Note that changes in the inspected code, or installation of new
# versions of RuboCop, may require this file to be generated again.

# Offense count: 4
# Cop supports --auto-correct.
# Configuration parameters: AllowForAlignment.
Layout/SpaceAroundOperators:
Exclude:
- 'lib/jekyll/commands/build.rb'
- 'lib/jekyll/site.rb'
- 'lib/jekyll/tags/include.rb'
- 'test/test_configuration.rb'
@@ -27,7 +27,7 @@ group :test do
gem "nokogiri", "~> 1.7"
gem "rspec"
gem "rspec-mocks"
gem "rubocop", "~> 0.72.0"
gem "rubocop", "~> 0.75.0"
gem "rubocop-performance"
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__)
@@ -84,7 +84,7 @@ def add_build_options(cmd)
# klass - an array of Jekyll::Command subclasses associated with the command
#
# Note that all exceptions are rescued..
# rubocop: disable RescueException
# rubocop: disable Lint/RescueException
def process_with_graceful_fail(cmd, options, *klass)
klass.each { |k| k.process(options) if k.respond_to?(:process) }
rescue Exception => e
@@ -97,7 +97,7 @@ def process_with_graceful_fail(cmd, options, *klass)
Jekyll.logger.error "", " for any additional information or backtrace. "
Jekyll.logger.abort_with "", dashes
end
# rubocop: enable RescueException
# rubocop: enable Lint/RescueException
end
end
end
@@ -179,7 +179,7 @@ def valid?(set)
# new_scope - the new scope hash
#
# Returns true if the new scope has precedence over the older
# rubocop: disable PredicateName
# rubocop: disable Naming/PredicateName
def has_precedence?(old_scope, new_scope)
return true if old_scope.nil?

@@ -194,7 +194,7 @@ def has_precedence?(old_scope, new_scope)
!old_scope.key? "type"
end
end
# rubocop: enable PredicateName
# rubocop: enable Naming/PredicateName

# Collects a list of sets that match the given path and type
#
@@ -66,7 +66,7 @@ def run
# Render the document.
#
# Returns String rendered document output
# rubocop: disable AbcSize
# rubocop: disable Metrics/AbcSize
def render_document
info = {
:registers => { :site => site, :page => payload["page"] },
@@ -91,7 +91,7 @@ def render_document

output
end
# rubocop: enable AbcSize
# rubocop: enable Metrics/AbcSize

# Convert the document using the converters which match this renderer's document.
#
@@ -125,13 +125,13 @@ def render_liquid(content, payload, info, path = nil)
LiquidRenderer.format_error(e, path || document.relative_path)
end
template.render!(payload, info)
# rubocop: disable RescueException
# rubocop: disable Lint/RescueException
rescue Exception => e
Jekyll.logger.error "Liquid Exception:",
LiquidRenderer.format_error(e, path || document.relative_path)
raise e
end
# rubocop: enable RescueException
# rubocop: enable Lint/RescueException

# Checks if the layout specified in the document actually exists
#
@@ -25,7 +25,7 @@ def reset_cache
# base - The String path to the <source>.
# dir - The String path between <source> and the file.
# name - The String filename of the file.
# rubocop: disable ParameterLists
# rubocop: disable Metrics/ParameterLists
def initialize(site, base, dir, name, collection = nil)
@site = site
@base = base
@@ -36,7 +36,7 @@ def initialize(site, base, dir, name, collection = nil)
@extname = File.extname(@name)
@data = @site.frontmatter_defaults.all(relative_path, type)
end
# rubocop: enable ParameterLists
# rubocop: enable Metrics/ParameterLists

# Returns source file path.
def path
@@ -136,7 +136,7 @@ def parse_date(input, msg = "Input could not be parsed.")
# Determines whether a given file has
#
# Returns true if the YAML front matter is present.
# rubocop: disable PredicateName
# rubocop: disable Naming/PredicateName
def has_yaml_header?(file)
File.open(file, "rb", &:readline).match? %r!\A---\s*\r?\n!
rescue EOFError
@@ -151,7 +151,7 @@ def has_liquid_construct?(content)

content.include?("{%") || content.include?("{{")
end
# rubocop: enable PredicateName
# rubocop: enable Naming/PredicateName

# Slugify a filename or title.
#
@@ -30,7 +30,7 @@ def calculate(timezone)
#
# Format the hour as a two-digit number.
# Establish the minutes based on modulo expression.
hh = format("%02d", absolute_hour(difference).ceil)
hh = format("%<hour>02d", :hour => absolute_hour(difference).ceil)
mm = modulo.zero? ? "00" : "30"

Jekyll.logger.debug "Timezone:", "#{timezone} #{offset}#{hh}:#{mm}"

0 comments on commit 22a9742

Please sign in to comment.
You can’t perform that action at this time.