ClusterLabs/hawk

View on GitHub

Showing 337 of 2,376 total issues

Method set_shadow_cib has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  def set_shadow_cib
    if !current_cib || current_cib.live?
      ENV.delete("CIB_shadow")
      return
    end
Severity: Minor
Found in hawk/app/controllers/application_controller.rb - About 35 mins 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 primitives has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  def primitives
    ret = []
    @resources.each do |r|
      if r.key? :children
        r[:children].each do |c|
Severity: Minor
Found in hawk/app/models/cib.rb - About 35 mins 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 update has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  def update
    unless self.class.exists? id, self.class.cib_type_write
      errors.add :base, _('The ID "%{id}" does not exist') % { id: id }
      return false
    end
Severity: Minor
Found in hawk/app/models/record.rb - About 35 mins 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 flatten_hash has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  def flatten_hash(hash = params, ancestor_names = [])
    flat_hash = {}
    hash.each do |k, v|
      names = Array.new(ancestor_names)
      names << k
Severity: Minor
Found in hawk/app/helpers/wizard_helper.rb - About 35 mins 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_constraint has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  def get_constraint(elem)
    objtype = {
      rsc_location: :location,
      rsc_colocation: :colocation,
      rsc_order: :order,
Severity: Minor
Found in hawk/app/models/cib.rb - About 35 mins 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 params_mapping has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  def params_mapping
    m = {}
    @parameters.each do |param|
      next unless param.advanced
      m[param.id] = {
Severity: Minor
Found in hawk/app/models/step.rb - About 35 mins 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 validate has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  def validate(record)
    unless record.score.blank?
      record.score.strip!
      unless [
        "mandatory",
Severity: Minor
Found in hawk/app/validators/order_validator.rb - About 35 mins 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 diff has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  def diff(a, b)
    # call diff on a and b
    # returns [data, ok?]
    require 'tempfile.rb'
    fa = Tempfile.new 'simdiff_a'
Severity: Minor
Found in hawk/app/lib/util.rb - About 35 mins 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 7 (exceeds 5 allowed). Consider refactoring.
Open

  def run(jsondata, rootpw)
    user = current_user
    cmd = crmsh_escape(JSON.dump(jsondata))
    tmpf = Tempfile.new 'crmscript'
    tmpf.write("script json \"#{cmd}\"")
Severity: Minor
Found in hawk/app/lib/crm_script.rb - About 35 mins 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 determine_online_status_no_fencing has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  def determine_online_status_no_fencing(ns)
    in_ccm      = get_xml_attr(ns, 'in_ccm')
    crm_state   = get_xml_attr(ns, 'crmd')
    join_state  = get_xml_attr(ns, 'join')

Severity: Minor
Found in hawk/app/lib/cibtools.rb - About 35 mins 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 ignore_command has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  def ignore_command(input, cmd)
    return true if cmd[0] == 'cluster'
    if cmd[0] == 'configure'
      return true if input == 'show'
      return true if cmd[1] == 'graph'
Severity: Minor
Found in hawk/app/lib/invoker.rb - About 35 mins 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_metadata_hash has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  def get_metadata_hash(agent)
    sub_map = { 'type="string"' => 'type="text"',
                '(type="boolean".*)default="(yes|1)"' => '\1default="true"',
                '(type="boolean".*)default="(no|0)"' => '\1default="false"' }

Severity: Minor
Found in hawk/app/lib/util.rb - About 35 mins 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 generate has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  def generate(from_time, to_time, all_nodes = true)
    [@outfile, @errfile, @exitfile, @timefile].each do |fn|
      File.unlink(fn) if File.exist?(fn)
    end
    @lastexit = nil
Severity: Minor
Found in hawk/app/lib/hb_report.rb - About 35 mins 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

Avoid too many return statements within this function.
Open

            return '<a href="' + Routes.cib_agent_path($('body').data('cib'), encodeURIComponent("@" + row.template)) + '" data-toggle="modal" data-target="#modal-lg">' + value + '</a>';
Severity: Major
Found in hawk/app/assets/javascripts/module/resources.js - About 30 mins to fix

    Avoid too many return statements within this function.
    Open

              return 'fa fa-fw fa-question';
    Severity: Major
    Found in hawk/app/assets/javascripts/module/status.js - About 30 mins to fix

      Avoid too many return statements within this function.
      Open

                return __("Bundle");
      Severity: Major
      Found in hawk/app/assets/javascripts/module/resources.js - About 30 mins to fix

        Avoid too many return statements within this function.
        Open

              return { classes: ["success"] };
        Severity: Major
        Found in hawk/app/assets/javascripts/module/resources.js - About 30 mins to fix

          Avoid too many return statements within this function.
          Open

                return { classes: ["success"] };
          Severity: Major
          Found in hawk/app/assets/javascripts/module/resources.js - About 30 mins to fix

            Avoid too many return statements within this function.
            Open

                      return __("Tag");
            Severity: Major
            Found in hawk/app/assets/javascripts/module/resources.js - About 30 mins to fix

              Avoid too many return statements within this function.
              Open

                    return {};
              Severity: Major
              Found in hawk/app/assets/javascripts/module/resources.js - About 30 mins to fix
                Severity
                Category
                Status
                Source
                Language