Rubocop version upgrade (#7846)

Merge pull request 7846
This commit is contained in:
James Buckley 2019-10-16 02:21:04 -05:00 committed by jekyllbot
parent 4d0457bab2
commit 22a974200d
9 changed files with 33 additions and 14 deletions

View File

@ -1,4 +1,5 @@
--- ---
inherit_from: .rubocop_todo.yml
require: require:
- rubocop-performance - rubocop-performance
@ -119,6 +120,7 @@ Style/DoubleNegation:
Style/FormatStringToken: Style/FormatStringToken:
Exclude: Exclude:
- lib/jekyll/utils/ansi.rb - lib/jekyll/utils/ansi.rb
- lib/jekyll/liquid_renderer/table.rb
Style/GuardClause: Style/GuardClause:
Enabled: false Enabled: false
Style/HashSyntax: Style/HashSyntax:

17
.rubocop_todo.yml Normal file
View File

@ -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'

View File

@ -27,7 +27,7 @@ group :test do
gem "nokogiri", "~> 1.7" gem "nokogiri", "~> 1.7"
gem "rspec" gem "rspec"
gem "rspec-mocks" gem "rspec-mocks"
gem "rubocop", "~> 0.72.0" gem "rubocop", "~> 0.75.0"
gem "rubocop-performance" gem "rubocop-performance"
gem "test-dependency-theme", :path => File.expand_path("test/fixtures/test-dependency-theme", __dir__) 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__) gem "test-theme", :path => File.expand_path("test/fixtures/test-theme", __dir__)

View File

@ -84,7 +84,7 @@ module Jekyll
# klass - an array of Jekyll::Command subclasses associated with the command # klass - an array of Jekyll::Command subclasses associated with the command
# #
# Note that all exceptions are rescued.. # Note that all exceptions are rescued..
# rubocop: disable RescueException # rubocop: disable Lint/RescueException
def process_with_graceful_fail(cmd, options, *klass) def process_with_graceful_fail(cmd, options, *klass)
klass.each { |k| k.process(options) if k.respond_to?(:process) } klass.each { |k| k.process(options) if k.respond_to?(:process) }
rescue Exception => e rescue Exception => e
@ -97,7 +97,7 @@ module Jekyll
Jekyll.logger.error "", " for any additional information or backtrace. " Jekyll.logger.error "", " for any additional information or backtrace. "
Jekyll.logger.abort_with "", dashes Jekyll.logger.abort_with "", dashes
end end
# rubocop: enable RescueException # rubocop: enable Lint/RescueException
end end
end end
end end

View File

@ -179,7 +179,7 @@ module Jekyll
# new_scope - the new scope hash # new_scope - the new scope hash
# #
# Returns true if the new scope has precedence over the older # 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) def has_precedence?(old_scope, new_scope)
return true if old_scope.nil? return true if old_scope.nil?
@ -194,7 +194,7 @@ module Jekyll
!old_scope.key? "type" !old_scope.key? "type"
end end
end end
# rubocop: enable PredicateName # rubocop: enable Naming/PredicateName
# Collects a list of sets that match the given path and type # Collects a list of sets that match the given path and type
# #

View File

@ -66,7 +66,7 @@ module Jekyll
# Render the document. # Render the document.
# #
# Returns String rendered document output # Returns String rendered document output
# rubocop: disable AbcSize # rubocop: disable Metrics/AbcSize
def render_document def render_document
info = { info = {
:registers => { :site => site, :page => payload["page"] }, :registers => { :site => site, :page => payload["page"] },
@ -91,7 +91,7 @@ module Jekyll
output output
end end
# rubocop: enable AbcSize # rubocop: enable Metrics/AbcSize
# Convert the document using the converters which match this renderer's document. # Convert the document using the converters which match this renderer's document.
# #
@ -125,13 +125,13 @@ module Jekyll
LiquidRenderer.format_error(e, path || document.relative_path) LiquidRenderer.format_error(e, path || document.relative_path)
end end
template.render!(payload, info) template.render!(payload, info)
# rubocop: disable RescueException # rubocop: disable Lint/RescueException
rescue Exception => e rescue Exception => e
Jekyll.logger.error "Liquid Exception:", Jekyll.logger.error "Liquid Exception:",
LiquidRenderer.format_error(e, path || document.relative_path) LiquidRenderer.format_error(e, path || document.relative_path)
raise e raise e
end end
# rubocop: enable RescueException # rubocop: enable Lint/RescueException
# Checks if the layout specified in the document actually exists # Checks if the layout specified in the document actually exists
# #

View File

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

View File

@ -136,7 +136,7 @@ module Jekyll
# Determines whether a given file has # Determines whether a given file has
# #
# Returns true if the YAML front matter is present. # Returns true if the YAML front matter is present.
# rubocop: disable PredicateName # rubocop: disable Naming/PredicateName
def has_yaml_header?(file) def has_yaml_header?(file)
File.open(file, "rb", &:readline).match? %r!\A---\s*\r?\n! File.open(file, "rb", &:readline).match? %r!\A---\s*\r?\n!
rescue EOFError rescue EOFError
@ -151,7 +151,7 @@ module Jekyll
content.include?("{%") || content.include?("{{") content.include?("{%") || content.include?("{{")
end end
# rubocop: enable PredicateName # rubocop: enable Naming/PredicateName
# Slugify a filename or title. # Slugify a filename or title.
# #

View File

@ -30,7 +30,7 @@ module Jekyll
# #
# Format the hour as a two-digit number. # Format the hour as a two-digit number.
# Establish the minutes based on modulo expression. # 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" mm = modulo.zero? ? "00" : "30"
Jekyll.logger.debug "Timezone:", "#{timezone} #{offset}#{hh}:#{mm}" Jekyll.logger.debug "Timezone:", "#{timezone} #{offset}#{hh}:#{mm}"