Skip to content

Commit

Permalink
enable 'Lint/RescueWithoutErrorClass' Cop (#6482)
Browse files Browse the repository at this point in the history
Merge pull request 6482
  • Loading branch information
ashmaroli authored and jekyllbot committed Oct 28, 2017
1 parent 63255ae commit 9632733
Show file tree
Hide file tree
Showing 8 changed files with 9 additions and 9 deletions.
2 changes: 0 additions & 2 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,6 @@ Layout/SpaceInsideBrackets:
Enabled: false
Lint/EndAlignment:
Severity: error
Lint/RescueWithoutErrorClass:
Enabled: false
Lint/UnreachableCode:
Severity: error
Lint/UselessAccessModifier:
Expand Down
2 changes: 1 addition & 1 deletion Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ def siteify_file(file, overrides_front_matter = {})
abort "You seem to have misplaced your #{file} file. I can haz?" unless File.exist?(file)
title = begin
File.read(file).match(%r!\A# (.*)$!)[1]
rescue
rescue NoMethodError
File.basename(file, ".*").downcase.capitalize
end
slug = File.basename(file, ".markdown").downcase
Expand Down
4 changes: 3 additions & 1 deletion lib/jekyll/commands/doctor.rb
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,9 @@ def url_exists?(url)
def url_valid?(url)
Addressable::URI.parse(url)
true
rescue
# Addressable::URI#parse only raises a TypeError
# https://git.io/vFfbx
rescue TypeError
Jekyll.logger.warn "Warning:", "The site URL does not seem to be valid, "\
"check the value of `url` in your config file."
false
Expand Down
2 changes: 1 addition & 1 deletion lib/jekyll/convertible.rb
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ def read_yaml(base, name, opts = {})
rescue SyntaxError => e
Jekyll.logger.warn "YAML Exception reading #{filename}: #{e.message}"
raise e if self.site.config["strict_front_matter"]
rescue => e
rescue StandardError => e
Jekyll.logger.warn "Error reading file #{filename}: #{e.message}"
raise e if self.site.config["strict_front_matter"]
end
Expand Down
2 changes: 1 addition & 1 deletion lib/jekyll/document.rb
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ def read(opts = {})
merge_defaults
read_content(opts)
read_post_data
rescue => e
rescue StandardError => e
handle_read_error(e)
end
end
Expand Down
2 changes: 1 addition & 1 deletion lib/jekyll/renderer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ def convert(content)
converters.reduce(content) do |output, converter|
begin
converter.convert output
rescue => e
rescue StandardError => e
Jekyll.logger.error "Conversion error:",
"#{converter.class} encountered an error while "\
"converting '#{document.relative_path}':"
Expand Down
2 changes: 1 addition & 1 deletion lib/jekyll/tags/include.rb
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ def outside_site_source?(path, dir, safe)

def realpath_prefixed_with?(path, dir)
File.exist?(path) && File.realpath(path).start_with?(dir)
rescue
rescue StandardError
false
end

Expand Down
2 changes: 1 addition & 1 deletion lib/jekyll/tags/post_url.rb
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ def initialize(tag_name, post, tokens)
@orig_post = post.strip
begin
@post = PostComparer.new(@orig_post)
rescue => e
rescue StandardError => e
raise Jekyll::Errors::PostURLError, <<-MSG
Could not parse name of post "#{@orig_post}" in tag 'post_url'.
Expand Down

0 comments on commit 9632733

Please sign in to comment.