ClusterLabs/hawk

View on GitHub

Showing 340 of 2,379 total issues

Method set_transition has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

  def set_transition
    set_transitions
    if params.has_key? :transition
      tidx = params[:transition].to_i
      tidx -= 1 if tidx > 0
Severity: Minor
Found in hawk/app/controllers/reports_controller.rb - About 55 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 call has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    def call(env)
      status, headers, body = @app.call(env)

      if headers['Set-Cookie'].present?
        cookies = headers['Set-Cookie'].split(COOKIE_SEPARATOR)
Severity: Minor
Found in hawk/app/lib/hawk/secure_cookies.rb - About 55 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 child_active has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

  def child_active(pidfile)
    active = false
    if File.exist?(pidfile)
      pid = File.new(pidfile).read.to_i
      if pid > 0
Severity: Minor
Found in hawk/app/lib/util.rb - About 55 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 char2score has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

  def char2score(score)
    case score
    when "-INFINITY"
      -1000000
    when "INFINITY"
Severity: Minor
Found in hawk/app/lib/util.rb - About 55 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 deeply nested control flow statements.
Open

                    if ($.type(root[lstname][elemname]) == "object") {
                      return [root[lstname][elemname]];
                    } else {
                      return root[lstname][elemname];
                    }
Severity: Major
Found in hawk/app/assets/javascripts/module/primitives.js - About 45 mins to fix

    Method destroy has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

      def destroy
        respond_to do |format|
          out, err, rc = Invoker.instance.crm("--force", "configure", "delete", @role.id)
          if rc == 0
            format.html do
    Severity: Minor
    Found in hawk/app/controllers/roles_controller.rb - About 45 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_params has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

      def validate_params
        required_params = []
        res = Util.get_metadata_hash(agent_name)
        param_res = res["resource_agent"]["parameters"]["parameter"]
        if param_res
    Severity: Minor
    Found in hawk/app/models/primitive.rb - About 45 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 destroy has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

      def destroy
        respond_to do |format|
          out, err, rc = Invoker.instance.crm("--force", "configure", "delete", @order.id)
          if rc == 0
            format.html do
    Severity: Minor
    Found in hawk/app/controllers/orders_controller.rb - About 45 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 destroy has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

      def destroy
        respond_to do |format|
          out, err, rc = Invoker.instance.crm("--force", "configure", "delete", @primitive.id)
          if rc == 0
            format.html do
    Severity: Minor
    Found in hawk/app/controllers/primitives_controller.rb - About 45 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 destroy has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

      def destroy
        respond_to do |format|
          out, err, rc = Invoker.instance.crm("--force", "configure", "delete", @clone.id)
          if rc == 0
            format.html do
    Severity: Minor
    Found in hawk/app/controllers/clones_controller.rb - About 45 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 merge_ocf_check_level has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

      def merge_ocf_check_level(op, v)
        unless v
          # No OCF_CHECK_LEVEL set, remove it from the XML if present
          cl = op.elements['instance_attributes/nvpair[@name="OCF_CHECK_LEVEL"]']
          cl.remove if cl
    Severity: Minor
    Found in hawk/app/models/record.rb - About 45 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 create has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

      def create
        @session = Session.new params[:session].permit!
    
        respond_to do |format|
          if @session.valid?
    Severity: Minor
    Found in hawk/app/controllers/sessions_controller.rb - About 45 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 destroy has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

      def destroy
        respond_to do |format|
          out, err, rc = Invoker.instance.crm("--force", "configure", "delete", @user.id)
          if rc == 0
            format.html do
    Severity: Minor
    Found in hawk/app/controllers/users_controller.rb - About 45 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 destroy has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

      def destroy
        respond_to do |format|
          out, err, rc = Invoker.instance.crm("--force", "configure", "delete", @group.id)
          if rc == 0
            format.html do
    Severity: Minor
    Found in hawk/app/controllers/groups_controller.rb - About 45 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 deeply nested control flow statements.
    Open

              elsif m = /^  (\w+) connection:(\w+)$/.match(l)
                warning(_("DRBD connection for %{d} to %{n} is %{s}") % { d: curr, s: m[2], n: m[1]}) if warn_connectionstates.include? m[2]
    Severity: Major
    Found in hawk/app/models/cib.rb - About 45 mins to fix

      Method update_resource_state has 6 arguments (exceeds 4 allowed). Consider refactoring.
      Open

        def update_resource_state(resource, node, instance, state, substate, failed_ops)
      Severity: Minor
      Found in hawk/app/models/cib.rb - About 45 mins to fix

        Method generate has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

          def generate
            errors = []
            params[:report].permit!
            from_time = parse_time params[:report][:from_time], errors
            to_time = parse_time params[:report][:to_time], errors
        Severity: Minor
        Found in hawk/app/controllers/reports_controller.rb - About 45 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 deeply nested control flow statements.
        Open

                    warning(_("DRBD disk %{d} is %{s} on %{n}") % { d: curr, s: m[1], n: curr_peer}) if warn_diskstates.include? m[1]
        Severity: Major
        Found in hawk/app/models/cib.rb - About 45 mins to fix

          Method mapping has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

            def mapping
              {}.tap do |m|
                m["standby"] = {
                  # TODO: Should be boolean, but pacemaker's crappy (yes|true|1) booleans don't map well to the attrlist boolean type :/
                  type: "string",
          Severity: Minor
          Found in hawk/app/models/node.rb - About 45 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 destroy has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

            def destroy
              respond_to do |format|
                out, err, rc = Invoker.instance.crm("--force", "configure", "delete", @master.id)
                if rc == 0
                  format.html do
          Severity: Minor
          Found in hawk/app/controllers/masters_controller.rb - About 45 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

          Severity
          Category
          Status
          Source
          Language