crowbar/crowbar-core

View on GitHub

Showing 1,006 of 6,062 total issues

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

  def help_sections
    content = Hashie::Mash.new.tap do |elements|
      Rails.root.join("config", "docs").children.each do |file|
        next unless file.extname == ".yml"

Severity: Minor
Found in crowbar_framework/app/controllers/docs_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 release has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def release
      logger.debug("Release #{name} lock enter: #{@file.inspect}")
      if @file
        @file.flock(File::LOCK_UN) if locked?
        @file.close unless @file.closed?
Severity: Minor
Found in crowbar_framework/lib/crowbar/lock/local_blocking.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 export_supportconfig has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  def export_supportconfig
    begin
      base = "supportconfig-#{Time.now.strftime("%Y%m%d-%H%M%S")}"
      filename = "#{base}.tbz"

Severity: Minor
Found in crowbar_framework/app/controllers/support_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 render_barclamp_edit_attributes has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  def render_barclamp_edit_attributes(proposal)
    if show_raw_attributes?
      render partial: "barclamp/edit_attributes_raw"
    else
      if Rails.root.join("app", "views", "barclamp", proposal.barclamp, "_edit_attributes.html.haml").file?
Severity: Minor
Found in crowbar_framework/app/helpers/barclamps_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 save has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

      def save(group, instance, barclamp, config)
        with_lock "config-#{group}" do
          data_bag_item = databag_config(group)
          data_bag_item[instance] ||= {}
          if data_bag_item[instance][barclamp] != config
Severity: Minor
Found in crowbar_framework/lib/crowbar/data_bag_config.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 proposal_list has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

def proposal_list
  struct = get_json("/proposals/")

  if struct[1] != 200
    ["Failed to talk to service proposal list: #{struct[1]}: #{struct[0]}", 1]
Severity: Minor
Found in bin/barclamp_lib.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 bios_raid_options has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

      def bios_raid_options
        # read in default proposal, to make some vaules avilable
        proposal = Proposal.where(barclamp: "crowbar").first
        raise "Can't find the crowbar proposal" if proposal.nil?

Severity: Minor
Found in crowbar_framework/lib/crowbar/settings.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 method_missing has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def method_missing(method_name, *args)
      if (match = method_name.to_s.match(/(.*)=$/)) && args.size == 1
        self[match[1]] = args.first
      elsif (match = method_name.to_s.match(/(.*)\?$/)) && args.size == 0
        key?(match[1])
Severity: Minor
Found in crowbar_framework/lib/utils/extended_hash.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 dequeue_proposal_no_lock has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def dequeue_proposal_no_lock(bc, inst)
      logger.debug("dequeue_proposal_no_lock: enter for #{bc}:#{inst}")
      begin
        # Find the proposal to delete, get its elements (nodes)
        item = ProposalQueue.find_by(barclamp: bc, name: inst)
Severity: Minor
Found in crowbar_framework/lib/crowbar/deployment_queue.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 platform_available? has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

      def platform_available?(platform, arch)
        available = true

        repositories(platform, arch).each do |repo|
          r = new(platform, arch, repo)
Severity: Minor
Found in crowbar_framework/lib/crowbar/repository.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 list has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

def list
  struct = get_json("/")

  if struct[1] != 200
    ["Failed to talk to service list: #{struct[1]}: #{struct[0]}", 1]
Severity: Minor
Found in bin/barclamp_lib.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 authenticate has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

def authenticate(req, uri, data = nil, limit = 10)
  uri.user = @username
  uri.password = @password

  h = Net::HTTP.new uri.host, uri.port
Severity: Minor
Found in bin/barclamp_lib.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 elements has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

def elements
  struct = get_json("/elements")

  if struct[1] != 200
    ["Failed to talk to service elements: #{struct[1]}: #{struct[0]}", 1]
Severity: Minor
Found in bin/barclamp_lib.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 save_selected_upgrade_mode has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def save_selected_upgrade_mode(mode)
      ::Crowbar::Lock::LocalBlocking.with_lock(shared: false, logger: @logger, path: lock_path) do
        load_while_locked
        # It's ok to change the upgrade mode until starting the services step
        unless pending? :services
Severity: Minor
Found in crowbar_framework/lib/crowbar/upgrade_status.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 elements_not_ready has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def elements_not_ready(nodes, pre_cached_nodes = {})
      # Check to see if we should delay our commit until nodes are ready.
      delay = []
      nodes.each do |n|
        pre_cached_nodes[n] ||= Node.find_by_name(n)
Severity: Minor
Found in crowbar_framework/lib/crowbar/deployment_queue.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 ret("operator", null, stream.current());
Severity: Major
Found in crowbar_framework/vendor/assets/javascripts/codemirror/javascript.js - About 30 mins to fix

Avoid too many return statements within this function.
Open

    if (type == "default") return cont(expect(":"));
Severity: Major
Found in crowbar_framework/vendor/assets/javascripts/codemirror/javascript.js - About 30 mins to fix

Avoid too many return statements within this function.
Open

    if (type == "operator") return cont(expression);
Severity: Major
Found in crowbar_framework/vendor/assets/javascripts/codemirror/javascript.js - About 30 mins to fix

Avoid too many return statements within this function.
Open

    return cont();
Severity: Major
Found in crowbar_framework/vendor/assets/javascripts/codemirror/javascript.js - About 30 mins to fix

Avoid too many return statements within this function.
Open

    if (type == "[") return cont(pushlex("]"), expression, expect("]"), poplex, maybeoperator);
Severity: Major
Found in crowbar_framework/vendor/assets/javascripts/codemirror/javascript.js - About 30 mins to fix
Severity
Category
Status
Source
Language