ClusterLabs/hawk

View on GitHub

Showing 2,376 of 2,376 total issues

Assignment Branch Condition size for popen3 is too high. [51.12/15]
Open

  def popen3(user, *cmd)
    raise SecurityError, "Util::popen3 called with < 2 args" if cmd.length < 2
    pw = IO::pipe   # pipe[0] for read, pipe[1] for write
    pr = IO::pipe
    pe = IO::pipe
Severity: Minor
Found in hawk/app/lib/util.rb by rubocop

This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric

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

        Method has too many lines. [62/30]
        Open

            def instantiate(xml)
              record = allocate
        
              record.resources = [].tap do |resources|
                if xml.attributes["rsc"]
        Severity: Minor
        Found in hawk/app/models/location.rb by rubocop

        This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

        Assignment Branch Condition size for create is too high. [47.72/15]
        Open

          def create
            @session = Session.new params[:session].permit!
        
            respond_to do |format|
              if @session.valid?

        This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric

        Assignment Branch Condition size for create is too high. [47.76/15]
        Open

          def create
            normalize_params! params[:primitive].permit!
            @title = _("Create Primitive")
        
            @primitive = Primitive.new params[:primitive].permit!

        This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric

        Assignment Branch Condition size for show is too high. [47.6/15]
        Open

          def show
            respond_to do |format|
              format.html do
                cmd = "show"
                cmd = "show xml" if params[:xml] == "true"

        This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric

        Method has too many lines. [62/30]
        Open

            def select(field, choices = nil, args = {}, html = {})
              unless options.fetch(:bootstrap, true)
                return super
              end
        
        
        Severity: Minor
        Found in hawk/app/lib/hawk/form_builder.rb by rubocop

        This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

        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

            Method has too many lines. [60/30]
            Open

                  define_method method_name.to_sym do |field, *args|
                    unless options.fetch(:bootstrap, true)
                      return super
                    end
            
            
            Severity: Minor
            Found in hawk/app/lib/hawk/form_builder.rb by rubocop

            This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

            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

              Assignment Branch Condition size for get_parameters_from is too high. [44.55/15]
              Open

                  def get_parameters_from(crm_config, cmd)
                    #todo: this doesn't work with safe_x. research why.
                    REXML::Document.new(%x[#{cmd} 2>/dev/null]).tap do |xml|
                      return unless xml.root
              
              
              Severity: Minor
              Found in hawk/app/models/crm_config.rb by rubocop

              This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric

              Assignment Branch Condition size for shell_syntax is too high. [44.18/15]
              Open

                def shell_syntax
                  [].tap do |cmd|
                    cmd.push "alert #{id} #{path.shellescape}"
              
                    unless params.empty?
              Severity: Minor
              Found in hawk/app/models/alert.rb by rubocop

              This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric

              Assignment Branch Condition size for check_drbd_status is too high. [44.15/15]
              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 by rubocop

              This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric

              Method has too many lines. [59/30]
              Open

                def run
                  if current_cib.id == "live"
                    head :bad_request
                    return
                  end

              This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

              Method has too many lines. [58/30]
              Open

                def edit
                  if request.post?
                    fencing = params[:fencing]
                    fencing = fencing["fencing"] if fencing.is_a? Hash
                    fencing = [] if fencing.nil?

              This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

              Severity
              Category
              Status
              Source
              Language