sibprogrammer/owp

View on GitHub

Showing 108 of 803 total issues

Method save_physically has a Cognitive Complexity of 47 (exceeds 5 allowed). Consider refactoring.
Open

  def save_physically
    return false if !valid?
    is_new = new_record?

    if is_new
Severity: Minor
Found in app/models/virtual_server.rb - About 7 hrs to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Method new has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring.
Open

  def new
    @available_locales = I18n.available_locales.map {
      |locale| [locale.to_s, I18n.t('language.title', :locale => locale) + " (#{locale})"]
    }.sort

Severity: Minor
Found in app/controllers/sessions_controller.rb - About 4 hrs to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

File watchdog.rb has 338 lines of code (exceeds 250 allowed). Consider refactoring.
Open

require 'drb/drb'
require 'date'
require 'ostruct'

CURRENT_DIR = File.expand_path(File.dirname(__FILE__)) + '/'
Severity: Minor
Found in utils/watchdog/watchdog.rb - About 4 hrs to fix

    File virtual_server.rb has 337 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    class VirtualServer < ActiveRecord::Base
      attr_accessible :identity, :ip_address, :host_name, :hardware_server_id,
        :orig_os_template, :password, :start_on_boot, :start_after_creation, :state,
        :nameserver, :search_domain, :diskspace, :memory, :password_confirmation,
        :user_id, :orig_server_template, :description, :cpu_units, :cpus, :cpu_limit,
    Severity: Minor
    Found in app/models/virtual_server.rb - About 4 hrs to fix

      Method save_physically has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
      Open

        def save_physically
          return false if !valid?
      
          content = ""
          content << 'ONBOOT="' + (start_on_boot ? "yes" : "no") + '"' + "\n"
      Severity: Minor
      Found in app/models/server_template.rb - About 4 hrs to fix

      Cognitive Complexity

      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

      A method's cognitive complexity is based on a few simple rules:

      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
      • Code is considered more complex for each "break in the linear flow of the code"
      • Code is considered more complex when "flow breaking structures are nested"

      Further reading

      Class VirtualServer has 32 methods (exceeds 20 allowed). Consider refactoring.
      Open

      class VirtualServer < ActiveRecord::Base
        attr_accessible :identity, :ip_address, :host_name, :hardware_server_id,
          :orig_os_template, :password, :start_on_boot, :start_after_creation, :state,
          :nameserver, :search_domain, :diskspace, :memory, :password_confirmation,
          :user_id, :orig_server_template, :description, :cpu_units, :cpus, :cpu_limit,
      Severity: Minor
      Found in app/models/virtual_server.rb - About 4 hrs to fix

        File virtual_servers_controller.rb has 331 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        include ActionView::Helpers::TextHelper
        
        class Admin::VirtualServersController < Admin::Base
          before_filter :superadmin_required, :only => [:list_data, :delete, :create, :clone, :migrate]
          before_filter :set_server_by_id, :only => [ :clone, :migrate, :create_template, :get_properties, :get_stats, :get_limits ]
        Severity: Minor
        Found in app/controllers/admin/virtual_servers_controller.rb - About 3 hrs to fix

          File ext-lang-fr.js has 303 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          /*!
           * Ext JS Library 3.2.1
           * Copyright(c) 2006-2010 Ext JS, Inc.
           * licensing@extjs.com
           * http://www.extjs.com/license
          Severity: Minor
          Found in public/ext/locale/ext-lang-fr.js - About 3 hrs to fix

            File ext-lang-en.js has 298 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            /*!
             * Ext JS Library 3.2.1
             * Copyright(c) 2006-2010 Ext JS, Inc.
             * licensing@extjs.com
             * http://www.extjs.com/license
            Severity: Minor
            Found in public/ext/locale/ext-lang-en.js - About 3 hrs to fix

              File ext-lang-de.js has 288 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              /*!
               * Ext JS Library 3.2.1
               * Copyright(c) 2006-2010 Ext JS, Inc.
               * licensing@extjs.com
               * http://www.extjs.com/license
              Severity: Minor
              Found in public/ext/locale/ext-lang-de.js - About 2 hrs to fix

                File ext-lang-lt.js has 288 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                /*!
                 * Ext JS Library 3.2.1
                 * Copyright(c) 2006-2010 Ext JS, Inc.
                 * licensing@extjs.com
                 * http://www.extjs.com/license
                Severity: Minor
                Found in public/ext/locale/ext-lang-lt.js - About 2 hrs to fix

                  File application.js has 288 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  Ext.BLANK_IMAGE_URL = BASE_URL + '/images/blank.gif';
                  Ext.state.Manager.setProvider(new Ext.state.CookieProvider());
                  Ext.QuickTips.init();
                  Ext.form.Field.prototype.msgTarget = 'side';
                  Ext.Ajax.timeout = 30 * 60 * 1000;
                  Severity: Minor
                  Found in public/javascripts/application.js - About 2 hrs to fix

                    Class VirtualServersController has 25 methods (exceeds 20 allowed). Consider refactoring.
                    Open

                    class Admin::VirtualServersController < Admin::Base
                      before_filter :superadmin_required, :only => [:list_data, :delete, :create, :clone, :migrate]
                      before_filter :set_server_by_id, :only => [ :clone, :migrate, :create_template, :get_properties, :get_stats, :get_limits ]
                    
                      def list
                    Severity: Minor
                    Found in app/controllers/admin/virtual_servers_controller.rb - About 2 hrs to fix

                      Class HardwareServer has 25 methods (exceeds 20 allowed). Consider refactoring.
                      Open

                      class HardwareServer < ActiveRecord::Base
                        include ApplicationHelper
                      
                        attr_accessible :host, :auth_key, :description, :daemon_port, :use_ssl
                        validates_uniqueness_of :host
                      Severity: Minor
                      Found in app/models/hardware_server.rb - About 2 hrs to fix

                        File ext-lang-ru.js has 283 lines of code (exceeds 250 allowed). Consider refactoring.
                        Open

                        /*!
                         * Ext JS Library 3.2.1
                         * Copyright(c) 2006-2010 Ext JS, Inc.
                         * licensing@extjs.com
                         * http://www.extjs.com/license
                        Severity: Minor
                        Found in public/ext/locale/ext-lang-ru.js - About 2 hrs to fix

                          File ext-lang-nl.js has 280 lines of code (exceeds 250 allowed). Consider refactoring.
                          Open

                          /*!
                           * Ext JS Library 3.2.1
                           * Copyright(c) 2006-2010 Ext JS, Inc.
                           * licensing@extjs.com
                           * http://www.extjs.com/license
                          Severity: Minor
                          Found in public/ext/locale/ext-lang-nl.js - About 2 hrs to fix

                            File ext-lang-en_GB.js has 278 lines of code (exceeds 250 allowed). Consider refactoring.
                            Open

                            /*!
                             * Ext JS Library 3.2.1
                             * Copyright(c) 2006-2010 Ext JS, Inc.
                             * licensing@extjs.com
                             * http://www.extjs.com/license
                            Severity: Minor
                            Found in public/ext/locale/ext-lang-en_GB.js - About 2 hrs to fix

                              File ext-lang-es.js has 275 lines of code (exceeds 250 allowed). Consider refactoring.
                              Open

                              /*!
                               * Ext JS Library 3.2.1
                               * Copyright(c) 2006-2010 Ext JS, Inc.
                               * licensing@extjs.com
                               * http://www.extjs.com/license
                              Severity: Minor
                              Found in public/ext/locale/ext-lang-es.js - About 2 hrs to fix

                                File ext-lang-ja.js has 274 lines of code (exceeds 250 allowed). Consider refactoring.
                                Open

                                /*!
                                 * Ext JS Library 3.2.1
                                 * Copyright(c) 2006-2010 Ext JS, Inc.
                                 * licensing@extjs.com
                                 * http://www.extjs.com/license
                                Severity: Minor
                                Found in public/ext/locale/ext-lang-ja.js - About 2 hrs to fix

                                  File ext-lang-ca.js has 273 lines of code (exceeds 250 allowed). Consider refactoring.
                                  Open

                                  /*!
                                   * Ext JS Library 3.2.1
                                   * Copyright(c) 2006-2010 Ext JS, Inc.
                                   * licensing@extjs.com
                                   * http://www.extjs.com/license
                                  Severity: Minor
                                  Found in public/ext/locale/ext-lang-ca.js - About 2 hrs to fix
                                    Severity
                                    Category
                                    Status
                                    Source
                                    Language