Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump RuboCop to v0.85.x #8223

Merged
merged 1 commit into from Jun 1, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 6 additions & 0 deletions .rubocop.yml
Expand Up @@ -56,6 +56,8 @@ Lint/NestedPercentLiteral:
- test/test_site.rb
Lint/DeprecatedOpenSSLConstant:
Enabled: true
Lint/MixedRegexpCaptureTypes:
Enabled: false
Lint/RaiseException:
Enabled: true
Lint/StructNewOverride:
Expand Down Expand Up @@ -169,6 +171,10 @@ Style/PercentLiteralDelimiters:
"%w": "()"
"%W": "()"
"%x": "()"
Style/RedundantRegexpCharacterClass:
Enabled: true
Style/RedundantRegexpEscape:
Enabled: true
Style/RegexpLiteral:
EnforcedStyle: percent_r
Style/RescueModifier:
Expand Down
2 changes: 1 addition & 1 deletion Gemfile
Expand Up @@ -28,7 +28,7 @@ group :test do
gem "nokogiri", "~> 1.7"
gem "rspec"
gem "rspec-mocks"
gem "rubocop", "~> 0.84.0"
gem "rubocop", "~> 0.85.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__)
Expand Down
4 changes: 2 additions & 2 deletions lib/jekyll/cleaner.rb
Expand Up @@ -3,7 +3,7 @@
module Jekyll
# Handles the cleanup of a site's destination before it is built.
class Cleaner
HIDDEN_FILE_REGEX = %r!\/\.{1,2}$!.freeze
HIDDEN_FILE_REGEX = %r!/\.{1,2}$!.freeze
attr_reader :site

def initialize(site)
Expand Down Expand Up @@ -105,7 +105,7 @@ def keep_dirs
#
# Returns the regular expression
def keep_file_regex
%r!\A#{Regexp.quote(site.dest)}\/(#{Regexp.union(site.keep_files).source})!
%r!\A#{Regexp.quote(site.dest)}/(#{Regexp.union(site.keep_files).source})!
end
end
end
2 changes: 1 addition & 1 deletion lib/jekyll/collection.rb
Expand Up @@ -166,7 +166,7 @@ def inspect
#
# Returns a sanitized version of the label.
def sanitize_label(label)
label.gsub(%r![^a-z0-9_\-\.]!i, "")
label.gsub(%r![^a-z0-9_\-.]!i, "")
end

# Produce a representation of this Collection for use in Liquid.
Expand Down
2 changes: 1 addition & 1 deletion lib/jekyll/page.rb
Expand Up @@ -178,7 +178,7 @@ def path

# The path to the page source file, relative to the site source
def relative_path
@relative_path ||= File.join(*[@dir, @name].map(&:to_s).reject(&:empty?)).sub(%r!\A\/!, "")
@relative_path ||= File.join(*[@dir, @name].map(&:to_s).reject(&:empty?)).sub(%r!\A/!, "")
end

# Obtain destination path.
Expand Down
6 changes: 3 additions & 3 deletions lib/jekyll/tags/include.rb
Expand Up @@ -5,15 +5,15 @@ module Tags
class IncludeTag < Liquid::Tag
VALID_SYNTAX = %r!
([\w-]+)\s*=\s*
(?:"([^"\\]*(?:\\.[^"\\]*)*)"|'([^'\\]*(?:\\.[^'\\]*)*)'|([\w\.-]+))
(?:"([^"\\]*(?:\\.[^"\\]*)*)"|'([^'\\]*(?:\\.[^'\\]*)*)'|([\w.-]+))
!x.freeze
VARIABLE_SYNTAX = %r!
(?<variable>[^{]*(\{\{\s*[\w\-\.]+\s*(\|.*)?\}\}[^\s{}]*)+)
(?<variable>[^{]*(\{\{\s*[\w\-.]+\s*(\|.*)?\}\}[^\s{}]*)+)
(?<params>.*)
!mx.freeze

FULL_VALID_SYNTAX = %r!\A\s*(?:#{VALID_SYNTAX}(?=\s|\z)\s*)*\z!.freeze
VALID_FILENAME_CHARS = %r!^[\w/\.-]+$!.freeze
VALID_FILENAME_CHARS = %r!^[\w/.-]+$!.freeze
INVALID_SEQUENCES = %r![./]{2,}!.freeze

def initialize(tag_name, markup, tokens)
Expand Down
2 changes: 1 addition & 1 deletion lib/jekyll/utils.rb
Expand Up @@ -215,7 +215,7 @@ def slugify(string, mode: nil, cased: false)
slug = replace_character_sequence_with_hyphen(string, :mode => mode)

# Remove leading/trailing hyphen
slug.gsub!(%r!^\-|\-$!i, "")
slug.gsub!(%r!^-|-$!i, "")

slug.downcase! unless cased
Jekyll.logger.warn("Warning:", "Empty `slug` generated for '#{string}'.") if slug.empty?
Expand Down
2 changes: 1 addition & 1 deletion test/helper.rb
Expand Up @@ -83,7 +83,7 @@ def test_dir(*subdirs)

def temp_dir(*subdirs)
if Utils::Platforms.windows?
drive = Dir.pwd.sub(%r!^([^\/]+).*!, '\1')
drive = Dir.pwd.sub(%r!^([^/]+).*!, '\1')
temp_root = File.join(drive, "tmp")
else
temp_root = "/tmp"
Expand Down
2 changes: 1 addition & 1 deletion test/test_convertible.rb
Expand Up @@ -47,7 +47,7 @@ class TestConvertible < JekyllUnitTest
out = capture_stderr do
@convertible.read_yaml(@base, "exploit_front_matter.erb")
end
refute_match(%r!undefined class\/module DoesNotExist!, out)
refute_match(%r!undefined class/module DoesNotExist!, out)
end

should "not parse if there is encoding error in file" do
Expand Down
2 changes: 1 addition & 1 deletion test/test_front_matter_defaults.rb
Expand Up @@ -97,7 +97,7 @@ class TestFrontMatterDefaults < JekyllUnitTest
)

@site.process
@affected = @site.posts.docs.find { |page| page.relative_path =~ %r!win\/! }
@affected = @site.posts.docs.find { |page| page.relative_path =~ %r!win/! }
@not_affected = @site.pages.find { |page| page.relative_path == "about.html" }
end

Expand Down
4 changes: 2 additions & 2 deletions test/test_kramdown.rb
Expand Up @@ -117,7 +117,7 @@ def ruby_fu
should "convert" do
converter = fixture_converter(@config)
assert_match(
%r!<p>(&#8220;|“)Pit(&#8217;|’)hy(&#8221;|”)<\/p>!,
%r!<p>(&#8220;|“)Pit(&#8217;|’)hy(&#8221;|”)</p>!,
converter.convert(%("Pit'hy")).strip
)
end
Expand All @@ -130,7 +130,7 @@ def ruby_fu
},
}
converter = fixture_converter(Utils.deep_merge_hashes(@config, override))
assert_match %r!<p>(&#171;|«)Pit(&#8250;|›)hy(&#187;|»)<\/p>!, \
assert_match %r!<p>(&#171;|«)Pit(&#8250;|›)hy(&#187;|»)</p>!, \
converter.convert(%("Pit'hy")).strip
end
end
Expand Down
18 changes: 9 additions & 9 deletions test/test_tags.rb
Expand Up @@ -360,7 +360,7 @@ def highlight_block_with_opts(options_string)
end

should "not cause an error" do
refute_match(%r!markdown\-html\-error!, @result)
refute_match(%r!markdown-html-error!, @result)
end

should "have the URL to the 'complex' post from 2008-11-21" do
Expand All @@ -385,7 +385,7 @@ def highlight_block_with_opts(options_string)
end

should "not cause an error" do
refute_match(%r!markdown\-html\-error!, @result)
refute_match(%r!markdown-html-error!, @result)
end

should "have the URL to the 'special-chars' post from 2016-11-26" do
Expand Down Expand Up @@ -413,7 +413,7 @@ def highlight_block_with_opts(options_string)
end

should "not cause an error" do
refute_match(%r!markdown\-html\-error!, @result)
refute_match(%r!markdown-html-error!, @result)
end

should "have the URL to the 'complex' post from 2008-11-21" do
Expand Down Expand Up @@ -444,7 +444,7 @@ def highlight_block_with_opts(options_string)
end

should "not cause an error" do
refute_match(%r!markdown\-html\-error!, @result)
refute_match(%r!markdown-html-error!, @result)
end

should "have the url to the 'nested' post from 2008-11-21" do
Expand Down Expand Up @@ -516,7 +516,7 @@ def highlight_block_with_opts(options_string)
end

should "not cause an error" do
refute_match(%r!markdown\-html\-error!, @result)
refute_match(%r!markdown-html-error!, @result)
end

should "have the URL to the 'contacts' item" do
Expand Down Expand Up @@ -554,7 +554,7 @@ def highlight_block_with_opts(options_string)
end

should "not cause an error" do
refute_match(%r!markdown\-html\-error!, @result)
refute_match(%r!markdown-html-error!, @result)
end

should "have the URL to the 'contacts' item" do
Expand Down Expand Up @@ -587,7 +587,7 @@ def highlight_block_with_opts(options_string)
end

should "not cause an error" do
refute_match(%r!markdown\-html\-error!, @result)
refute_match(%r!markdown-html-error!, @result)
end

should "have the URL to the 'yaml_with_dots' item" do
Expand All @@ -613,7 +613,7 @@ def highlight_block_with_opts(options_string)
end

should "not cause an error" do
refute_match(%r!markdown\-html\-error!, @result)
refute_match(%r!markdown-html-error!, @result)
end

should "have the URL to the 'yaml_with_dots' item" do
Expand All @@ -639,7 +639,7 @@ def highlight_block_with_opts(options_string)
end

should "not cause an error" do
refute_match(%r!markdown\-html\-error!, @result)
refute_match(%r!markdown-html-error!, @result)
end

should "have the URL to the 'sanitized_path' item" do
Expand Down
2 changes: 1 addition & 1 deletion test/test_theme.rb
Expand Up @@ -74,7 +74,7 @@ def setup

should "raise when getting theme root" do
error = assert_raises(RuntimeError) { Theme.new("test-non-existent-theme") }
assert_match(%r!fixtures\/test-non-existent-theme does not exist!, error.message)
assert_match(%r!fixtures/test-non-existent-theme does not exist!, error.message)
end
end
end
Expand Down