ClusterLabs/hawk

View on GitHub

Showing 329 of 2,363 total issues

Function show_operation_modal has 85 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    var show_operation_modal = function(edit_mode, id, name) {
      var submit_text = (edit_mode == MODAL_MODE_CREATE) ? content.labels.add : content.labels.apply;
      if (!name)
        name = id;
      var attrmapping = self.attr_mapping;
Severity: Major
Found in hawk/app/assets/javascripts/module/oplist.js - About 3 hrs to fix

    Function formatter has 85 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

            formatter: function(value, row, index) {
              var operations = [];
    
              switch(row.object_type) {
                case "location":
    Severity: Major
    Found in hawk/app/assets/javascripts/module/constraints.js - About 3 hrs to fix

      Function init has 84 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        WizAttrList.prototype.init = function() {
          var self = this;
      
          $.each(Object.keys(self.values), function(index, value) {
            var found = null;
      Severity: Major
      Found in hawk/app/assets/javascripts/module/wizattrlist.js - About 3 hrs to fix

        Function expandResourcesHandler has 84 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          var expandResourcesHandler = function (index, row, detail) {
            var columns = statesResourcesColumns.slice(0);
            var datasource = [];
            if (row.children || row.child || row.refs) {
              var datasource = [];
        Severity: Major
        Found in hawk/app/assets/javascripts/module/resources.js - About 3 hrs to fix

          Function clusterRefresh has 84 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              clusterRefresh: function() {
                  var that = this;
                  that.ajaxQuery({
                      url: that.baseUrl() + "/cib/live?format=json",
                      type: "GET",
          Severity: Major
          Found in hawk/app/assets/javascripts/module/statustable.js - About 3 hrs to fix

            statusTable has 28 functions (exceeds 20 allowed). Consider refactoring.
            Open

            var statusTable = {
                tableData: [], // An Array that contains JSON data fetched from the cib, see cacheData()
                // List of options(passed to init function) and their types:
                // clusterId: string,
                // clusterType: string,
            Severity: Minor
            Found in hawk/app/assets/javascripts/module/statustable.js - About 3 hrs to fix

              Method options has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
              Open

                  def options
                    Rails.cache.fetch(:crm_ra_classes, expires_in: 2.hours) do
                      {}.tap do |result|
                        clazzes = Util.safe_x('/usr/sbin/crm', 'ra', 'classes').split(/\n/)
                        clazzes.delete("heartbeat") unless File.directory?("/etc/ha.d/resource.d")
              Severity: Minor
              Found in hawk/app/models/template.rb - About 3 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 location.js has 301 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              // Copyright (c) 2009-2015 Tim Serong <tserong@suse.com>
              // See COPYING for license.
              
              ;(function($) {
                'use strict';
              Severity: Minor
              Found in hawk/app/assets/javascripts/module/location.js - About 3 hrs to fix

                HawkTestDriver has 27 functions (exceeds 20 allowed). Consider refactoring.
                Open

                class HawkTestDriver:
                    def __init__(self, addr='localhost', port='7630', browser='firefox', headless=False, version='15-SP5'):
                        self.addr = addr
                        self.port = port
                        self.driver = None
                Severity: Minor
                Found in e2e_test/hawk_test_driver.py - About 3 hrs to fix

                  Class Resource has 27 methods (exceeds 20 allowed). Consider refactoring.
                  Open

                  class Resource < Record
                    class CommandError < StandardError
                    end
                  
                    attribute :object_type, Symbol
                  Severity: Minor
                  Found in hawk/app/models/resource.rb - About 3 hrs to fix

                    Method instantiate has 79 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        def instantiate(xml)
                          record = allocate
                          record.clazz = xml.attributes["class"] || ""
                          record.provider = xml.attributes["provider"] || ""
                          record.type = xml.attributes["type"] || ""
                    Severity: Major
                    Found in hawk/app/models/template.rb - About 3 hrs to fix

                      Method edit has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
                      Open

                        def edit
                          if request.post?
                            fencing = params[:fencing]
                            fencing = fencing["fencing"] if fencing.is_a? Hash
                            fencing = [] if fencing.nil?
                      Severity: Minor
                      Found in hawk/app/controllers/fencing_controller.rb - About 3 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 build_scriptparams has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
                      Open

                        def build_scriptparams(params)
                          sp = build_stepmap({}, @wizard)
                          id = @wizard.id
                          params.select { |k, _v| k.start_with?("#{id}.") }.each do |k, v|
                            next if v.empty?
                      Severity: Minor
                      Found in hawk/app/controllers/wizards_controller.rb - About 3 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 run has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
                      Open

                        def run
                          if current_cib.id == "live"
                            head :bad_request
                            return
                          end
                      Severity: Minor
                      Found in hawk/app/controllers/simulator_controller.rb - About 3 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

                      Function init has 76 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                        AttrList.prototype.init = function() {
                          var self = this;
                      
                          if (!self.freeform) {
                            $.each(Object.keys(self.values), function(index, value) {
                      Severity: Major
                      Found in hawk/app/assets/javascripts/module/attrlist.js - About 3 hrs to fix

                        Function show_modal has 74 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            var show_modal = function(edit_mode, id, recipient) {
                              var modal = $('#modal');
                              var modalinput = {
                                id: id,
                                value: recipient.value,
                        Severity: Major
                        Found in hawk/app/assets/javascripts/module/recipientlist.js - About 2 hrs to fix

                          File template.rb has 289 lines of code (exceeds 250 allowed). Consider refactoring.
                          Open

                          require 'invoker'
                          
                          class Template < Resource
                            attribute :clazz, String, default: "ocf"
                            attribute :provider, String
                          Severity: Minor
                          Found in hawk/app/models/template.rb - About 2 hrs to fix

                            Function clusterConnectionError has 73 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                clusterConnectionError: function(xhr, status, error, cb) {
                                    var that = this;
                                    if (window.userIsNavigatingAway)
                                        return;
                                    var msg = "";
                            Severity: Major
                            Found in hawk/app/assets/javascripts/module/statustable.js - About 2 hrs to fix

                              Function clusterConnectionError has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
                              Open

                                  clusterConnectionError: function(xhr, status, error, cb) {
                                      var that = this;
                                      if (window.userIsNavigatingAway)
                                          return;
                                      var msg = "";
                              Severity: Minor
                              Found in hawk/app/assets/javascripts/module/statustable.js - 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 graph has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
                              Open

                                def graph
                                  respond_to do |format|
                                    format.html do
                                      render layout: false
                                    end
                              Severity: Minor
                              Found in hawk/app/controllers/reports_controller.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

                              Severity
                              Category
                              Status
                              Source
                              Language