Update rubocop gem to 0.90.0 (#8313)

Merge pull request 8313
This commit is contained in:
jnozsc 2020-09-04 13:10:41 -07:00 committed by GitHub
parent 5aaa69da3e
commit e824f6b9cc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 83 additions and 21 deletions

View File

@ -51,25 +51,53 @@ Layout/MultilineOperationIndentation:
Layout/SpaceAroundMethodCallOperator: Layout/SpaceAroundMethodCallOperator:
Enabled: true Enabled: true
Lint/BinaryOperatorWithIdenticalOperands:
Enabled: true
Lint/DeprecatedOpenSSLConstant:
Enabled: true
Lint/DuplicateElsifCondition:
Enabled: true
Lint/DuplicateRescueException:
Enabled: true
Lint/DuplicateRequire:
Enabled: true
Lint/EmptyConditionalBody:
Enabled: true
Lint/EmptyFile:
Enabled: true
Lint/FloatComparison:
Enabled: true
Lint/MissingSuper:
Enabled: false
Lint/MixedRegexpCaptureTypes:
Enabled: false
Lint/NestedPercentLiteral: Lint/NestedPercentLiteral:
Exclude: Exclude:
- test/test_site.rb - test/test_site.rb
Lint/DeprecatedOpenSSLConstant: Lint/OutOfRangeRegexpRef:
Enabled: true Enabled: true
Lint/MixedRegexpCaptureTypes:
Enabled: false
Lint/RaiseException: Lint/RaiseException:
Enabled: true Enabled: true
Lint/SelfAssignment:
Enabled: true
Lint/StructNewOverride: Lint/StructNewOverride:
Enabled: true Enabled: true
Lint/TopLevelReturnWithArgument:
Enabled: true
Lint/TrailingCommaInAttributeDeclaration:
Enabled: true
Lint/UnreachableCode: Lint/UnreachableCode:
Severity: error Severity: error
Lint/UnreachableLoop:
Enabled: true
Lint/UselessMethodDefinition:
Enabled: true
Lint/Void: Lint/Void:
Exclude: Exclude:
- lib/jekyll/site.rb - lib/jekyll/site.rb
Metrics/AbcSize: Metrics/AbcSize:
Max: 21 Max: 23
Metrics/BlockLength: Metrics/BlockLength:
Exclude: Exclude:
- test/**/*.rb - test/**/*.rb
@ -100,7 +128,7 @@ Metrics/ModuleLength:
Metrics/ParameterLists: Metrics/ParameterLists:
Max: 4 Max: 4
Metrics/PerceivedComplexity: Metrics/PerceivedComplexity:
Max: 8 Max: 13
Naming/FileName: Naming/FileName:
Enabled: false Enabled: false
@ -144,6 +172,8 @@ Security/YAMLLoad:
- !ruby/regexp /features\/.*.rb/ - !ruby/regexp /features\/.*.rb/
- !ruby/regexp /test\/.*.rb$/ - !ruby/regexp /test\/.*.rb$/
Style/ArrayCoercion:
Enabled: true
Style/AccessModifierDeclarations: Style/AccessModifierDeclarations:
Enabled: false Enabled: false
Style/AccessorGrouping: Style/AccessorGrouping:
@ -154,15 +184,21 @@ Style/AndOr:
Severity: error Severity: error
Style/BisectedAttrAccessor: Style/BisectedAttrAccessor:
Enabled: true Enabled: true
Style/CaseLikeIf:
Enabled: true
Style/ClassAndModuleChildren: Style/ClassAndModuleChildren:
Exclude: Exclude:
- test/**/*.rb - test/**/*.rb
Style/CombinableLoops:
Enabled: true
Style/Documentation: Style/Documentation:
Enabled: false Enabled: false
Style/DoubleNegation: Style/DoubleNegation:
Enabled: false Enabled: false
Style/ExponentialNotation: Style/ExponentialNotation:
Enabled: true Enabled: true
Style/ExplicitBlockArgument:
Enabled: false
Style/FormatStringToken: Style/FormatStringToken:
Exclude: Exclude:
- lib/jekyll/utils/ansi.rb - lib/jekyll/utils/ansi.rb
@ -170,10 +206,16 @@ Style/FormatStringToken:
- lib/jekyll/profiler.rb - lib/jekyll/profiler.rb
Style/FrozenStringLiteralComment: Style/FrozenStringLiteralComment:
EnforcedStyle: always EnforcedStyle: always
Style/GlobalStdStream:
Enabled: true
Style/GuardClause: Style/GuardClause:
Enabled: false Enabled: false
Style/HashAsLastArrayItem:
Enabled: true
Style/HashEachMethods: Style/HashEachMethods:
Enabled: true Enabled: true
Style/HashLikeCase:
Enabled: true
Style/HashSyntax: Style/HashSyntax:
EnforcedStyle: hash_rockets EnforcedStyle: hash_rockets
Severity: error Severity: error
@ -181,6 +223,8 @@ Style/HashTransformKeys:
Enabled: false Enabled: false
Style/HashTransformValues: Style/HashTransformValues:
Enabled: true Enabled: true
Style/KeywordParametersOrder:
Enabled: true
Style/MixinUsage: Style/MixinUsage:
Exclude: Exclude:
- test/helper.rb - test/helper.rb
@ -188,6 +232,8 @@ Style/ModuleFunction:
Enabled: false Enabled: false
Style/MultilineTernaryOperator: Style/MultilineTernaryOperator:
Severity: error Severity: error
Style/OptionalBooleanParameter:
Enabled: true
Style/PercentLiteralDelimiters: Style/PercentLiteralDelimiters:
PreferredDelimiters: PreferredDelimiters:
"%q": "{}" "%q": "{}"
@ -201,10 +247,14 @@ Style/RedundantAssignment:
Enabled: true Enabled: true
Style/RedundantFetchBlock: Style/RedundantFetchBlock:
Enabled: false Enabled: false
Style/RedundantFileExtensionInRequire:
Enabled: true
Style/RedundantRegexpCharacterClass: Style/RedundantRegexpCharacterClass:
Enabled: true Enabled: true
Style/RedundantRegexpEscape: Style/RedundantRegexpEscape:
Enabled: true Enabled: true
Style/RedundantSelfAssignment:
Enabled: true
Style/RegexpLiteral: Style/RegexpLiteral:
EnforcedStyle: percent_r EnforcedStyle: percent_r
Style/RescueModifier: Style/RescueModifier:
@ -214,10 +264,19 @@ Style/SafeNavigation:
- lib/jekyll/document.rb - lib/jekyll/document.rb
Style/SignalException: Style/SignalException:
EnforcedStyle: only_raise EnforcedStyle: only_raise
Style/SingleArgumentDig:
Enabled: true
Style/SlicingWithRange: Style/SlicingWithRange:
Enabled: false Enabled: false
Style/SoleNestedConditional:
Enabled: true
Style/StringLiterals: Style/StringLiterals:
EnforcedStyle: double_quotes EnforcedStyle: double_quotes
Style/StringConcatenation:
Enabled: true
Exclude:
- lib/jekyll/commands/*.rb
- test/**/*.rb
Style/StringLiteralsInInterpolation: Style/StringLiteralsInInterpolation:
EnforcedStyle: double_quotes EnforcedStyle: double_quotes
Style/SymbolArray: Style/SymbolArray:

View File

@ -1,6 +1,6 @@
# This configuration was generated by # This configuration was generated by
# `rubocop --auto-gen-config` # `rubocop --auto-gen-config`
# on 2020-07-10 07:47:27 UTC using RuboCop version 0.87.1. # on 2020-09-04 16:17:09 UTC using RuboCop version 0.90.0.
# The point is for the user to remove these configuration records # The point is for the user to remove these configuration records
# one by one as the offenses are removed from the code base. # one by one as the offenses are removed from the code base.
# Note that changes in the inspected code, or installation of new # Note that changes in the inspected code, or installation of new
@ -14,3 +14,14 @@ Layout/SpaceAroundOperators:
Exclude: Exclude:
- 'lib/jekyll/commands/build.rb' - 'lib/jekyll/commands/build.rb'
- 'test/test_configuration.rb' - 'test/test_configuration.rb'
# Offense count: 1
Style/CombinableLoops:
Exclude:
- 'lib/jekyll/tags/post_url.rb'
# Offense count: 2
Style/OptionalBooleanParameter:
Exclude:
- 'lib/jekyll/collection.rb'
- 'lib/jekyll/log_adapter.rb'

View File

@ -23,7 +23,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.87.1" gem "rubocop", "~> 0.90.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
return true unless Utils::Platforms.osx? return true unless Utils::Platforms.osx?
if Dir.pwd != `pwd`.strip if Dir.pwd != `pwd`.strip
Jekyll.logger.error " " + <<-STR.strip.gsub(%r!\n\s+!, "\n ") Jekyll.logger.error <<~STR
We have detected that there might be trouble using fsevent on your We have detected that there might be trouble using fsevent on your
operating system, you can read https://github.com/thibaudgg/rb-fsevent/wiki/no-fsevents-fired-(OSX-bug) operating system, you can read https://github.com/thibaudgg/rb-fsevent/wiki/no-fsevents-fired-(OSX-bug)
for possible work arounds or you can work around it immediately for possible work arounds or you can work around it immediately

View File

@ -20,7 +20,6 @@ module Jekyll
end end
end end
# rubocop:disable Metrics/AbcSize
def process(args, opts) def process(args, opts)
if !args || args.empty? if !args || args.empty?
raise Jekyll::Errors::InvalidThemeName, "You must specify a theme name." raise Jekyll::Errors::InvalidThemeName, "You must specify a theme name."
@ -35,7 +34,6 @@ module Jekyll
" is ready for you in #{theme.path.to_s.cyan}!" " is ready for you in #{theme.path.to_s.cyan}!"
Jekyll.logger.info "For help getting started, read #{theme.path}/README.md." Jekyll.logger.info "For help getting started, read #{theme.path}/README.md."
end end
# rubocop:enable Metrics/AbcSize
end end
end end
end end

View File

@ -498,7 +498,6 @@ module Jekyll
end end
end end
# rubocop:disable Metrics/AbcSize
def populate_title def populate_title
if relative_path =~ DATE_FILENAME_MATCHER if relative_path =~ DATE_FILENAME_MATCHER
date, slug, ext = Regexp.last_match.captures date, slug, ext = Regexp.last_match.captures
@ -521,7 +520,6 @@ module Jekyll
data["slug"] ||= slug data["slug"] ||= slug
data["ext"] ||= ext data["ext"] ||= ext
end end
# rubocop:enable Metrics/AbcSize
def modify_date(date) def modify_date(date)
if !data["date"] || data["date"].to_i == site.time.to_i if !data["date"] || data["date"].to_i == site.time.to_i

View File

@ -307,9 +307,10 @@ module Jekyll
if property.nil? if property.nil?
input.sort input.sort
else else
if nils == "first" case nils
when "first"
order = - 1 order = - 1
elsif nils == "last" when "last"
order = + 1 order = + 1
else else
raise ArgumentError, "Invalid nils order: " \ raise ArgumentError, "Invalid nils order: " \
@ -399,7 +400,6 @@ module Jekyll
# `where` filter helper # `where` filter helper
# #
# rubocop:disable Metrics/PerceivedComplexity
def compare_property_vs_target(property, target) def compare_property_vs_target(property, target)
case target case target
when NilClass when NilClass
@ -421,8 +421,6 @@ module Jekyll
false false
end end
# rubocop:enable Metrics/PerceivedComplexity
def item_property(item, property) def item_property(item, property)
@item_property_cache ||= {} @item_property_cache ||= {}
@item_property_cache[property] ||= {} @item_property_cache[property] ||= {}

View File

@ -51,7 +51,7 @@ module Jekyll
if path.nil? || path == "" if path.nil? || path == ""
other.data["slug"] other.data["slug"]
else else
path + "/" + other.data["slug"] "#{path}/#{other.data["slug"]}"
end end
end end
end end

View File

@ -30,7 +30,7 @@ require "minitest/autorun"
require "minitest/reporters" require "minitest/reporters"
require "minitest/profile" require "minitest/profile"
require "rspec/mocks" require "rspec/mocks"
require_relative "../lib/jekyll.rb" require_relative "../lib/jekyll"
Jekyll.logger = Logger.new(StringIO.new, :error) Jekyll.logger = Logger.new(StringIO.new, :error)

View File

@ -7,7 +7,6 @@ class TestTags < JekyllUnitTest
FileUtils.mkdir_p("tmp") FileUtils.mkdir_p("tmp")
end end
# rubocop:disable Metrics/AbcSize
def create_post(content, override = {}, converter_class = Jekyll::Converters::Markdown) def create_post(content, override = {}, converter_class = Jekyll::Converters::Markdown)
site = fixture_site({ "highlighter" => "rouge" }.merge(override)) site = fixture_site({ "highlighter" => "rouge" }.merge(override))
@ -23,7 +22,6 @@ class TestTags < JekyllUnitTest
@result = Liquid::Template.parse(content).render!(payload, info) @result = Liquid::Template.parse(content).render!(payload, info)
@result = @converter.convert(@result) @result = @converter.convert(@result)
end end
# rubocop:enable Metrics/AbcSize
def fill_post(code, override = {}) def fill_post(code, override = {})
content = <<~CONTENT content = <<~CONTENT