From 7d7a312b33cf1cbf92d73435146d37a568885994 Mon Sep 17 00:00:00 2001 From: ashmaroli Date: Sun, 9 Apr 2017 16:54:45 +0530 Subject: [PATCH] Bump Rubocop to v0.48 (#5997) Merge pull request 5997 --- .rubocop.yml | 10 ++++++++++ Gemfile | 6 +++--- Rakefile | 2 +- jekyll.gemspec | 1 + lib/jekyll/reader.rb | 1 + lib/jekyll/site.rb | 1 + .../test-dependency-theme.gemspec | 8 ++++---- test/fixtures/test-theme/test-theme.gemspec | 8 ++++---- test/test_collections.rb | 4 +++- test/test_document.rb | 6 +++--- test/test_front_matter_defaults.rb | 4 ++-- test/test_generated_site.rb | 8 +++++--- test/test_tags.rb | 1 + 13 files changed, 39 insertions(+), 21 deletions(-) diff --git a/.rubocop.yml b/.rubocop.yml index 168e779a..5ab7a7e8 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -35,6 +35,8 @@ Metrics/LineLength: - !ruby/regexp /features\/.*.rb/ - Rakefile - rake/*.rake + - Gemfile + - jekyll.gemspec Max: 90 Severity: warning Metrics/MethodLength: @@ -82,6 +84,8 @@ Style/EmptyLinesAroundAccessModifier: Enabled: false Style/EmptyLinesAroundModuleBody: Enabled: false +Style/EndOfLine: + EnforcedStyle: lf Style/ExtraSpacing: AllowForAlignment: true Style/FileName: @@ -99,8 +103,12 @@ 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: @@ -138,6 +146,8 @@ Style/StringLiterals: EnforcedStyle: double_quotes Style/StringLiteralsInInterpolation: EnforcedStyle: double_quotes +Style/SymbolArray: + Enabled: false Style/TrailingCommaInLiteral: EnforcedStyleForMultiline: consistent_comma Style/UnneededCapitalW: diff --git a/Gemfile b/Gemfile index f4e60e12..5da04ca6 100644 --- a/Gemfile +++ b/Gemfile @@ -25,9 +25,9 @@ group :test do gem "nokogiri" gem "rspec" gem "rspec-mocks" - gem "rubocop", "~> 0.47.1" - gem "test-theme", :path => File.expand_path("./test/fixtures/test-theme", File.dirname(__FILE__)) + gem "rubocop", "~> 0.48.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__)) gem "jruby-openssl" if RUBY_ENGINE == "jruby" end @@ -77,9 +77,9 @@ group :jekyll_optional_dependencies do gem "classifier-reborn", "~> 2.1.0" gem "liquid-c", "~> 3.0" gem "pygments.rb", "~> 0.6.0" - gem "yajl-ruby", "~> 1.2" gem "rdiscount", "~> 2.0" gem "redcarpet", "~> 3.2", ">= 3.2.3" + gem "yajl-ruby", "~> 1.2" end # Windows does not include zoneinfo files, so bundle the tzinfo-data gem diff --git a/Rakefile b/Rakefile index ab934e27..949e0fd8 100644 --- a/Rakefile +++ b/Rakefile @@ -106,7 +106,7 @@ def siteify_file(file, overrides_front_matter = {}) front_matter = { "title" => title, "permalink" => "/docs/#{slug}/", - "note" => "This file is autogenerated. Edit /#{file} instead." + "note" => "This file is autogenerated. Edit /#{file} instead.", }.merge(overrides_front_matter) contents = "#{front_matter.to_yaml}---\n\n#{content_for(file)}" File.write("#{docs_folder}/_docs/#{slug}.md", contents) diff --git a/jekyll.gemspec b/jekyll.gemspec index a5539209..f9586259 100644 --- a/jekyll.gemspec +++ b/jekyll.gemspec @@ -1,4 +1,5 @@ # coding: utf-8 + lib = File.expand_path("../lib", __FILE__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require "jekyll/version" diff --git a/lib/jekyll/reader.rb b/lib/jekyll/reader.rb index e1d3b8f5..cdd45ab0 100644 --- a/lib/jekyll/reader.rb +++ b/lib/jekyll/reader.rb @@ -1,4 +1,5 @@ # encoding: UTF-8 + require "csv" module Jekyll diff --git a/lib/jekyll/site.rb b/lib/jekyll/site.rb index 87ea719b..347cea97 100644 --- a/lib/jekyll/site.rb +++ b/lib/jekyll/site.rb @@ -1,4 +1,5 @@ # encoding: UTF-8 + require "csv" module Jekyll diff --git a/test/fixtures/test-dependency-theme/test-dependency-theme.gemspec b/test/fixtures/test-dependency-theme/test-dependency-theme.gemspec index f372354e..5c260329 100644 --- a/test/fixtures/test-dependency-theme/test-dependency-theme.gemspec +++ b/test/fixtures/test-dependency-theme/test-dependency-theme.gemspec @@ -1,11 +1,11 @@ Gem::Specification.new do |s| - s.name = 'test-dependency-theme' - s.version = '0.1.0' - s.licenses = ['MIT'] + s.name = "test-dependency-theme" + s.version = "0.1.0" + s.licenses = ["MIT"] s.summary = "This is another theme used to test Jekyll" s.authors = ["Jekyll"] s.files = ["lib/example.rb"] - s.homepage = 'https://github.com/jekyll/jekyll' + s.homepage = "https://github.com/jekyll/jekyll" s.add_runtime_dependency "jekyll_test_plugin" end diff --git a/test/fixtures/test-theme/test-theme.gemspec b/test/fixtures/test-theme/test-theme.gemspec index 5f950ae1..73e5deb2 100644 --- a/test/fixtures/test-theme/test-theme.gemspec +++ b/test/fixtures/test-theme/test-theme.gemspec @@ -1,9 +1,9 @@ Gem::Specification.new do |s| - s.name = 'test-theme' - s.version = '0.1.0' - s.licenses = ['MIT'] + s.name = "test-theme" + s.version = "0.1.0" + s.licenses = ["MIT"] s.summary = "This is a theme used to test Jekyll" s.authors = ["Jekyll"] s.files = ["lib/example.rb"] - s.homepage = 'https://github.com/jekyll/jekyll' + s.homepage = "https://github.com/jekyll/jekyll" end diff --git a/test/test_collections.rb b/test/test_collections.rb index 0607208b..5b80a6c7 100644 --- a/test/test_collections.rb +++ b/test/test_collections.rb @@ -217,7 +217,9 @@ class TestCollections < JekyllUnitTest end should "read document in subfolders with dots" do - assert @collection.docs.any? { |d| d.path.include?("all.dots") } + assert( + @collection.docs.any? { |d| d.path.include?("all.dots") } + ) end end end diff --git a/test/test_document.rb b/test/test_document.rb index f274dd53..37e709ac 100644 --- a/test/test_document.rb +++ b/test/test_document.rb @@ -424,9 +424,9 @@ class TestDocument < JekyllUnitTest context "with output overrides" do should "be output according its front matter" do - assert_nil @files.find { |doc| - doc.relative_path == "_slides/non-outputted-slide.html" - } + assert_nil( + @files.find { |doc| doc.relative_path == "_slides/non-outputted-slide.html" } + ) end end end diff --git a/test/test_front_matter_defaults.rb b/test/test_front_matter_defaults.rb index 0d066c11..d45ab6de 100644 --- a/test/test_front_matter_defaults.rb +++ b/test/test_front_matter_defaults.rb @@ -184,8 +184,8 @@ class TestFrontMatterDefaults < JekyllUnitTest should "parse date" do @site.process date = Time.parse("2015-01-01 00:00:01") - assert @site.pages.find { |page| page.data["date"] == date } - assert @site.posts.find { |page| page.data["date"] == date } + assert(@site.pages.find { |page| page.data["date"] == date }) + assert(@site.posts.find { |page| page.data["date"] == date }) end end end diff --git a/test/test_generated_site.rb b/test/test_generated_site.rb index 41e7c3a1..46f55484 100644 --- a/test/test_generated_site.rb +++ b/test/test_generated_site.rb @@ -52,9 +52,11 @@ class TestGeneratedSite < JekyllUnitTest end should "include a post with a abbreviated dates" do - refute_nil @site.posts.index { |post| - post.relative_path == "_posts/2017-2-5-i-dont-like-zeroes.md" - } + refute_nil( + @site.posts.index do |post| + post.relative_path == "_posts/2017-2-5-i-dont-like-zeroes.md" + end + ) assert_exist dest_dir("2017", "02", "05", "i-dont-like-zeroes.html") end diff --git a/test/test_tags.rb b/test/test_tags.rb index 0fe07aa6..f077615d 100644 --- a/test/test_tags.rb +++ b/test/test_tags.rb @@ -1,4 +1,5 @@ # coding: utf-8 + require "helper" class TestTags < JekyllUnitTest