Skip to content

Commit

Permalink
Fix rubocop errors
Browse files Browse the repository at this point in the history
  • Loading branch information
just1602 committed Aug 12, 2023
1 parent 2708660 commit 9b16e03
Show file tree
Hide file tree
Showing 12 changed files with 13 additions and 13 deletions.
2 changes: 1 addition & 1 deletion app/controllers/admin/episodes_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ def set_podcasts

def set_episode
@episode = Episode.find(params[:id])
return redirect_to %i[admin podcasts] if @episode.blank?
redirect_to %i[admin podcasts] if @episode.blank?
end

def episode_params
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/admin/users_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ def user_params
end

def authorize_admin_role
return redirect_to [:admin] unless Current.user.can_admin_users?
redirect_to [:admin] unless Current.user.can_admin_users?
end
end
end
2 changes: 1 addition & 1 deletion app/controllers/application_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ def check_for_redirection

# TODO: move to rack middleware
def strip_file_extension
return redirect_to request.path.sub('.html', '') if request.path.include?('.html')
redirect_to request.path.sub('.html', '') if request.path.include?('.html')
end

# TODO: move to meta helper
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/books_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,6 @@ def into_libraries

def set_book
@book = Book.find_by(slug: params[:slug])
return redirect_to [:books] if @book.blank?
redirect_to [:books] if @book.blank?
end
end
4 changes: 2 additions & 2 deletions app/controllers/categories_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def feed
def set_slug
@slug = params[:slug].dasherize

return redirect_to category_path(@slug) if @slug != params[:slug]
redirect_to category_path(@slug) if @slug != params[:slug]
end

def set_category
Expand All @@ -46,7 +46,7 @@ def set_title
def set_articles
@articles = @category.articles.for_index(**filters).page(params[:page]).per(25)

return redirect_to root_path if @articles.blank?
redirect_to root_path if @articles.blank?
end

def filters
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/definitions_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,6 @@ def set_book

def set_definition
@definition = Definition.find_by(slug: params[:slug])
return redirect_to [:definitions] if @definition.blank?
redirect_to [:definitions] if @definition.blank?
end
end
2 changes: 1 addition & 1 deletion app/controllers/episodes_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def set_episode
if request.path.starts_with? '/draft'
@episode = Episode.find_by(draft_code: params[:draft_code])

return redirect_to(@episode.path) if @episode&.published?
redirect_to(@episode.path) if @episode&.published?
else
@episode = Episode.live.find_by(podcast_id: @podcast, episode_number: params[:episode_number])
return @episode if @episode.present?
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/languages_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,6 @@ def canonical_locale
def set_articles
abbreviation = canonical_locale&.lang_code
@articles = Article.live.published.where(locale: abbreviation).page(params[:page]).per(25)
return redirect_to languages_path if @articles.empty?
redirect_to languages_path if @articles.empty?
end
end
2 changes: 1 addition & 1 deletion app/controllers/pages_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ def set_page
def page_redirects
return render file: Rails.public_path.join('404.html'), status: :not_found if @page.nil?

return redirect_to @page.path if @page.published? && params[:draft_code].present?
redirect_to @page.path if @page.published? && params[:draft_code].present?
end

def set_html_id
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/sessions_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ def new
@title = PageTitle.new 'Sign In'
@body_id = 'signin'
# TODO: why doesn't this prevent a signed in user going to /signin
return redirect_to(root_url) if signed_in?
redirect_to(root_url) if signed_in?
end

# /signin
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/tags_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def set_title
def set_articles
@articles = @tag.articles.for_index(**filters).page(params[:page]).per(25)

return redirect_to root_path if @articles.blank?
redirect_to root_path if @articles.blank?
end

def filters
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/tools_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,6 @@ def set_editable
end

def redirect_to_tool_namespace_if_no_tool
return redirect_to [@type.to_sym] if @tool.blank?
redirect_to [@type.to_sym] if @tool.blank?
end
end

0 comments on commit 9b16e03

Please sign in to comment.