Updated

app/controllers/admin / sites_controller.rb

A
40 lines of codes
4 methods
4.8 complexity/method
9 churn
19.21 complexity
24 duplications
class Admin::SitesController < Admin::AdminController
  1. Admin::SitesController assumes too much for instance variable '@site'
  2. Admin::SitesController has no descriptive comment
before_action :require_sysadmin before_action :fetch_site def edit respond_to do |format| format.html end end def update
  1. Similar code found in 2 nodes Locations: 0 1
if @site.update(site_params) redirect_to edit_admin_site_url(tab: params[:tab]), notice: :site_updated else respond_to do |format| format.html { render :edit } end end end private def fetch_site @site = Site.instance end def site_params params.require(:site).permit( :title, :url, :email_from, :username, :password, :enabled, :protected, :petition_duration, :minimum_number_of_sponsors, :maximum_number_of_sponsors, :threshold_for_moderation, :threshold_for_response, :threshold_for_debate, :feedback_email, :moderate_url, :login_timeout, :disable_constituency_api, :signature_count_interval, :update_signature_counts, :disable_trending_petitions, :threshold_for_moderation_delay, :disable_invalid_signature_count_check, :disable_daily_update_statistics_job, :disable_plus_address_check, :disable_feedback_sending ) end end