Bump RuboCop to v1.18.x (#452)

Merge pull request 452
This commit is contained in:
Ashwin Maroli 2021-09-17 19:49:57 +05:30 committed by GitHub
parent e1a60e2fdf
commit 6c387eaeb4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 73 additions and 17 deletions

View File

@ -5,15 +5,38 @@ inherit_gem:
rubocop-jekyll: .rubocop.yml
AllCops:
TargetRubyVersion: 2.4
TargetRubyVersion: 2.5
SuggestExtensions: false
Exclude:
- vendor/**/*
Layout/LineEndStringConcatenationIndentation:
Enabled: true
Layout/LineLength:
Exclude:
- spec/**/*
- jekyll-seo-tag.gemspec
Lint/EmptyInPattern:
Enabled: false
Metrics/BlockLength:
Exclude:
- spec/**/*
Naming/InclusiveLanguage:
Enabled: false
Performance/MapCompact:
Enabled: true
Performance/RedundantEqualityComparisonBlock:
Enabled: true
Performance/RedundantSplitRegexpArgument:
Enabled: true
Style/InPatternThen:
Enabled: false
Style/MultilineInPatternThen:
Enabled: false
Style/QuotedSymbols:
Enabled: true

View File

@ -1,13 +1,46 @@
# This configuration was generated by
# `rubocop --auto-gen-config --auto-gen-only-exclude`
# on 2020-03-20 11:41:46 +0100 using RuboCop version 0.80.1.
# on 2021-09-17 06:40:32 UTC using RuboCop version 1.18.4.
# 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: 1
# Configuration parameters: AllowComments.
Lint/EmptyClass:
Exclude:
- 'lib/jekyll-seo-tag/version.rb'
# Offense count: 3
Lint/NoReturnInBeginEndBlocks:
Exclude:
- 'lib/jekyll-seo-tag/author_drop.rb'
- 'lib/jekyll-seo-tag/drop.rb'
# Offense count: 1
# Cop supports --auto-correct.
Lint/ToJSON:
Exclude:
- 'lib/jekyll-seo-tag/json_ld_drop.rb'
# Offense count: 1
# Configuration parameters: IgnoredMethods, Max.
Metrics/PerceivedComplexity:
Exclude:
- 'lib/jekyll-seo-tag/drop.rb'
# Offense count: 1
# Configuration parameters: MinSize.
Performance/CollectionLiteralInLoop:
Exclude:
- 'spec/jekyll_seo_tag/author_drop_spec.rb'
# Offense count: 9
# Cop supports --auto-correct.
Style/RedundantBegin:
Exclude:
- 'lib/jekyll-seo-tag.rb'
- 'lib/jekyll-seo-tag/author_drop.rb'
- 'lib/jekyll-seo-tag/drop.rb'
- 'lib/jekyll-seo-tag/image_drop.rb'

View File

@ -19,7 +19,7 @@ Gem::Specification.new do |spec|
raise "RubyGems 2.0 or newer is required to protect against public gem pushes."
end
spec.required_ruby_version = ">= 2.4.0"
spec.required_ruby_version = ">= 2.5.0"
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r!^(test|spec|features)/!) }
spec.bindir = "exe"
@ -30,5 +30,5 @@ Gem::Specification.new do |spec|
spec.add_development_dependency "bundler", ">= 1.15"
spec.add_development_dependency "html-proofer", "~> 3.7"
spec.add_development_dependency "rspec", "~> 3.5"
spec.add_development_dependency "rubocop-jekyll", "~> 0.11"
spec.add_development_dependency "rubocop-jekyll", "~> 0.12.0"
end

View File

@ -41,8 +41,7 @@ module Jekyll
private
attr_reader :page
attr_reader :site
attr_reader :site, :page
# Finds the page author in the page.author, page.authors, or site.author
#
@ -75,9 +74,10 @@ module Jekyll
# or an empty hash, if the author cannot be resolved
def author_hash
@author_hash ||= begin
if resolved_author.is_a? Hash
case resolved_author
when Hash
resolved_author
elsif resolved_author.is_a? String
when String
{ "name" => resolved_author }.merge!(site_data_hash)
else
{}

View File

@ -34,17 +34,17 @@ module Jekyll
private
attr_accessor :page
attr_accessor :context
attr_accessor :page, :context
# The normalized image hash with a `path` key (which may be nil)
def image_hash
@image_hash ||= begin
image_meta = page["image"]
if image_meta.is_a?(Hash)
case image_meta
when Hash
{ "path" => nil }.merge!(image_meta)
elsif image_meta.is_a?(String)
when String
{ "path" => image_meta }
else
{ "path" => nil }

View File

@ -16,9 +16,8 @@ module Jekyll
def_delegator :page_drop, :type, :type
# Expose #type and #logo as private methods and #@type as a public method
alias_method :"@type", :type
private :type
private :logo
alias_method :@type, :type
private :type, :logo
VALID_ENTITY_TYPES = %w(BlogPosting CreativeWork).freeze
VALID_AUTHOR_TYPES = %w(Organization Person).freeze
@ -84,7 +83,7 @@ module Jekyll
private :main_entity
def to_json
to_h.reject { |_k, v| v.nil? }.to_json
to_h.compact.to_json
end
private

View File

@ -26,7 +26,8 @@ RSpec.describe Jekyll::SeoTag do
end
it "outputs meta generator" do
expect(output).to match(%r!Jekyll v#{Jekyll::VERSION}!i)
version = Jekyll::VERSION
expect(output).to match(%r!Jekyll v#{version}!i)
end
it "outputs valid HTML" do