denny/ShinyCMS-ruby

View on GitHub

Showing 9 of 659 total issues

Method index has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Confirmed

def index
authenticate_user! unless params[:token]
 
if subscriber
@subscriptions = subscriber.subscriptions

Method selected_comment_ids has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Confirmed

def selected_comment_ids
comment_ids = []
update_params[ :spam_comments ].each_pair do |key, value|
next unless value == '1'
 
 
Severity: Minor
Found in plugins/ShinyCMS/app/controllers/shinycms/admin/comments_controller.rb - About 35 mins to fix

Method add_element has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

def add_element( formatting, name )
return add_long_text_element name if formatting == 'simple_format'
return add_html_element name if formatting == 'sanitize'
return add_image_element name if formatting == 'image_tag' || name.include?( 'image' )
 
 
Severity: Minor
Found in plugins/ShinyCMS/app/public/models/concerns/shinycms/template.rb - About 35 mins to fix

Method check_with_akismet has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

def check_with_akismet
return true if user_signed_in?
return true unless akismet_api_key_is_set? && feature_enabled?( :akismet_for_comments )
 
spam, blatant = akismet_check( request, @new_comment )
Severity: Minor
Found in plugins/ShinyCMS/app/controllers/shinycms/comments_controller.rb - About 35 mins to fix

Avoid too many return statements within this method.
Confirmed

return false unless user.admin?
Severity: Major
Found in plugins/ShinyCMS/app/models/shinycms/feature_flag.rb - About 30 mins to fix

    Method perform has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Confirmed

    def perform( send )
    return unless send.sendable?
     
    send.mark_as_sending
     
     
    Severity: Minor
    Found in plugins/ShinyNewsletters/app/jobs/shiny_newsletters/send_to_list_job.rb - About 25 mins to fix

    Method update_value has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Confirmed

    def update_value( id, params )
    setting = Setting.find( id )
     
    return false if setting.level == 'site'
    return false if setting.level == 'admin' && current_user_is_not_admin?
    Severity: Minor
    Found in plugins/ShinyCMS/app/controllers/shinycms/site_settings_controller.rb - About 25 mins to fix

    Method seed_setting has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

    def seed_setting( name:, value: '', description: nil, level: 'site', locked: false )
    setting = ShinyCMS::Setting.find_or_create_by!( name: name.to_s )
    setting.unlock
     
    setting.update!( description: description ) if description.present?
    Severity: Minor
    Found in plugins/ShinyCMS/app/public/lib/shinycms/seeder.rb - About 25 mins to fix

    Method enabled? has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Confirmed

    def self.enabled?( name, user = nil )
    feature = find_by( name: name.to_s )
     
    return false if feature.blank?
    return true if feature.enabled?
    Severity: Minor
    Found in plugins/ShinyCMS/app/models/shinycms/feature_flag.rb - About 25 mins to fix
    Severity
    Category
    Status
    Source
    Language