crowbar/crowbar-core

View on GitHub

Showing 1,006 of 6,062 total issues

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

    def queue_proposal(bc, inst, elements, element_order, deps, pre_cached_nodes)
      logger.debug("queue proposal: enter for #{bc}:#{inst}")
      delay = []
      begin
        lock = acquire_lock("queue")
Severity: Minor
Found in crowbar_framework/lib/crowbar/deployment_queue.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 convert_value has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    def convert_value(value, dup = false)
      case value
      when Hash
        value = value.dup if value.is_a?(ExtendedHash) && dup
        value.is_a?(ExtendedHash) ? value : value.to_extended
Severity: Minor
Found in crowbar_framework/lib/utils/extended_hash.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 forwarders has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

      def forwarders
        f = File.open("/etc/bind/named.conf")
        arr = []
        write = false
        f.each_line do |line|
Severity: Minor
Found in crowbar_framework/lib/crowbar/backup/export.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 find_scripts_for_bc has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

  def self.find_scripts_for_bc(bc_name)
    all_scripts = []

    migrate_dir = get_migrate_dir(bc_name)
    return all_scripts unless File.directory?(migrate_dir)
Severity: Minor
Found in crowbar_framework/lib/schema_migration.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 run_script has 6 arguments (exceeds 4 allowed). Consider refactoring.
Open

  def self.run_script(script, is_upgrade, template_attributes, template_deployment, attributes, deployment)
Severity: Minor
Found in crowbar_framework/lib/schema_migration.rb - About 45 mins to fix

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

      def provided_with_enabled(feature,
                                platform = nil,
                                arch = nil,
                                check_enabled = true,
                                ignore_cloud = false,
Severity: Minor
Found in crowbar_framework/lib/crowbar/repository.rb - About 45 mins to fix

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

    def deep_update(other_hash)
      other_hash = other_hash.to_hash if other_hash.is_a?(ExtendedHash)
      other_hash = other_hash.stringify_keys

      other_hash.each_pair do |k,v|
Severity: Minor
Found in crowbar_framework/lib/utils/extended_hash.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 migrate_object has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

  def self.migrate_object(bc_name, template, all_scripts, attributes, deployment)
    attributes ||= Mash.new
    deployment ||= Mash.new

    current_schema_revision = deployment["schema-revision"]
Severity: Minor
Found in crowbar_framework/lib/schema_migration.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 element_node has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

def element_node(element)
  usage(-1) if element.nil? or element == ""

  struct = get_json("/elements/#{element}")

Severity: Minor
Found in bin/barclamp_lib.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 queue_proposal has 6 arguments (exceeds 4 allowed). Consider refactoring.
Open

    def queue_proposal(bc, inst, elements, element_order, deps, pre_cached_nodes)
Severity: Minor
Found in crowbar_framework/lib/crowbar/deployment_queue.rb - About 45 mins to fix

Consider simplifying this complex logical expression.
Open

        if ( s.crossDomain == null ) {
            parts = rurl.exec( s.url.toLowerCase() );
            s.crossDomain = !!( parts &&
                ( parts[ 1 ] !== ajaxLocParts[ 1 ] || parts[ 2 ] !== ajaxLocParts[ 2 ] ||
                    ( parts[ 3 ] || ( parts[ 1 ] === "http:" ? "80" : "443" ) ) !==
Severity: Major
Found in crowbar_framework/vendor/assets/javascripts/jquery/jquery.js - About 40 mins to fix

Consider simplifying this complex logical expression.
Open

if ( !support.opacity ) {
    jQuery.cssHooks.opacity = {
        get: function( elem, computed ) {
            // IE uses filters for opacity
            return ropacity.test( (computed && elem.currentStyle ? elem.currentStyle.filter : elem.style.filter) || "" ) ?
Severity: Major
Found in crowbar_framework/vendor/assets/javascripts/jquery/jquery.js - About 40 mins to fix

Consider simplifying this complex logical expression.
Open

    if ( support.matchesSelector && documentIsHTML &&
        ( !rbuggyMatches || !rbuggyMatches.test( expr ) ) &&
        ( !rbuggyQSA     || !rbuggyQSA.test( expr ) ) ) {

        try {
Severity: Major
Found in crowbar_framework/vendor/assets/javascripts/jquery/jquery.js - About 40 mins to fix

Consider simplifying this complex logical expression.
Open

            if ( matcher[ expando ] ) {
                // Find the next relative operator (if any) for proper handling
                j = ++i;
                for ( ; j < len; j++ ) {
                    if ( Expr.relative[ tokens[j].type ] ) {
Severity: Major
Found in crowbar_framework/vendor/assets/javascripts/jquery/jquery.js - About 40 mins to fix

Consider simplifying this complex logical expression.
Open

    if ( (!id || !cache[id] || (!pvt && !cache[id].data)) && data === undefined && typeof name === "string" ) {
        return;
    }
Severity: Major
Found in crowbar_framework/vendor/assets/javascripts/jquery/jquery.js - About 40 mins to fix

Consider simplifying this complex logical expression.
Open

    if ( o.mode === "toggle" && mode === "show" ) {
        el.from = o.to || zero;
        el.to = o.from || original;
    } else {
        el.from = o.from || ( mode === "show" ? zero : original );
Severity: Major
Found in crowbar_framework/vendor/assets/javascripts/jquery/ui.js - About 40 mins to fix

Consider simplifying this complex logical expression.
Open

        if ( tab.hasClass( "ui-state-disabled" ) ||
                // tab is already loading
                tab.hasClass( "ui-tabs-loading" ) ||
                // can't switch durning an animation
                this.running ||
Severity: Major
Found in crowbar_framework/vendor/assets/javascripts/jquery/ui.js - About 40 mins to fix

Consider simplifying this complex logical expression.
Open

            if(
                inst.options.greedy &&
                !inst.options.disabled &&
                inst.options.scope === draggable.options.scope &&
                inst.accept.call(inst.element[0], (draggable.currentItem || draggable.element)) &&
Severity: Major
Found in crowbar_framework/vendor/assets/javascripts/jquery/ui.js - About 40 mins to fix

Consider simplifying this complex logical expression.
Open

            if ( ( this.options.values.length === 2 && this.options.range === true ) &&
                    ( ( index === 0 && newVal > otherVal) || ( index === 1 && newVal < otherVal ) )
                ) {
                newVal = otherVal;
            }
Severity: Major
Found in crowbar_framework/vendor/assets/javascripts/jquery/ui.js - About 40 mins to fix

Consider simplifying this complex logical expression.
Open

                    if ( !support.rgba && value._rgba[ 3 ] !== 1 ) {
                        curElem = hook === "backgroundColor" ? elem.parentNode : elem;
                        while (
                            (backgroundColor === "" || backgroundColor === "transparent") &&
                            curElem && curElem.style
Severity: Major
Found in crowbar_framework/vendor/assets/javascripts/jquery/ui.js - About 40 mins to fix
Severity
Category
Status
Source
Language