diff --git a/.rubocop.yml b/.rubocop.yml index 38652ca8e4d..10a23100d76 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -107,6 +107,8 @@ Style/Alias: EnforcedStyle: prefer_alias_method Style/AndOr: Severity: error +Style/BracesAroundHashParameters: + Enabled: false Style/ClassAndModuleChildren: Exclude: - test/**/*.rb diff --git a/.travis.yml b/.travis.yml index 6e84755212b..3cb5a2bcd24 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,9 +4,11 @@ cache: bundler language: ruby rvm: - - &ruby1 2.6.3 - - &ruby2 2.4.6 - - &jruby jruby-9.2.7.0 + - &ruby1 2.7.1 + - &ruby2 2.6.6 + - &ruby3 2.5.8 + - &ruby4 2.4.10 + - &jruby jruby-9.2.11.1 matrix: include: @@ -19,7 +21,7 @@ matrix: - rvm: *ruby1 env: TEST_SUITE=profile-docs name: "Profile Docs" - - rvm: *ruby1 + - rvm: *ruby4 env: TEST_SUITE=memprof name: "Profile Memory Allocation" exclude: diff --git a/lib/jekyll/convertible.rb b/lib/jekyll/convertible.rb index 3847831f888..c4dfad8a710 100644 --- a/lib/jekyll/convertible.rb +++ b/lib/jekyll/convertible.rb @@ -39,7 +39,7 @@ def read_yaml(base, name, opts = {}) begin self.content = File.read(@path || site.in_source_dir(base, name), - Utils.merged_file_read_opts(site, opts)) + **Utils.merged_file_read_opts(site, opts)) if content =~ Document::YAML_FRONT_MATTER_REGEXP self.content = $POSTMATCH self.data = SafeYAML.load(Regexp.last_match(1)) diff --git a/lib/jekyll/document.rb b/lib/jekyll/document.rb index 847b2b9b0bc..0c7b2f67b51 100644 --- a/lib/jekyll/document.rb +++ b/lib/jekyll/document.rb @@ -298,7 +298,7 @@ def read(opts = {}) else begin merge_defaults - read_content(opts) + read_content(**opts) read_post_data rescue StandardError => e handle_read_error(e) @@ -429,14 +429,14 @@ def populate_categories categories.flatten! categories.uniq! - merge_data!("categories" => categories) + merge_data!({ "categories" => categories }) end def populate_tags tags = Utils.pluralized_array_from_hash(data, "tag", "tags") tags.flatten! - merge_data!("tags" => tags) + merge_data!({ "tags" => tags }) end private @@ -462,8 +462,8 @@ def merge_defaults merge_data!(defaults, :source => "front matter defaults") unless defaults.empty? end - def read_content(opts) - self.content = File.read(path, Utils.merged_file_read_opts(site, opts)) + def read_content(**opts) + self.content = File.read(path, **Utils.merged_file_read_opts(site, opts)) if content =~ YAML_FRONT_MATTER_REGEXP self.content = $POSTMATCH data_file = SafeYAML.load(Regexp.last_match(1)) diff --git a/lib/jekyll/tags/include.rb b/lib/jekyll/tags/include.rb index 7fabe25fea9..49ffcb9efbf 100644 --- a/lib/jekyll/tags/include.rb +++ b/lib/jekyll/tags/include.rb @@ -176,7 +176,7 @@ def realpath_prefixed_with?(path, dir) # This method allows to modify the file content by inheriting from the class. def read_file(file, context) - File.read(file, file_read_opts(context)) + File.read(file, **file_read_opts(context)) end private diff --git a/test/test_document.rb b/test/test_document.rb index 041328d51fb..ace8b79ef31 100644 --- a/test/test_document.rb +++ b/test/test_document.rb @@ -175,7 +175,7 @@ def setup_document_with_dates(filename) }] ) @site.process - @document = @site.collections["slides"].docs.select { |d| d.is_a?(Document) }.first + @document = @site.collections["slides"].docs.find { |d| d.is_a?(Document) } end should "know the front matter defaults" do diff --git a/test/test_filters.rb b/test/test_filters.rb index 19f841eed25..737b250948d 100644 --- a/test/test_filters.rb +++ b/test/test_filters.rb @@ -1036,7 +1036,7 @@ def to_liquid posts = @filter.site.site_payload["site"]["posts"] results = @filter.where_exp(posts, "post", "post.date > site.dont_show_posts_before") - assert_equal posts.select { |p| p.date > @sample_time }.count, results.length + assert_equal posts.count { |p| p.date > @sample_time }, results.length end end