From bcff13a16ae27fca30a34179fac451dcc7e66216 Mon Sep 17 00:00:00 2001 From: Frank Taillandier Date: Thu, 8 Oct 2020 21:32:49 +0200 Subject: [PATCH] chore(deps): bump Rubocop to 0.93.0 (#8430) Merge pull request 8430 --- .rubocop.yml | 6 ++++++ .rubocop_todo.yml | 9 +++++---- Gemfile | 2 +- lib/jekyll/convertible.rb | 2 +- lib/jekyll/page.rb | 4 ++-- test/test_tags.rb | 2 +- 6 files changed, 16 insertions(+), 9 deletions(-) diff --git a/.rubocop.yml b/.rubocop.yml index 7c0f7c5e3..024496b21 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -77,6 +77,8 @@ Lint/EmptyFile: Enabled: true Lint/FloatComparison: Enabled: true +Lint/HashCompareByIdentity: + Enabled: true Lint/IdentityComparison: Enabled: true Lint/MissingSuper: @@ -90,6 +92,8 @@ Lint/OutOfRangeRegexpRef: Enabled: true Lint/RaiseException: Enabled: true +Lint/RedundantSafeNavigation: + Enabled: true Lint/SelfAssignment: Enabled: true Lint/StructNewOverride: @@ -205,6 +209,8 @@ Style/CaseLikeIf: Style/ClassAndModuleChildren: Exclude: - test/**/*.rb +Style/ClassEqualityComparison: + Enabled: true Style/CombinableLoops: Enabled: true Style/Documentation: diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index 74f29976a..8d0a62cac 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -1,6 +1,6 @@ # This configuration was generated by -# `rubocop --auto-gen-config` -# on 2020-09-04 16:17:09 UTC using RuboCop version 0.90.0. +# `rubocop --auto-gen-config --auto-gen-only-exclude` +# on 2020-10-08 15:38:52 UTC using RuboCop version 0.93.0. # 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 @@ -20,8 +20,9 @@ Style/CombinableLoops: Exclude: - 'lib/jekyll/tags/post_url.rb' -# Offense count: 2 +# Offense count: 1 +# Configuration parameters: AllowedMethods. +# AllowedMethods: respond_to_missing? Style/OptionalBooleanParameter: Exclude: - - 'lib/jekyll/collection.rb' - 'lib/jekyll/log_adapter.rb' diff --git a/Gemfile b/Gemfile index 06011fca6..4f44e6fe7 100644 --- a/Gemfile +++ b/Gemfile @@ -23,7 +23,7 @@ group :test do gem "nokogiri", "~> 1.7" gem "rspec" gem "rspec-mocks" - gem "rubocop", "~> 0.92.0" + gem "rubocop", "~> 0.93.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/convertible.rb b/lib/jekyll/convertible.rb index 723588225..4fbc6e4a4 100644 --- a/lib/jekyll/convertible.rb +++ b/lib/jekyll/convertible.rb @@ -69,7 +69,7 @@ module Jekyll end def validate_permalink!(filename) - if self.data["permalink"]&.to_s&.empty? + if self.data["permalink"] == "" raise Errors::InvalidPermalinkError, "Invalid permalink in #{filename}" end end diff --git a/lib/jekyll/page.rb b/lib/jekyll/page.rb index a9ba4e377..30c13d07e 100644 --- a/lib/jekyll/page.rb +++ b/lib/jekyll/page.rb @@ -194,11 +194,11 @@ module Jekyll def excerpt return @excerpt if defined?(@excerpt) - @excerpt = data["excerpt"]&.to_s + @excerpt = data["excerpt"] ? data["excerpt"].to_s : nil end def generate_excerpt? - !excerpt_separator.empty? && self.class == Jekyll::Page && html? + !excerpt_separator.empty? && instance_of?(Jekyll::Page) && html? end private diff --git a/test/test_tags.rb b/test/test_tags.rb index 4dc8bcc8a..ac2d77796 100644 --- a/test/test_tags.rb +++ b/test/test_tags.rb @@ -15,7 +15,7 @@ class TestTags < JekyllUnitTest site.read if override["read_all"] info = { :filters => [Jekyll::Filters], :registers => { :site => site } } - @converter = site.converters.find { |c| c.class == converter_class } + @converter = site.converters.find { |c| c.instance_of?(converter_class) } payload = { "highlighter_prefix" => @converter.highlighter_prefix, "highlighter_suffix" => @converter.highlighter_suffix, }