antillas21/ajax-datatables-rails

View on GitHub

Showing 2 of 2 total issues

Class Base has 24 methods (exceeds 20 allowed). Consider refactoring.
Open

  class Base

    class << self
      def default_db_adapter
        ::ActiveRecord::Base.configurations.configs_for(env_name: Rails.env).first.adapter.downcase.to_sym
Severity: Minor
Found in lib/ajax-datatables-rails/base.rb - About 2 hrs to fix

    Convert if nested inside else to elsif.
    Open

            if opts['version'].empty?
    Severity: Minor
    Found in Appraisals by rubocop

    If the else branch of a conditional consists solely of an if node, it can be combined with the else to become an elsif. This helps to keep the nesting level from getting too deep.

    Example:

    # bad
    if condition_a
      action_a
    else
      if condition_b
        action_b
      else
        action_c
      end
    end
    
    # good
    if condition_a
      action_a
    elsif condition_b
      action_b
    else
      action_c
    end

    Example: AllowIfModifier: false (default)

    # bad
    if condition_a
      action_a
    else
      action_b if condition_b
    end
    
    # good
    if condition_a
      action_a
    elsif condition_b
      action_b
    end

    Example: AllowIfModifier: true

    # good
    if condition_a
      action_a
    else
      action_b if condition_b
    end
    
    # good
    if condition_a
      action_a
    elsif condition_b
      action_b
    end
    Severity
    Category
    Status
    Source
    Language