Skip to content

Commit 4c2f482

Browse files
committed
Early return rather than conditional raise
1 parent d1fd227 commit 4c2f482

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

Rakefile

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,11 @@ task :validate_sidebar_tree => [:build] do
5959

6060
def check_url(url)
6161
if url.end_with?("/") then
62-
raise "Imprecise target url '#{url}' in sidebar (did you mean '#{url[..-2]}'?)\n\n" unless File.directory?("_site#{url}")
62+
return if File.directory?("_site#{url}")
63+
raise "Imprecise target url '#{url}' in sidebar (did you mean '#{url[..-2]}'?)\n\n"
6364
else
64-
raise "Imprecise target url '#{url}' in sidebar (did you mean '#{url}/'?)\n\n" unless File.file?("_site#{url}.html")
65+
return if File.file?("_site#{url}.html")
66+
raise "Imprecise target url '#{url}' in sidebar (did you mean '#{url}/'?)\n\n"
6567
end
6668
end
6769

0 commit comments

Comments
 (0)