ClusterLabs/hawk

View on GitHub

Showing 340 of 2,379 total issues

Method initialize has a Cognitive Complexity of 281 (exceeds 5 allowed). Consider refactoring.
Open

  def initialize(id, user, pass, use_file = false, stonithwarning = false)
    Rails.logger.debug "Cib.initialize #{id}, #{user}, #{use_file}"

    if use_file
      cib_path = id
Severity: Minor
Found in hawk/app/models/cib.rb - About 5 days 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 initialize has 545 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def initialize(id, user, pass, use_file = false, stonithwarning = false)
    Rails.logger.debug "Cib.initialize #{id}, #{user}, #{use_file}"

    if use_file
      cib_path = id
Severity: Major
Found in hawk/app/models/cib.rb - About 2 days to fix

    File cib.rb has 1042 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    require 'util'
    require 'cibtools'
    require 'string'
    require 'rexml/document' unless defined? REXML::Document
    require 'rexml/xpath' unless defined? REXML::XPath
    Severity: Major
    Found in hawk/app/models/cib.rb - About 2 days to fix

      File resources.js has 775 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      // Copyright (c) 2009-2015 Tim Serong <tserong@suse.com>
      // See COPYING for license.
      
      $(function() {
        function executeAction(context, confirmMsg) {
      Severity: Major
      Found in hawk/app/assets/javascripts/module/resources.js - About 1 day to fix

        File hawk_test_driver.py has 641 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        #!/usr/bin/python3
        # Copyright (C) 2019 SUSE LLC
        """Define Selenium driver related functions and classes to test the HAWK GUI"""
        
        import ipaddress
        Severity: Major
        Found in e2e_test/hawk_test_driver.py - About 1 day to fix

          File statustable.js has 544 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          // Copyright (c) 2015-2016 Kristoffer Gronlund <kgronlund@suse.com>
          // Copyright (c) 2016 Ayoub Belarbi <abelarbi@suse.com>
          // See COPYING for license.
          
          // This module is a table-based visualization for cluster status (Using JsRender). To use this module:
          Severity: Major
          Found in hawk/app/assets/javascripts/module/statustable.js - About 1 day to fix

            File reports.js has 526 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            // Copyright (c) 2009-2015 Tim Serong <tserong@suse.com>
            // See COPYING for license.
            
            $(function() {
              var time_format_string = 'YYYY-MM-DD HH:mm:ss ZZ';
            Severity: Major
            Found in hawk/app/assets/javascripts/module/reports.js - About 1 day to fix

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

                OpList.prototype.init = function() {
                  var self = this;
              
                  var content = {
                    labels: self.options.labels,
              Severity: Major
              Found in hawk/app/assets/javascripts/module/oplist.js - About 1 day to fix

                Method fix_resource_states has a Cognitive Complexity of 43 (exceeds 5 allowed). Consider refactoring.
                Open

                  def fix_resource_states(rsclist)
                    prio = {
                      unknown: 0,
                      stopped: 1,
                      started: 2,
                Severity: Minor
                Found in hawk/app/models/cib.rb - About 6 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 build_tabs has 163 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  var build_tabs = function() {
                    $('#reports #report-running').addClass('hidden');
                    $('#reports #report-tabs').removeClass('hidden');
                
                    var controls = $("#reports #report-controls");
                Severity: Major
                Found in hawk/app/assets/javascripts/module/reports.js - About 6 hrs to fix

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

                    RecipientList.prototype.init = function() {
                      var self = this;
                  
                      var content = {
                        labels: self.options.labels,
                  Severity: Major
                  Found in hawk/app/assets/javascripts/module/recipientlist.js - About 5 hrs to fix

                    Function afterDisplay has 143 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      function afterDisplay(self) {
                        var data = $('#reports #transition-data');
                        var report = data.data('report');
                        var transitions = $.parseJSON(data.text());
                    
                    
                    Severity: Major
                    Found in hawk/app/assets/javascripts/module/reports.js - About 5 hrs to fix

                      Function rulesList has 141 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

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

                        Method rsc_state_from_lrm_rsc_op has a Cognitive Complexity of 37 (exceeds 5 allowed). Consider refactoring.
                        Open

                          def rsc_state_from_lrm_rsc_op(xml, node_uname, rsc_id)
                            xml.elements.each("cib/status/node_state[@uname='#{node_uname}']/lrm/lrm_resources/lrm_resource[@id='#{rsc_id}']") do |lrm_resource|
                              # logic derived somewhat from pacemaker/lib/pengine/unpack.c:unpack_rsc_op()
                              state = :unknown
                              ops = []
                        Severity: Minor
                        Found in hawk/app/lib/cibtools.rb - About 5 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 136 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                          ConstraintList.prototype.init = function() {
                            var self = this;
                        
                            $.each(self.values, function(outer, parent) {
                              $.each(parent.resources, function(inner, group) {
                        Severity: Major
                        Found in hawk/app/assets/javascripts/module/constraint.js - About 5 hrs to fix

                          Method instantiate has a Cognitive Complexity of 36 (exceeds 5 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: Minor
                          Found in hawk/app/models/template.rb - About 5 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 primitives.js has 390 lines of code (exceeds 250 allowed). Consider refactoring.
                          Open

                          // Copyright (c) 2009-2015 Tim Serong <tserong@suse.com>
                          // See COPYING for license.
                          
                          $(function() {
                            // Some craziness to avoid duplicating this stuff for both
                          Severity: Minor
                          Found in hawk/app/assets/javascripts/module/primitives.js - About 5 hrs to fix

                            Function render_attrlists has 130 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                var render_attrlists = function($template, $clazz, $provider, $type) {
                                  var new_resource = $('form#new_primitive, form#new_template').length > 0;
                                  var agent = null;
                                  if ($template.length > 0 && $template.val() != "") {
                                    agent = "@" + $template.val();
                            Severity: Major
                            Found in hawk/app/assets/javascripts/module/primitives.js - About 5 hrs to fix

                              Function OpList has 127 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

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

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

                                  def shell_syntax
                                    [].tap do |cmd|
                                
                                      cmd.push "colocation #{@id} #{@score}:"
                                
                                
                                Severity: Minor
                                Found in hawk/app/models/colocation.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

                                Severity
                                Category
                                Status
                                Source
                                Language