diff --git a/.rubocop.yml b/.rubocop.yml index f483e1dd..3a02c8fd 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -44,8 +44,6 @@ Layout/SpaceInsideBrackets: Enabled: false Lint/EndAlignment: Severity: error -Lint/RescueWithoutErrorClass: - Enabled: false Lint/UnreachableCode: Severity: error Lint/UselessAccessModifier: diff --git a/Rakefile b/Rakefile index 1a01e412..786a2626 100644 --- a/Rakefile +++ b/Rakefile @@ -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 diff --git a/lib/jekyll/commands/doctor.rb b/lib/jekyll/commands/doctor.rb index c10ee596..960ee9f9 100644 --- a/lib/jekyll/commands/doctor.rb +++ b/lib/jekyll/commands/doctor.rb @@ -135,7 +135,9 @@ module Jekyll 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 diff --git a/lib/jekyll/convertible.rb b/lib/jekyll/convertible.rb index 45a83c4f..1236d9d1 100644 --- a/lib/jekyll/convertible.rb +++ b/lib/jekyll/convertible.rb @@ -49,7 +49,7 @@ module Jekyll 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 diff --git a/lib/jekyll/document.rb b/lib/jekyll/document.rb index 0877ca12..d39d5d8c 100644 --- a/lib/jekyll/document.rb +++ b/lib/jekyll/document.rb @@ -266,7 +266,7 @@ module Jekyll merge_defaults read_content(opts) read_post_data - rescue => e + rescue StandardError => e handle_read_error(e) end end diff --git a/lib/jekyll/renderer.rb b/lib/jekyll/renderer.rb index 136a42ad..71e5b87c 100644 --- a/lib/jekyll/renderer.rb +++ b/lib/jekyll/renderer.rb @@ -96,7 +96,7 @@ module Jekyll 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}':" diff --git a/lib/jekyll/tags/include.rb b/lib/jekyll/tags/include.rb index 0032b7d2..e7464786 100644 --- a/lib/jekyll/tags/include.rb +++ b/lib/jekyll/tags/include.rb @@ -184,7 +184,7 @@ MSG def realpath_prefixed_with?(path, dir) File.exist?(path) && File.realpath(path).start_with?(dir) - rescue + rescue StandardError false end diff --git a/lib/jekyll/tags/post_url.rb b/lib/jekyll/tags/post_url.rb index 4fba9814..db0b3fa0 100644 --- a/lib/jekyll/tags/post_url.rb +++ b/lib/jekyll/tags/post_url.rb @@ -59,7 +59,7 @@ module Jekyll @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'.