diff --git a/.rubocop.yml b/.rubocop.yml index 38652ca8..3c6813a1 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -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: diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml new file mode 100644 index 00000000..0ca6b710 --- /dev/null +++ b/.rubocop_todo.yml @@ -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' diff --git a/Gemfile b/Gemfile index df6d2f27..13c477ae 100644 --- a/Gemfile +++ b/Gemfile @@ -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__) diff --git a/lib/jekyll/command.rb b/lib/jekyll/command.rb index 9918c890..68bc8cbe 100644 --- a/lib/jekyll/command.rb +++ b/lib/jekyll/command.rb @@ -84,7 +84,7 @@ module Jekyll # 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 @@ module Jekyll 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 diff --git a/lib/jekyll/frontmatter_defaults.rb b/lib/jekyll/frontmatter_defaults.rb index c099731f..21e3cc6f 100644 --- a/lib/jekyll/frontmatter_defaults.rb +++ b/lib/jekyll/frontmatter_defaults.rb @@ -179,7 +179,7 @@ module Jekyll # 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 @@ module Jekyll !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 # diff --git a/lib/jekyll/renderer.rb b/lib/jekyll/renderer.rb index ccb6b182..dff212ef 100644 --- a/lib/jekyll/renderer.rb +++ b/lib/jekyll/renderer.rb @@ -66,7 +66,7 @@ module Jekyll # 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 @@ module Jekyll 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 @@ module Jekyll 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 # diff --git a/lib/jekyll/static_file.rb b/lib/jekyll/static_file.rb index 0dce9640..9f988a7b 100644 --- a/lib/jekyll/static_file.rb +++ b/lib/jekyll/static_file.rb @@ -25,7 +25,7 @@ module Jekyll # base - The String path to the . # dir - The String path between 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 @@ module Jekyll @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 diff --git a/lib/jekyll/utils.rb b/lib/jekyll/utils.rb index 8aea4ac2..062300ae 100644 --- a/lib/jekyll/utils.rb +++ b/lib/jekyll/utils.rb @@ -136,7 +136,7 @@ module Jekyll # 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 @@ module Jekyll content.include?("{%") || content.include?("{{") end - # rubocop: enable PredicateName + # rubocop: enable Naming/PredicateName # Slugify a filename or title. # diff --git a/lib/jekyll/utils/win_tz.rb b/lib/jekyll/utils/win_tz.rb index 965cbc95..9c55c42e 100644 --- a/lib/jekyll/utils/win_tz.rb +++ b/lib/jekyll/utils/win_tz.rb @@ -30,7 +30,7 @@ module Jekyll # # Format the hour as a two-digit number. # Establish the minutes based on modulo expression. - hh = format("%02d", absolute_hour(difference).ceil) + hh = format("%02d", :hour => absolute_hour(difference).ceil) mm = modulo.zero? ? "00" : "30" Jekyll.logger.debug "Timezone:", "#{timezone} #{offset}#{hh}:#{mm}"