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

View File

@ -1,6 +1,6 @@
# This configuration was generated by
# `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
# one by one as the offenses are removed from the code base.
# Note that changes in the inspected code, or installation of new
@ -14,3 +14,14 @@ Layout/SpaceAroundOperators:
Exclude:
- 'lib/jekyll/commands/build.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 "rspec"
gem "rspec-mocks"
gem "rubocop", "~> 0.87.1"
gem "rubocop", "~> 0.90.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__)

View File

@ -84,7 +84,7 @@ module Jekyll
return true unless Utils::Platforms.osx?
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
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

View File

@ -20,7 +20,6 @@ module Jekyll
end
end
# rubocop:disable Metrics/AbcSize
def process(args, opts)
if !args || args.empty?
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}!"
Jekyll.logger.info "For help getting started, read #{theme.path}/README.md."
end
# rubocop:enable Metrics/AbcSize
end
end
end

View File

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

View File

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

View File

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

View File

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

View File

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