diff --git a/.rubocop.yml b/.rubocop.yml
index 69c279c9..8e311450 100644
--- a/.rubocop.yml
+++ b/.rubocop.yml
@@ -27,6 +27,9 @@ AllCops:
Gemspec/DeprecatedAttributeAssignment:
Enabled: true
+Gemspec/RequireMFA:
+ Enabled: false
+
Layout/BeginEndAlignment:
Enabled: true
Layout/EmptyComment:
@@ -43,6 +46,12 @@ Layout/HashAlignment:
EnforcedHashRocketStyle: table
Layout/IndentationWidth:
Severity: error
+Layout/LineContinuationLeadingSpace:
+ Enabled: true
+Layout/LineContinuationSpacing:
+ Enabled: true
+Layout/LineEndStringConcatenationIndentation:
+ Enabled: true
Layout/LineLength:
Exclude:
- !ruby/regexp /features\/.*.rb/
@@ -66,12 +75,18 @@ Layout/SpaceInsideHashLiteralBraces:
Lint/AmbiguousAssignment:
Enabled: true
+Lint/AmbiguousOperatorPrecedence:
+ Enabled: true
+Lint/AmbiguousRange:
+ Enabled: true
Lint/BinaryOperatorWithIdenticalOperands:
Enabled: true
Lint/ConstantDefinitionInBlock:
Enabled: true
Exclude:
- test/**/*.rb
+Lint/ConstantOverwrittenInRescue:
+ Enabled: true
Lint/DeprecatedConstants:
Enabled: true
Lint/DeprecatedOpenSSLConstant:
@@ -123,6 +138,10 @@ Lint/RedundantDirGlobSort:
Enabled: true
Lint/RedundantSafeNavigation:
Enabled: true
+Lint/RequireRangeParentheses:
+ Enabled: true
+Lint/RequireRelativeSelfPath:
+ Enabled: true
Lint/SelfAssignment:
Enabled: true
Lint/StructNewOverride:
@@ -187,6 +206,8 @@ Metrics/ParameterLists:
Metrics/PerceivedComplexity:
Max: 13
+Minitest/AssertEmptyLiteral:
+ Enabled: false
Minitest/AssertInDelta:
Enabled: true
Minitest/AssertionInLifecycleHook:
@@ -199,6 +220,8 @@ Minitest/AssertPathExists:
Enabled: true
Minitest/AssertSilent:
Enabled: true
+Minitest/AssertWithExpectedArgument:
+ Enabled: true
Minitest/LiteralAsActualArgument:
Enabled: true
Minitest/TestMethodName:
@@ -211,10 +234,10 @@ Minitest/RefuteKindOf:
Enabled: true
Minitest/RefutePathExists:
Enabled: true
+Minitest/UnreachableAssertion:
+ Enabled: true
Minitest/UnspecifiedException:
Enabled: true
-Minitest/AssertEmptyLiteral:
- Enabled: false
Naming/FileName:
Enabled: false
@@ -242,10 +265,16 @@ Performance/CollectionLiteralInLoop:
Enabled: true
Performance/ConstantRegexp:
Enabled: true
+Performance/MapCompact:
+ Enabled: true
Performance/MethodObjectAsBlock:
Enabled: true
+Performance/RedundantEqualityComparisonBlock:
+ Enabled: false
Performance/RedundantSortBlock:
Enabled: true
+Performance/RedundantSplitRegexpArgument:
+ Enabled: true
Performance/RedundantStringChars:
Enabled: true
Performance/ReverseFirst:
@@ -254,6 +283,8 @@ Performance/SortReverse:
Enabled: false
Performance/Squeeze:
Enabled: true
+Performance/StringIdentifierArgument:
+ Enabled: true
Performance/StringInclude:
Enabled: true
Exclude:
@@ -261,6 +292,10 @@ Performance/StringInclude:
Performance/Sum:
Enabled: true
+Security/CompoundHash:
+ Enabled: true
+Security/IoMethods:
+ Enabled: true
Security/MarshalLoad:
Exclude:
- !ruby/regexp /test\/.*.rb$/
@@ -303,12 +338,20 @@ Style/Documentation:
Enabled: false
Style/DoubleNegation:
Enabled: false
+Style/EmptyHeredoc:
+ Enabled: true
Style/EndlessMethod:
Enabled: true
Style/ExplicitBlockArgument:
Enabled: false
Style/ExponentialNotation:
Enabled: true
+Style/EnvHome:
+ Enabled: true
+Style/FetchEnvVar:
+ Enabled: false
+Style/FileRead:
+ Enabled: false
Style/FormatStringToken:
Exclude:
- lib/jekyll/utils/ansi.rb
@@ -316,6 +359,8 @@ Style/FormatStringToken:
- lib/jekyll/profiler.rb
Style/FrozenStringLiteralComment:
EnforcedStyle: always
+Style/FileWrite:
+ Enabled: true
Style/GlobalStdStream:
Enabled: true
Style/GuardClause:
@@ -341,6 +386,12 @@ Style/IfWithBooleanLiteralBranches:
Enabled: true
Style/KeywordParametersOrder:
Enabled: true
+Style/MagicCommentFormat:
+ Enabled: true
+Style/MapCompactWithConditionalBlock:
+ Enabled: true
+Style/MapToHash:
+ Enabled: true
Style/MixinUsage:
Exclude:
- test/helper.rb
@@ -350,10 +401,14 @@ Style/MultilineTernaryOperator:
Severity: error
Style/NegatedIfElseCondition:
Enabled: true
+Style/NestedFileDirname:
+ Enabled: true
Style/NilLambda:
Enabled: true
Style/OptionalBooleanParameter:
Enabled: true
+ Exclude:
+ - lib/jekyll/log_adapter.rb
Style/PercentLiteralDelimiters:
PreferredDelimiters:
"%Q": "{}"
@@ -363,6 +418,8 @@ Style/PercentLiteralDelimiters:
"%s": ()
"%w": ()
"%x": ()
+Style/QuotedSymbols:
+ Enabled: true
Style/RedundantArgument:
Enabled: true
Style/RedundantAssignment:
@@ -371,12 +428,18 @@ Style/RedundantFetchBlock:
Enabled: false
Style/RedundantFileExtensionInRequire:
Enabled: true
+Style/RedundantInitialize:
+ Enabled: true
+ Exclude:
+ - lib/jekyll/plugin.rb
Style/RedundantRegexpCharacterClass:
Enabled: true
Style/RedundantRegexpEscape:
Enabled: true
Style/RedundantSelfAssignment:
Enabled: true
+Style/RedundantSelfAssignmentBranch:
+ Enabled: true
Style/RegexpLiteral:
EnforcedStyle: percent_r
Style/RescueModifier:
diff --git a/Gemfile b/Gemfile
index 3053fcba..66575a7e 100644
--- a/Gemfile
+++ b/Gemfile
@@ -23,7 +23,7 @@ group :test do
gem "nokogiri", "~> 1.7"
gem "rspec"
gem "rspec-mocks"
- gem "rubocop", "~> 1.32.0"
+ gem "rubocop", "~> 1.36.0"
gem "rubocop-minitest"
gem "rubocop-performance"
gem "rubocop-rake"
diff --git a/lib/jekyll/commands/build.rb b/lib/jekyll/commands/build.rb
index 7fc6dfa7..204b2a12 100644
--- a/lib/jekyll/commands/build.rb
+++ b/lib/jekyll/commands/build.rb
@@ -30,8 +30,8 @@ module Jekyll
site = Jekyll::Site.new(options)
if options.fetch("skip_initial_build", false)
- Jekyll.logger.warn "Build Warning:", "Skipping the initial build." \
- " This may result in an out-of-date site."
+ Jekyll.logger.warn "Build Warning:",
+ "Skipping the initial build. This may result in an out-of-date site."
else
build(site, options)
end
diff --git a/lib/jekyll/commands/clean.rb b/lib/jekyll/commands/clean.rb
index 9bebd517..9b657a49 100644
--- a/lib/jekyll/commands/clean.rb
+++ b/lib/jekyll/commands/clean.rb
@@ -7,8 +7,7 @@ module Jekyll
def init_with_program(prog)
prog.command(:clean) do |c|
c.syntax "clean [subcommand]"
- c.description "Clean the site " \
- "(removes site output and metadata file) without building."
+ c.description "Clean the site (removes site output and metadata file) without building."
add_build_options(c)
diff --git a/lib/jekyll/commands/doctor.rb b/lib/jekyll/commands/doctor.rb
index 480dd9bd..7e012936 100644
--- a/lib/jekyll/commands/doctor.rb
+++ b/lib/jekyll/commands/doctor.rb
@@ -53,14 +53,14 @@ module Jekyll
"Detected '_posts' directory outside custom `collections_dir`!"
Jekyll.logger.warn "",
"Please move '#{posts_at_root}' into the custom directory at " \
- "'#{site.in_source_dir(site.config["collections_dir"])}'"
+ "'#{site.in_source_dir(site.config["collections_dir"])}'"
false
end
def deprecated_relative_permalinks(site)
if site.config["relative_permalinks"]
- Jekyll::Deprecator.deprecation_message "Your site still uses relative permalinks," \
- " which was removed in Jekyll v3.0.0."
+ Jekyll::Deprecator.deprecation_message "Your site still uses relative permalinks, " \
+ "which was removed in Jekyll v3.0.0."
true
end
end
@@ -105,9 +105,9 @@ module Jekyll
next unless real_urls.uniq.size > 1
urls_only_differ_by_case = true
- Jekyll.logger.warn "Warning:", "The following URLs only differ" \
- " by case. On a case-insensitive file system one of the URLs" \
- " will be overwritten by the other: #{real_urls.join(", ")}"
+ Jekyll.logger.warn "Warning:", "The following URLs only differ by case. On a " \
+ "case-insensitive file system one of the URLs will be " \
+ "overwritten by the other: #{real_urls.join(", ")}"
end
urls_only_differ_by_case
end
@@ -148,8 +148,8 @@ module Jekyll
def url_exists?(url)
return true unless url.nil? || url.empty?
- Jekyll.logger.warn "Warning:", "You didn't set an URL in the config file, "\
- "you may encounter problems with some plugins."
+ Jekyll.logger.warn "Warning:", "You didn't set an URL in the config file, you may " \
+ "encounter problems with some plugins."
false
end
@@ -159,16 +159,16 @@ module Jekyll
# Addressable::URI#parse only raises a TypeError
# https://github.com/sporkmonger/addressable/blob/0a0e96acb17225f9b1c9cab0bad332b448934c9a/lib/addressable/uri.rb#L103
rescue TypeError
- Jekyll.logger.warn "Warning:", "The site URL does not seem to be valid, "\
- "check the value of `url` in your config file."
+ Jekyll.logger.warn "Warning:", "The site URL does not seem to be valid, " \
+ "check the value of `url` in your config file."
false
end
def url_absolute(url)
return true if url.is_a?(String) && Addressable::URI.parse(url).absolute?
- Jekyll.logger.warn "Warning:", "Your site URL does not seem to be absolute, "\
- "check the value of `url` in your config file."
+ Jekyll.logger.warn "Warning:", "Your site URL does not seem to be absolute, " \
+ "check the value of `url` in your config file."
false
end
end
diff --git a/lib/jekyll/commands/new.rb b/lib/jekyll/commands/new.rb
index f85026ba..0a00f263 100644
--- a/lib/jekyll/commands/new.rb
+++ b/lib/jekyll/commands/new.rb
@@ -28,8 +28,8 @@ module Jekyll
FileUtils.mkdir_p new_blog_path
if preserve_source_location?(new_blog_path, options)
Jekyll.logger.error "Conflict:", "#{new_blog_path} exists and is not empty."
- Jekyll.logger.abort_with "", "Ensure #{new_blog_path} is empty or else " \
- "try again with `--force` to proceed and overwrite any files."
+ Jekyll.logger.abort_with "", "Ensure #{new_blog_path} is empty or else try again " \
+ "with `--force` to proceed and overwrite any files."
end
if options["blank"]
@@ -108,13 +108,9 @@ module Jekyll
def create_site(new_blog_path)
create_sample_files new_blog_path
- File.open(File.expand_path(initialized_post_name, new_blog_path), "w") do |f|
- f.write(scaffold_post_content)
- end
+ File.write(File.expand_path(initialized_post_name, new_blog_path), scaffold_post_content)
- File.open(File.expand_path("Gemfile", new_blog_path), "w") do |f|
- f.write(gemfile_contents)
- end
+ File.write(File.expand_path("Gemfile", new_blog_path), gemfile_contents)
end
def preserve_source_location?(path, options)
diff --git a/lib/jekyll/commands/new_theme.rb b/lib/jekyll/commands/new_theme.rb
index f4251470..3419d175 100644
--- a/lib/jekyll/commands/new_theme.rb
+++ b/lib/jekyll/commands/new_theme.rb
@@ -10,8 +10,7 @@ module Jekyll
prog.command(:"new-theme") do |c|
c.syntax "new-theme NAME"
c.description "Creates a new Jekyll theme scaffold"
- c.option "code_of_conduct", \
- "-c", "--code-of-conduct", \
+ c.option "code_of_conduct", "-c", "--code-of-conduct",
"Include a Code of Conduct. (defaults to false)"
c.action do |args, opts|
@@ -30,8 +29,8 @@ module Jekyll
Jekyll.logger.abort_with "Conflict:", "#{theme.path} already exists." if theme.path.exist?
theme.create!
- Jekyll.logger.info "Your new Jekyll theme, #{theme.name.cyan}," \
- " is ready for you in #{theme.path.to_s.cyan}!"
+ Jekyll.logger.info "Your new Jekyll theme, #{theme.name.cyan}, " \
+ "is ready for you in #{theme.path.to_s.cyan}!"
Jekyll.logger.info "For help getting started, read #{theme.path}/README.md."
end
end
diff --git a/lib/jekyll/commands/serve.rb b/lib/jekyll/commands/serve.rb
index 2bb9c8c1..4600130f 100644
--- a/lib/jekyll/commands/serve.rb
+++ b/lib/jekyll/commands/serve.rb
@@ -21,11 +21,11 @@ module Jekyll
"ssl_key" => ["--ssl-key [KEY]", "X.509 (SSL) Private Key."],
"port" => ["-P", "--port [PORT]", "Port to listen on"],
"show_dir_listing" => ["--show-dir-listing",
- "Show a directory listing instead of loading" \
- " your index file.",],
+ "Show a directory listing instead of loading " \
+ "your index file.",],
"skip_initial_build" => ["skip_initial_build", "--skip-initial-build",
- "Skips the initial site build which occurs before" \
- " the server is started.",],
+ "Skips the initial site build which occurs before " \
+ "the server is started.",],
"livereload" => ["-l", "--livereload",
"Use LiveReload to automatically refresh browsers",],
"livereload_ignore" => ["--livereload-ignore ignore GLOB1[,GLOB2[,...]]",
@@ -113,8 +113,8 @@ module Jekyll
def validate_options(opts)
if opts["livereload"]
if opts["detach"]
- Jekyll.logger.warn "Warning:", "--detach and --livereload are mutually exclusive." \
- " Choosing --livereload"
+ Jekyll.logger.warn "Warning:", "--detach and --livereload are mutually exclusive. " \
+ "Choosing --livereload"
opts["detach"] = false
end
if opts["ssl_cert"] || opts["ssl_key"]
@@ -132,9 +132,9 @@ module Jekyll
livereload_max_delay
livereload_ignore
livereload_port).any? { |o| opts[o] }
- Jekyll.logger.abort_with "--livereload-min-delay, "\
- "--livereload-max-delay, --livereload-ignore, and "\
- "--livereload-port require the --livereload option."
+ Jekyll.logger.abort_with "--livereload-min-delay, --livereload-max-delay, " \
+ "--livereload-ignore, and --livereload-port require " \
+ "the --livereload option."
end
end
@@ -174,7 +174,8 @@ module Jekyll
# Do a base pre-setup of WEBRick so that everything is in place
# when we get ready to party, checking for an setting up an error page
# and making sure our destination exists.
-
+ #
+ # rubocop:disable Security/IoMethods
def setup(destination)
require_relative "serve/servlet"
@@ -188,6 +189,7 @@ module Jekyll
end
end
end
+ # rubocop:enable Security/IoMethods
def webrick_opts(opts)
opts = {
@@ -263,8 +265,7 @@ module Jekyll
return system "xdg-open", address if Utils::Platforms.linux?
return system "open", address if Utils::Platforms.osx?
- Jekyll.logger.error "Refusing to launch browser; " \
- "Platform launcher unknown."
+ Jekyll.logger.error "Refusing to launch browser. Platform launcher unknown."
end
# Keep in our area with a thread or detach the server as requested
@@ -277,9 +278,8 @@ module Jekyll
end
Process.detach(pid)
- Jekyll.logger.info "Server detached with pid '#{pid}'.", \
- "Run `pkill -f jekyll' or `kill -9 #{pid}'" \
- " to stop the server."
+ Jekyll.logger.info "Server detached with pid '#{pid}'.",
+ "Run `pkill -f jekyll' or `kill -9 #{pid}' to stop the server."
else
t = Thread.new { server.start }
trap("INT") { server.shutdown }
diff --git a/lib/jekyll/commands/serve/live_reload_reactor.rb b/lib/jekyll/commands/serve/live_reload_reactor.rb
index e79a876a..78f9408f 100644
--- a/lib/jekyll/commands/serve/live_reload_reactor.rb
+++ b/lib/jekyll/commands/serve/live_reload_reactor.rb
@@ -110,7 +110,7 @@ module Jekyll
def log_error(error)
Jekyll.logger.error "LiveReload experienced an error. " \
- "Run with --trace for more information."
+ "Run with --trace for more information."
raise error
end
end
diff --git a/lib/jekyll/commands/serve/servlet.rb b/lib/jekyll/commands/serve/servlet.rb
index d91f871f..c8895e57 100644
--- a/lib/jekyll/commands/serve/servlet.rb
+++ b/lib/jekyll/commands/serve/servlet.rb
@@ -128,7 +128,7 @@ module Jekyll
class Servlet < WEBrick::HTTPServlet::FileHandler
DEFAULTS = {
"Cache-Control" => "private, max-age=0, proxy-revalidate, " \
- "no-store, no-cache, must-revalidate",
+ "no-store, no-cache, must-revalidate",
}.freeze
def initialize(server, root, callbacks)
diff --git a/lib/jekyll/configuration.rb b/lib/jekyll/configuration.rb
index c7acb383..9b2fbffc 100644
--- a/lib/jekyll/configuration.rb
+++ b/lib/jekyll/configuration.rb
@@ -304,8 +304,8 @@ module Jekyll
return if config["plugins"].is_a?(Array)
Jekyll.logger.error "'plugins' should be set as an array of gem-names, but was: " \
- "#{config["plugins"].inspect}. Use 'plugins_dir' instead to set the directory " \
- "for your non-gemified Ruby plugins."
+ "#{config["plugins"].inspect}. Use 'plugins_dir' instead to set " \
+ "the directory for your non-gemified Ruby plugins."
raise Jekyll::Errors::InvalidConfigurationError,
"'plugins' should be set as an array, but was: #{config["plugins"].inspect}."
end
diff --git a/lib/jekyll/converters/markdown/kramdown_parser.rb b/lib/jekyll/converters/markdown/kramdown_parser.rb
index 67514807..1e6a1ded 100644
--- a/lib/jekyll/converters/markdown/kramdown_parser.rb
+++ b/lib/jekyll/converters/markdown/kramdown_parser.rb
@@ -1,4 +1,4 @@
-# Frozen-string-literal: true
+# frozen_string_literal: true
module Kramdown
# A Kramdown::Document subclass meant to optimize memory usage from initializing
diff --git a/lib/jekyll/excerpt.rb b/lib/jekyll/excerpt.rb
index a406951e..63185203 100644
--- a/lib/jekyll/excerpt.rb
+++ b/lib/jekyll/excerpt.rb
@@ -190,8 +190,8 @@ module Jekyll
def print_build_warning
Jekyll.logger.warn "Warning:", "Excerpt modified in #{doc.relative_path}!"
- Jekyll.logger.warn "", "Found a Liquid block containing the excerpt separator" \
- " #{doc.excerpt_separator.inspect}. "
+ Jekyll.logger.warn "", "Found a Liquid block containing the excerpt separator " \
+ "#{doc.excerpt_separator.inspect}."
Jekyll.logger.warn "", "The block has been modified with the appropriate closing tag."
Jekyll.logger.warn "", "Feel free to define a custom excerpt or excerpt_separator in the"
Jekyll.logger.warn "", "document's Front Matter if the generated excerpt is unsatisfactory."
diff --git a/lib/jekyll/filters.rb b/lib/jekyll/filters.rb
index 7042c0c6..5422d52a 100644
--- a/lib/jekyll/filters.rb
+++ b/lib/jekyll/filters.rb
@@ -311,7 +311,7 @@ module Jekyll
order = + 1
else
raise ArgumentError, "Invalid nils order: " \
- "'#{nils}' is not a valid nils order. It must be 'first' or 'last'."
+ "'#{nils}' is not a valid nils order. It must be 'first' or 'last'."
end
sort_input(input, property, order)
diff --git a/lib/jekyll/hooks.rb b/lib/jekyll/hooks.rb
index efb85269..482d8026 100644
--- a/lib/jekyll/hooks.rb
+++ b/lib/jekyll/hooks.rb
@@ -78,8 +78,8 @@ module Jekyll
}
unless @registry[owner][event]
- raise NotAvailable, "Invalid hook. #{owner} supports only the " \
- "following hooks #{@registry[owner].keys.inspect}"
+ raise NotAvailable, "Invalid hook. #{owner} supports only the following hooks " \
+ "#{@registry[owner].keys.inspect}"
end
raise Uncallable, "Hooks must respond to :call" unless block.respond_to? :call
diff --git a/lib/jekyll/plugin_manager.rb b/lib/jekyll/plugin_manager.rb
index fe2e43f9..84c555ab 100644
--- a/lib/jekyll/plugin_manager.rb
+++ b/lib/jekyll/plugin_manager.rb
@@ -113,9 +113,10 @@ module Jekyll
pagination_included = (site.config["plugins"] || []).include?("jekyll-paginate") ||
defined?(Jekyll::Paginate)
if site.config["paginate"] && !pagination_included
- Jekyll::Deprecator.deprecation_message "You appear to have pagination " \
- "turned on, but you haven't included the `jekyll-paginate` gem. " \
- "Ensure you have `plugins: [jekyll-paginate]` in your configuration file."
+ Jekyll::Deprecator.deprecation_message <<~MSG
+ You appear to have pagination turned on, but you haven't included the `jekyll-paginate`
+ gem. Ensure you have `plugins: [jekyll-paginate]` in your configuration file.
+ MSG
end
end
end
diff --git a/lib/jekyll/renderer.rb b/lib/jekyll/renderer.rb
index ddf078fd..c365a0d7 100644
--- a/lib/jekyll/renderer.rb
+++ b/lib/jekyll/renderer.rb
@@ -105,7 +105,7 @@ module Jekyll
converter.convert output
rescue StandardError => e
Jekyll.logger.error "Conversion error:",
- "#{converter.class} encountered an error while "\
+ "#{converter.class} encountered an error while " \
"converting '#{document.relative_path}':"
Jekyll.logger.error("", e.to_s)
raise e
@@ -179,7 +179,7 @@ module Jekyll
return unless invalid_layout?(layout)
Jekyll.logger.warn "Build Warning:", "Layout '#{document.data["layout"]}' requested " \
- "in #{document.relative_path} does not exist."
+ "in #{document.relative_path} does not exist."
end
# Render layout content into document.output
diff --git a/lib/jekyll/site.rb b/lib/jekyll/site.rb
index abd75883..2fad097b 100644
--- a/lib/jekyll/site.rb
+++ b/lib/jekyll/site.rb
@@ -328,11 +328,11 @@ module Jekyll
# Returns
def relative_permalinks_are_deprecated
if config["relative_permalinks"]
- Jekyll.logger.abort_with "Since v3.0, permalinks for pages" \
- " in subfolders must be relative to the" \
- " site source directory, not the parent" \
- " directory. Check https://jekyllrb.com/docs/upgrading/"\
- " for more info."
+ Jekyll.logger.abort_with "Since v3.0, permalinks for pages " \
+ "in subfolders must be relative to the " \
+ "site source directory, not the parent " \
+ "directory. Check https://jekyllrb.com/docs/upgrading/ " \
+ "for more info."
end
end
@@ -536,8 +536,8 @@ module Jekyll
if config["theme"].is_a?(String)
Jekyll::Theme.new(config["theme"])
else
- Jekyll.logger.warn "Theme:", "value of 'theme' in config should be " \
- "String to use gem-based themes, but got #{config["theme"].class}"
+ Jekyll.logger.warn "Theme:", "value of 'theme' in config should be String to use " \
+ "gem-based themes, but got #{config["theme"].class}"
nil
end
end
diff --git a/lib/jekyll/tags/highlight.rb b/lib/jekyll/tags/highlight.rb
index 7b7f3d2e..806665e3 100644
--- a/lib/jekyll/tags/highlight.rb
+++ b/lib/jekyll/tags/highlight.rb
@@ -104,8 +104,8 @@ module Jekyll
"class=\"language-#{@lang.to_s.tr("+", "-")}\"",
"data-lang=\"#{@lang}\"",
].join(" ")
- "
"\
- "#{code.chomp}
"
+ "
" \
+ "#{code.chomp}
"
end
end
end
diff --git a/lib/jekyll/tags/include.rb b/lib/jekyll/tags/include.rb
index 058d8280..6960952e 100644
--- a/lib/jekyll/tags/include.rb
+++ b/lib/jekyll/tags/include.rb
@@ -179,8 +179,8 @@ module Jekyll
private
def could_not_locate_message(file, includes_dirs, safe)
- message = "Could not locate the included file '#{file}' in any of "\
- "#{includes_dirs}. Ensure it exists in one of those directories and"
+ message = "Could not locate the included file '#{file}' in any of #{includes_dirs}. " \
+ "Ensure it exists in one of those directories and"
message + if safe
" is not a symlink as those are not allowed in safe mode."
else
diff --git a/lib/jekyll/tags/post_url.rb b/lib/jekyll/tags/post_url.rb
index 874dd643..7774d377 100644
--- a/lib/jekyll/tags/post_url.rb
+++ b/lib/jekyll/tags/post_url.rb
@@ -86,11 +86,11 @@ module Jekyll
site.posts.docs.each do |document|
next unless @post.deprecated_equality document
- Jekyll::Deprecator.deprecation_message "A call to "\
- "'{% post_url #{@post.name} %}' did not match " \
- "a post using the new matching method of checking name " \
- "(path-date-slug) equality. Please make sure that you " \
- "change this tag to match the post's name exactly."
+ Jekyll::Deprecator.deprecation_message(
+ "A call to '{% post_url #{@post.name} %}' did not match a post using the new " \
+ "matching method of checking name (path-date-slug) equality. Please make sure " \
+ "that you change this tag to match the post's name exactly."
+ )
return relative_url(document)
end
diff --git a/lib/jekyll/theme.rb b/lib/jekyll/theme.rb
index 6505c048..a3f2a94d 100644
--- a/lib/jekyll/theme.rb
+++ b/lib/jekyll/theme.rb
@@ -18,8 +18,8 @@ module Jekyll
# Otherwise, Jekyll.sanitized path with prepend the unresolved root
@root ||= File.realpath(gemspec.full_gem_path)
rescue Errno::ENOENT, Errno::EACCES, Errno::ELOOP
- raise "Path #{gemspec.full_gem_path} does not exist, is not accessible "\
- "or includes a symbolic link loop"
+ raise "Path #{gemspec.full_gem_path} does not exist, is not accessible or includes " \
+ "a symbolic link loop"
end
# The name of theme directory
diff --git a/lib/jekyll/url.rb b/lib/jekyll/url.rb
index 3c4a0091..aeb2ac0d 100644
--- a/lib/jekyll/url.rb
+++ b/lib/jekyll/url.rb
@@ -100,7 +100,7 @@ module Jekyll
winner = pool.find { |key| @placeholders.key?(key) }
if winner.nil?
raise NoMethodError,
- "The URL template doesn't have #{pool.join(" or ")} keys. "\
+ "The URL template doesn't have #{pool.join(" or ")} keys. " \
"Check your permalink template!"
end
diff --git a/lib/jekyll/utils/ansi.rb b/lib/jekyll/utils/ansi.rb
index 35c5ffbc..00d1b1db 100644
--- a/lib/jekyll/utils/ansi.rb
+++ b/lib/jekyll/utils/ansi.rb
@@ -1,4 +1,4 @@
-# Frozen-string-literal: true
+# frozen_string_literal: true
module Jekyll
module Utils
diff --git a/test/helper.rb b/test/helper.rb
index c40adcba..7b1a2b4b 100644
--- a/test/helper.rb
+++ b/test/helper.rb
@@ -105,8 +105,7 @@ class JekyllUnitTest < Minitest::Test
end
def mocks_expect(*args)
- RSpec::Mocks::ExampleMethods::ExpectHost.instance_method(:expect)\
- .bind(self).call(*args)
+ RSpec::Mocks::ExampleMethods::ExpectHost.instance_method(:expect).bind(self).call(*args)
end
def before_setup
@@ -166,7 +165,7 @@ class JekyllUnitTest < Minitest::Test
def directory_with_contents(path)
FileUtils.rm_rf(path)
FileUtils.mkdir(path)
- File.open("#{path}/index.html", "w") { |f| f.write("I was previously generated.") }
+ File.write("#{path}/index.html", "I was previously generated.")
end
def with_env(key, value)
diff --git a/test/test_commands_serve.rb b/test/test_commands_serve.rb
index 8e5005b8..fe9d972c 100644
--- a/test/test_commands_serve.rb
+++ b/test/test_commands_serve.rb
@@ -75,9 +75,7 @@ class TestCommandsServe < JekyllUnitTest