ClusterLabs/hawk

View on GitHub

Showing 329 of 2,363 total issues

Method merge_operations has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring.
Open

  def merge_operations(attrs)
    if attrs.empty?
      # No operations to set, get rid of the list (if it exists)
      xml.elements['operations'].remove if xml.elements['operations']
    else
Severity: Minor
Found in hawk/app/models/record.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 nodes.js has 371 lines of code (exceeds 250 allowed). Consider refactoring.
Open

// Copyright (c) 2009-2015 Tim Serong <tserong@suse.com>
// See COPYING for license.

$(function() {
  var rowStyleFn = function(row, index) {
Severity: Minor
Found in hawk/app/assets/javascripts/module/nodes.js - About 4 hrs to fix

    File reports_controller.rb has 371 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    class ReportsController < ApplicationController
      before_action :login_required
      before_action :set_title
      before_action :set_record, only: [:show, :destroy, :download, :cache]
      before_action :set_transition, only: [:display, :detail, :graph, :logs, :diff, :pefile, :status, :cib]
    Severity: Minor
    Found in hawk/app/controllers/reports_controller.rb - About 4 hrs to fix

      Method persist! has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
      Open

        def persist!
          writer = {
            crm_config: {},
            rsc_defaults: {},
            op_defaults: {},
      Severity: Minor
      Found in hawk/app/models/crm_config.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

      Method fix_clone_instances has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
      Open

        def fix_clone_instances(rsclist)
          rsclist.each do |res|
            if res[:clone_max]
              # There'll be a stale default instance lying around if the resource was
              # started before it was cloned (bnc#711180), so ditch it.  This is all
      Severity: Minor
      Found in hawk/app/models/cib.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 oplist.js has 356 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      // Copyright (c) 2009-2015 Tim Serong <tserong@suse.com>
      // See COPYING for license.
      
      // ops and values is:
      //
      Severity: Minor
      Found in hawk/app/assets/javascripts/module/oplist.js - About 4 hrs to fix

        File util.rb has 352 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        module Util
        
          # From http://mentalized.net/journal/2011/04/14/ruby_how_to_check_if_a_string_is_numeric/
          def numeric?(n)
            Float(n) != nil rescue false
        Severity: Minor
        Found in hawk/app/lib/util.rb - About 4 hrs to fix

          Method check_drbd_status has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
          Open

            def check_drbd_status
              # if there are any running drbd resources on this node and a drbdadm command,
              # check drbdadm status
              # do we need sudo to do it?
              me = Socket.gethostname
          Severity: Minor
          Found in hawk/app/models/cib.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 ReportsController has 34 methods (exceeds 20 allowed). Consider refactoring.
          Open

          class ReportsController < ApplicationController
            before_action :login_required
            before_action :set_title
            before_action :set_record, only: [:show, :destroy, :download, :cache]
            before_action :set_transition, only: [:display, :detail, :graph, :logs, :diff, :pefile, :status, :cib]
          Severity: Minor
          Found in hawk/app/controllers/reports_controller.rb - About 4 hrs to fix

            Function AttrList has 106 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              function AttrList(el, options) {
                this.$el = $(el);
            
                this.values = this.$el.data('attrlist');
            
            
            Severity: Major
            Found in hawk/app/assets/javascripts/module/attrlist.js - About 4 hrs to fix

              Function WizAttrList has 100 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                function WizAttrList(el, options) {
                  this.$el = $(el);
              
                  this.values = this.$el.data('wizattrlist');
                  this.targets = this.$el.data('wizattrlist-target');
              Severity: Major
              Found in hawk/app/assets/javascripts/module/wizattrlist.js - About 4 hrs to fix

                Function ConstraintList has 98 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  function ConstraintList(el, options) {
                    this.$el = $(el);
                
                    this.values = this.$el.data('constraints');
                
                
                Severity: Major
                Found in hawk/app/assets/javascripts/module/constraint.js - About 3 hrs to fix

                  Method instantiate has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def instantiate(xml, state)
                        record = allocate
                        record.id = state[:id]
                        record.xml = xml
                        record.name = state[:name]
                  Severity: Minor
                  Found in hawk/app/models/node.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 verify has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
                  Open

                    def verify(params)
                      @params = params
                      @actions = []
                      @errors = []
                      CrmScript.run ["verify", @name, params], nil do |action, err|
                  Severity: Minor
                  Found in hawk/app/models/wizard.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 executeNodeSelectionAction has 95 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    function executeNodeSelectionAction(context, message, defaultmsg) {
                      var html = [
                        '<div class="modal fade" id="nodeSelectionDialog" role="dialog" tabindex="-1" aria-hidden="true">',
                        '<div class="modal-dialog">',
                        '<div class="modal-content">',
                  Severity: Major
                  Found in hawk/app/assets/javascripts/module/resources.js - About 3 hrs to fix

                    Function RecipientList has 92 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      function RecipientList(el, options) {
                        this.$el = $(el);
                    
                        // defined actions: [{name, interval, ...}]
                        this.values = this.$el.data('recipients');
                    Severity: Major
                    Found in hawk/app/assets/javascripts/module/recipientlist.js - About 3 hrs to fix

                      Class Cib has 30 methods (exceeds 20 allowed). Consider refactoring.
                      Open

                      class Cib
                        extend ActiveModel::Naming
                        include ActiveModel::Conversion
                        include FastGettext::Translation
                        include Rails.application.routes.url_helpers # needed for routes
                      Severity: Minor
                      Found in hawk/app/models/cib.rb - About 3 hrs to fix

                        Function success has 91 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                                  success: function(data) {
                                    if (data == null || !("resource_agent" in data)) {
                                      data = { resource_agent: {
                                        shortdesc: agent,
                                        longdesc: "",
                        Severity: Major
                        Found in hawk/app/assets/javascripts/module/primitives.js - About 3 hrs to fix

                          Method shell_syntax has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
                          Open

                            def shell_syntax
                              [].tap do |cmd|
                                cmd.push "location #{id}"
                          
                                if resources.length == 1
                          Severity: Minor
                          Found in hawk/app/models/location.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 formatter has 88 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                                formatter: function(value, row, index) {
                                  var operations = [];
                                  var dropdowns = [];
                          
                                  var op_destination = "button";
                          Severity: Major
                          Found in hawk/app/assets/javascripts/module/resources.js - About 3 hrs to fix
                            Severity
                            Category
                            Status
                            Source
                            Language