sibprogrammer/owp

View on GitHub

Showing 108 of 803 total issues

File ext-lang-hr.js has 255 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-hr.js - About 2 hrs to fix

    Method sync_virtual_servers has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
    Open

      def sync_virtual_servers
        ves_on_server = rpc_client.exec('vzlist', '-a -H -o veid,hostname,ip,status')['output'].split("\n")
        # skip error lines
        ves_on_server = ves_on_server.find_all{ |item| item =~ /^\s*\d+/ }
    
    
    Severity: Minor
    Found in app/models/hardware_server.rb - About 2 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 get_usage_stats has 52 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        def get_usage_stats(virtual_server)
          is_running = 'running' == virtual_server.real_state
    
          stats = []
    
    
    Severity: Major
    Found in app/controllers/admin/virtual_servers_controller.rb - About 2 hrs to fix

      Method new has 52 lines of code (exceeds 25 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: Major
      Found in app/controllers/sessions_controller.rb - About 2 hrs to fix

        Method get_usage_stats has 52 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          def get_usage_stats(virtual_server)
            is_running = 'running' == virtual_server.real_state
        
            stats = []
        
        
        Severity: Major
        Found in app/controllers/api/virtual_servers_controller.rb - About 2 hrs to fix

          File ext-lang-ro.js has 253 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-ro.js - About 2 hrs to fix

            Method install has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
            Open

              def install
                hardware_server = HardwareServer.find_by_id(params[:hardware_server_id])
                render(:json => { :success => false }) and return if !hardware_server
            
                jobs_ids = []
            Severity: Minor
            Found in app/controllers/admin/os_templates_controller.rb - About 1 hr 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

            Function groupAction has 47 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            Owp.list.groupAction = function(config) {
              config = Ext.apply({
                gridName: '',
                url: '',
                command: '',
            Severity: Minor
            Found in public/javascripts/application.js - About 1 hr to fix

              Method get_usage_stats has 47 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  def get_usage_stats(hardware_server)
                    stats = []
              
                    os_version = hardware_server.os_version
                    stats << {
              Severity: Minor
              Found in app/controllers/admin/hardware_servers_controller.rb - About 1 hr to fix

                Function action has 44 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                Owp.button.action = function(config) {
                  config = Ext.apply({
                    gridName: '',
                    url: '',
                    command: '',
                Severity: Minor
                Found in public/javascripts/application.js - About 1 hr to fix

                  Method stat_details has 42 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    def stat_details
                      @virtual_server = VirtualServer.find_by_id(params[:id])
                      redirect_to :controller => 'dashboard' and return if !@virtual_server or !@current_user.can_control(@virtual_server)
                  
                      @up_level = '/admin/virtual-servers/show?id=' + @virtual_server.id.to_s
                  Severity: Minor
                  Found in app/controllers/admin/virtual_servers_controller.rb - About 1 hr to fix

                    Method restore has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                    Open

                      def restore
                        orig_ve_state = virtual_server.state
                        virtual_server.stop if 'running' == orig_ve_state
                    
                        job_id = restore_now['job_id']
                    Severity: Minor
                    Found in app/models/backup.rb - About 1 hr 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 virtual_server_properties has 38 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        def virtual_server_properties(virtual_server)
                          params = [
                            {
                              :parameter => t('admin.virtual_servers.form.create_server.field.identity'),
                              :value => virtual_server.identity,
                    Severity: Minor
                    Found in app/controllers/admin/virtual_servers_controller.rb - About 1 hr to fix

                      Method reset_password has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                      Open

                        def reset_password
                          if params.key?(:user_id) and params.key?(:hash)
                            user = User.find(params[:user_id])
                            if user
                              hash = Digest::SHA1.hexdigest(user.crypted_password + user.login)
                      Severity: Minor
                      Found in app/controllers/sessions_controller.rb - About 1 hr 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

                      Function errorHandler has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      Owp.form.errorHandler = function(form, action, params) {
                        if ('client' == action.failureType) {
                          return
                        }
                        
                      Severity: Minor
                      Found in public/javascripts/application.js - About 1 hr to fix

                        Method install_daemon has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                          def install_daemon(root_password)
                            if root_password.blank?
                              self.errors.add :root_password, :empty
                              return false
                            end
                        Severity: Minor
                        Found in app/models/hardware_server.rb - About 1 hr to fix

                          Method sync_virtual_servers has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                            def sync_virtual_servers
                              ves_on_server = rpc_client.exec('vzlist', '-a -H -o veid,hostname,ip,status')['output'].split("\n")
                              # skip error lines
                              ves_on_server = ves_on_server.find_all{ |item| item =~ /^\s*\d+/ }
                          
                          
                          Severity: Minor
                          Found in app/models/hardware_server.rb - About 1 hr to fix

                            Method profile has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                            Open

                              def profile
                                @page_title = t('admin.my_profile.title')
                            
                                if request.post?
                                  if !params[:password].blank?
                            Severity: Minor
                            Found in app/controllers/iphone/users_controller.rb - About 1 hr 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 sync_backups has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                            Open

                              def sync_backups
                                backups_list = rpc_client.exec('ls', "--block-size=M -s #{backups_dir}")['output']
                                backups_list = backups_list.split("\n")
                                # remove totals line
                                backups_list.shift
                            Severity: Minor
                            Found in app/models/hardware_server.rb - About 1 hr 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

                            Function brMoney has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                            Open

                              Ext.util.Format.brMoney = function(v){
                                v = (Math.round((v - 0) * 100)) / 100;
                                v = (v == Math.floor(v)) ? v + ".00" : ((v * 10 == Math.floor(v * 10)) ? v + "0" : v);
                                v = String(v);
                                var ps = v.split('.');
                            Severity: Minor
                            Found in public/ext/locale/ext-lang-pt_BR.js - About 1 hr 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

                            Severity
                            Category
                            Status
                            Source
                            Language