Bump Rubocop to 0.49.1 (#6093)

Merge pull request 6093
This commit is contained in:
Anatoliy Yastreb 2017-06-15 21:29:35 +09:00 committed by jekyllbot
parent 2c0f5b3059
commit d3b00cb84c
14 changed files with 57 additions and 58 deletions

View File

@ -9,6 +9,38 @@ AllCops:
- benchmark/**/*
- script/**/*
- vendor/**/*
Layout/AlignArray:
Enabled: false
Layout/AlignHash:
EnforcedHashRocketStyle: table
Layout/AlignParameters:
Enabled: false
Layout/EmptyLinesAroundAccessModifier:
Enabled: false
Layout/EmptyLinesAroundModuleBody:
Enabled: false
Layout/EndOfLine:
EnforcedStyle: lf
Layout/ExtraSpacing:
AllowForAlignment: true
Layout/FirstParameterIndentation:
EnforcedStyle: consistent
Layout/IndentationWidth:
Severity: error
Layout/IndentArray:
EnforcedStyle: consistent
Layout/IndentHash:
EnforcedStyle: consistent
Layout/IndentHeredoc:
Enabled: false
Layout/MultilineMethodCallIndentation:
EnforcedStyle: indented
Layout/MultilineOperationIndentation:
EnforcedStyle: indented
Layout/SpaceAroundOperators:
Enabled: true
Layout/SpaceInsideBrackets:
Enabled: false
Lint/EndAlignment:
Severity: error
Lint/UnreachableCode:
@ -59,13 +91,6 @@ Security/YAMLLoad:
- !ruby/regexp /test\/.*.rb$/
Style/Alias:
Enabled: false
Style/AlignArray:
Enabled: false
Style/AlignHash:
EnforcedHashRocketStyle: table
Style/AlignParameters:
Enabled: false
EnforcedStyle: with_fixed_indentation
Style/AndOr:
Severity: error
Style/Attr:
@ -80,18 +105,8 @@ Style/Documentation:
- !ruby/regexp /features\/.*.rb$/
Style/DoubleNegation:
Enabled: false
Style/EmptyLinesAroundAccessModifier:
Enabled: false
Style/EmptyLinesAroundModuleBody:
Enabled: false
Style/EndOfLine:
EnforcedStyle: lf
Style/ExtraSpacing:
AllowForAlignment: true
Style/FileName:
Enabled: false
Style/FirstParameterIndentation:
EnforcedStyle: consistent
Style/GuardClause:
Enabled: false
Style/HashSyntax:
@ -99,22 +114,10 @@ Style/HashSyntax:
Severity: error
Style/IfUnlessModifier:
Enabled: false
Style/IndentArray:
EnforcedStyle: consistent
Style/IndentHash:
EnforcedStyle: consistent
Style/IndentHeredoc:
Enabled: false
Style/IndentationWidth:
Severity: error
Style/InverseMethods:
Enabled: false
Style/ModuleFunction:
Enabled: false
Style/MultilineMethodCallIndentation:
EnforcedStyle: indented
Style/MultilineOperationIndentation:
EnforcedStyle: indented
Style/MultilineTernaryOperator:
Severity: error
Style/PercentLiteralDelimiters:
@ -138,10 +141,6 @@ Style/SignalException:
EnforcedStyle: only_raise
Style/SingleLineMethods:
Enabled: false
Style/SpaceAroundOperators:
Enabled: false
Style/SpaceInsideBrackets:
Enabled: false
Style/StringLiterals:
EnforcedStyle: double_quotes
Style/StringLiteralsInInterpolation:

View File

@ -25,7 +25,7 @@ group :test do
gem "nokogiri"
gem "rspec"
gem "rspec-mocks"
gem "rubocop", "~> 0.48.1"
gem "rubocop", "~> 0.49.1"
gem "test-dependency-theme", :path => File.expand_path("./test/fixtures/test-dependency-theme", File.dirname(__FILE__))
gem "test-theme", :path => File.expand_path("./test/fixtures/test-theme", File.dirname(__FILE__))

View File

@ -55,7 +55,7 @@ end
def all_steps_to_path(path)
source = source_dir
dest = Pathname.new(path).expand_path
paths = []
paths = []
dest.ascend do |f|
break if f == source

View File

@ -34,7 +34,7 @@ module Jekyll
if docs.respond_to?(method.to_sym)
Jekyll.logger.warn "Deprecation:",
"#{label}.#{method} should be changed to #{label}.docs.#{method}."
Jekyll.logger.warn "", "Called by #{caller.first}."
Jekyll.logger.warn "", "Called by #{caller(0..0)}."
docs.public_send(method.to_sym, *args, &blck)
else
super

View File

@ -136,7 +136,7 @@ module Jekyll
private
def format_url(ssl_enabled, address, port, baseurl = nil)
format("%{prefix}://%{address}:%{port}%{baseurl}", {
format("%<prefix>s://%<address>s:%<port>i%<baseurl>s", {
:prefix => ssl_enabled ? "https" : "http",
:address => address,
:port => port,

View File

@ -8,7 +8,7 @@ module Jekyll
#
# Returns the String prefix.
def self.highlighter_prefix(highlighter_prefix = nil)
if !defined?(@highlighter_prefix) || !highlighter_prefix.nil?
unless defined?(@highlighter_prefix) && highlighter_prefix.nil?
@highlighter_prefix = highlighter_prefix
end
@highlighter_prefix
@ -22,7 +22,7 @@ module Jekyll
#
# Returns the String suffix.
def self.highlighter_suffix(highlighter_suffix = nil)
if !defined?(@highlighter_suffix) || !highlighter_suffix.nil?
unless defined?(@highlighter_suffix) && highlighter_suffix.nil?
@highlighter_suffix = highlighter_suffix
end
@highlighter_suffix

View File

@ -160,7 +160,7 @@ module Jekyll
#
# Returns true if extname == .coffee, false otherwise.
def coffeescript_file?
".coffee" == ext
ext == ".coffee"
end
# Determine whether the file should be rendered with Liquid.

View File

@ -150,7 +150,7 @@ module Jekyll
#
# Returns true if extname == .coffee, false otherwise.
def coffeescript_file?
".coffee" == extname
extname == ".coffee"
end
# Determine whether the file should be rendered with Liquid.
@ -371,7 +371,7 @@ module Jekyll
if data.key?(method.to_s)
Jekyll::Deprecator.deprecation_message "Document##{method} is now a key "\
"in the #data hash."
Jekyll::Deprecator.deprecation_message "Called by #{caller.first}."
Jekyll::Deprecator.deprecation_message "Called by #{caller(0..0)}."
data[method.to_s]
else
super

View File

@ -60,7 +60,7 @@ module Jekyll
# register a single hook to be called later, internal API
def self.register_one(owner, event, priority, &block)
@registry[owner] ||={
@registry[owner] ||= {
:post_init => [],
:pre_render => [],
:post_render => [],

View File

@ -32,7 +32,7 @@ module Jekyll
row_data.each_index do |cell_index|
str << "-" * widths[cell_index]
str << "-+-" unless cell_index == row_data.length-1
str << "-+-" unless cell_index == row_data.length - 1
end
str << "\n"
@ -49,7 +49,7 @@ module Jekyll
cell_data.rjust(widths[cell_index], " ")
end
str << " | " unless cell_index == row_data.length-1
str << " | " unless cell_index == row_data.length - 1
end
str << "\n"

View File

@ -60,7 +60,7 @@ module Jekyll
#
# Returns the safety Boolean.
def self.safe(safe = nil)
if !defined?(@safe) || !safe.nil?
unless defined?(@safe) && safe.nil?
@safe = safe
end
@safe || false

View File

@ -46,7 +46,7 @@ module Jekyll
#
# Returns a rational number.
def rational_hour(seconds)
seconds.to_r/3600
seconds.to_r / 3600
end
# Private: Convert given seconds to an hour as an absolute number.
@ -56,7 +56,7 @@ module Jekyll
#
# Returns an integer.
def absolute_hour(seconds)
seconds.abs/3600
seconds.abs / 3600
end
# Private: Perform a modulo operation on a given fraction.

View File

@ -115,7 +115,7 @@ class TestDocument < JekyllUnitTest
@site = fixture_site({
"collections" => ["slides"],
"defaults" => [{
"scope" => { "path"=>"", "type"=>"slides" },
"scope" => { "path" => "", "type" => "slides" },
"values" => {
"nested" => {
"key" => "myval",
@ -139,7 +139,7 @@ class TestDocument < JekyllUnitTest
@site = fixture_site({
"collections" => ["slides"],
"defaults" => [{
"scope" => { "path"=>"", "type"=>"slides" },
"scope" => { "path" => "", "type" => "slides" },
"values" => {
"nested" => {
"test1" => "default1",
@ -156,7 +156,7 @@ class TestDocument < JekyllUnitTest
assert_equal "Override title", @document.data["title"]
assert_equal "slide", @document.data["layout"]
assert_equal(
{ "test1"=>"override1", "test2"=>"override2" },
{ "test1" => "override1", "test2" => "override2" },
@document.data["nested"]
)
end
@ -167,7 +167,7 @@ class TestDocument < JekyllUnitTest
@site = fixture_site({
"collections" => ["slides"],
"defaults" => [{
"scope" => { "path"=>"_slides", "type"=>"slides" },
"scope" => { "path" => "_slides", "type" => "slides" },
"values" => {
"nested" => {
"key" => "value123",
@ -191,7 +191,7 @@ class TestDocument < JekyllUnitTest
@site = fixture_site({
"collections" => ["slides"],
"defaults" => [{
"scope" => { "path"=>"somepath", "type"=>"slides" },
"scope" => { "path" => "somepath", "type" => "slides" },
"values" => {
"nested" => {
"key" => "myval",

View File

@ -689,7 +689,7 @@ class TestFilters < JekyllUnitTest
end
should "filter objects in a hash appropriately" do
hash = { "a"=>{ "color"=>"red" }, "b"=>{ "color"=>"blue" } }
hash = { "a" => { "color"=>"red" }, "b" => { "color"=>"blue" } }
assert_equal 1, @filter.where(hash, "color", "red").length
assert_equal [{ "color"=>"red" }], @filter.where(hash, "color", "red")
end
@ -754,7 +754,7 @@ class TestFilters < JekyllUnitTest
end
should "filter objects in a hash appropriately" do
hash = { "a"=>{ "color"=>"red" }, "b"=>{ "color"=>"blue" } }
hash = { "a" => { "color"=>"red" }, "b" => { "color"=>"blue" } }
assert_equal 1, @filter.where_exp(hash, "item", "item.color == 'red'").length
assert_equal(
[{ "color"=>"red" }],
@ -882,9 +882,9 @@ class TestFilters < JekyllUnitTest
should "allow more complex filters" do
items = [
{ "version"=>"1.0", "result"=>"slow" },
{ "version"=>"1.1.5", "result"=>"medium" },
{ "version"=>"2.7.3", "result"=>"fast" },
{ "version" => "1.0", "result" => "slow" },
{ "version" => "1.1.5", "result" => "medium" },
{ "version" => "2.7.3", "result" => "fast" },
]
result = @filter.group_by_exp(items, "item", "item.version | split: '.' | first")