Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump RuboCop to v1.18.x #452

Merged
merged 2 commits into from
Sep 17, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 24 additions & 1 deletion .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
35 changes: 34 additions & 1 deletion .rubocop_todo.yml
Original file line number Diff line number Diff line change
@@ -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'
4 changes: 2 additions & 2 deletions jekyll-seo-tag.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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
8 changes: 4 additions & 4 deletions lib/jekyll-seo-tag/author_drop.rb
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,7 @@ def twitter

private

attr_reader :page
attr_reader :site
attr_reader :site, :page

# Finds the page author in the page.author, page.authors, or site.author
#
Expand Down Expand Up @@ -75,9 +74,10 @@ def site_data_hash
# 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
{}
Expand Down
8 changes: 4 additions & 4 deletions lib/jekyll-seo-tag/image_drop.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,17 +34,17 @@ def path

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 }
Expand Down
7 changes: 3 additions & 4 deletions lib/jekyll-seo-tag/json_ld_drop.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,8 @@ class JSONLDDrop < Jekyll::Drops::Drop
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
Expand Down Expand Up @@ -84,7 +83,7 @@ def main_entity
private :main_entity

def to_json
to_h.reject { |_k, v| v.nil? }.to_json
to_h.compact.to_json
end

private
Expand Down
3 changes: 2 additions & 1 deletion spec/jekyll_seo_tag_integration_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@
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
Expand Down