crowbar/crowbar-core

View on GitHub

Showing 6,062 of 6,062 total issues

Function buildFragment has 74 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    buildFragment: function( elems, context, scripts, selection ) {
        var j, elem, contains,
            tmp, tag, tbody, wrap,
            l = elems.length,

Severity: Major
Found in crowbar_framework/vendor/assets/javascripts/jquery/jquery.js - About 2 hrs to fix

Function _mouseDrag has 74 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    _mouseDrag: function(event) {

        this.dragged = true;

        if (this.options.disabled) {
Severity: Major
Found in crowbar_framework/vendor/assets/javascripts/jquery/ui.js - About 2 hrs to fix

Function Datepicker has 74 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function Datepicker() {
    this._curInst = null; // The current instance in use
    this._keyEvent = false; // If the last event was a key event
    this._disabledInputs = []; // List of date picker inputs that have been disabled
    this._datepickerShowing = false; // True if the popup picker is showing , false if not
Severity: Major
Found in crowbar_framework/vendor/assets/javascripts/jquery/ui.js - About 2 hrs to fix

File upgrade_controller_spec.rb has 290 lines of code (exceeds 250 allowed). Consider refactoring.
Open

require "spec_helper"

describe Api::UpgradeController, type: :request do
  context "with a successful upgrade API request" do
    let(:headers) { { ACCEPT: "application/vnd.crowbar.v2.0+json" } }
Severity: Minor
Found in crowbar_framework/spec/controllers/api/upgrade_controller_spec.rb - About 2 hrs to fix

Function add has 73 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    add: function( elem, types, handler, data, selector ) {
        var tmp, events, t, handleObjIn,
            special, eventHandle, handleObj,
            handlers, type, namespaces, origType,
            elemData = jQuery._data( elem );
Severity: Major
Found in crowbar_framework/vendor/assets/javascripts/jquery/jquery.js - About 2 hrs to fix

Function _create has 73 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    _create: function() {
        this.activeMenu = this.element;
        // flag used to prevent firing of the click handler
        // as the event bubbles up through nested menus
        this.mouseHandled = false;
Severity: Major
Found in crowbar_framework/vendor/assets/javascripts/jquery/ui.js - About 2 hrs to fix

Function write has 73 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  JsonAttribute.prototype.write = function(key, value, type) {
    switch (type) {
      case 'boolean':
        value = value.toLowerCase() == 'true';
        break;
Severity: Major
Found in crowbar_framework/vendor/assets/javascripts/jquery/jsonAttribute.js - About 2 hrs to fix

Method transition has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
Open

  def transition(inst, name, state)
    Rails.logger.debug("Provisioner transition: entering:  #{name} for #{state}")

    # hardware-installing for the bootdisk finder
    if ["hardware-installing", "installed", "readying"].include? state
Severity: Minor
Found in crowbar_framework/app/models/provisioner_service.rb - About 2 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 verify_claimed_disks has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
Open

  def verify_claimed_disks
    unreferenced_disks = Array.new
    crowbar_wall[:claimed_disks].each do |disk, _claim|
      path, device_name = disk.split("/")[-2..-1]

Severity: Minor
Found in crowbar_framework/app/models/node.rb - About 2 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

Similar blocks of code found in 3 locations. Consider refactoring.
Open

    it "fails when there are four clusters" do
      allow(Api::Crowbar).to(receive(:addon_installed?).and_return(true))
      allow(NodeObject).to(receive(:find).with(
        "pacemaker_founder:true AND pacemaker_config_environment:*"
      ).and_return([node]))
Severity: Major
Found in crowbar_framework/spec/models/api/crowbar_spec.rb and 2 other locations - About 2 hrs to fix
crowbar_framework/spec/models/api/crowbar_spec.rb on lines 336..360
crowbar_framework/spec/models/api/crowbar_spec.rb on lines 363..387

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 105.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 3 locations. Consider refactoring.
Open

    it "succeeds when there are two clusters and one is dedicated to neutron" do
      allow(Api::Crowbar).to(receive(:addon_installed?).and_return(true))
      allow(NodeObject).to(receive(:find).with(
        "pacemaker_founder:true AND pacemaker_config_environment:*"
      ).and_return([node]))
Severity: Major
Found in crowbar_framework/spec/models/api/crowbar_spec.rb and 2 other locations - About 2 hrs to fix
crowbar_framework/spec/models/api/crowbar_spec.rb on lines 255..279
crowbar_framework/spec/models/api/crowbar_spec.rb on lines 282..306

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 105.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 3 locations. Consider refactoring.
Open

    it "succeeds when there are two clusters and one is dedicated to db" do
      allow(Api::Crowbar).to(receive(:addon_installed?).and_return(true))
      allow(NodeObject).to(receive(:find).with(
        "pacemaker_founder:true AND pacemaker_config_environment:*"
      ).and_return([node]))
Severity: Major
Found in crowbar_framework/spec/models/api/crowbar_spec.rb and 2 other locations - About 2 hrs to fix
crowbar_framework/spec/models/api/crowbar_spec.rb on lines 228..252
crowbar_framework/spec/models/api/crowbar_spec.rb on lines 282..306

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 105.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 3 locations. Consider refactoring.
Open

    it "fails when there are two clusters and roles assignment does not match supported patterns" do
      allow(Api::Crowbar).to(receive(:addon_installed?).and_return(true))
      allow(NodeObject).to(receive(:find).with(
        "pacemaker_founder:true AND pacemaker_config_environment:*"
      ).and_return([node]))
Severity: Major
Found in crowbar_framework/spec/models/api/crowbar_spec.rb and 2 other locations - About 2 hrs to fix
crowbar_framework/spec/models/api/crowbar_spec.rb on lines 309..333
crowbar_framework/spec/models/api/crowbar_spec.rb on lines 336..360

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 105.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 3 locations. Consider refactoring.
Open

    it "succeeds when there are three clusters and they are db+apis+network" do
      allow(Api::Crowbar).to(receive(:addon_installed?).and_return(true))
      allow(NodeObject).to(receive(:find).with(
        "pacemaker_founder:true AND pacemaker_config_environment:*"
      ).and_return([node]))
Severity: Major
Found in crowbar_framework/spec/models/api/crowbar_spec.rb and 2 other locations - About 2 hrs to fix
crowbar_framework/spec/models/api/crowbar_spec.rb on lines 228..252
crowbar_framework/spec/models/api/crowbar_spec.rb on lines 255..279

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 105.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 3 locations. Consider refactoring.
Open

    it "fails when there are three clusters and db/api/network roles are mixed" do
      allow(Api::Crowbar).to(receive(:addon_installed?).and_return(true))
      allow(NodeObject).to(receive(:find).with(
        "pacemaker_founder:true AND pacemaker_config_environment:*"
      ).and_return([node]))
Severity: Major
Found in crowbar_framework/spec/models/api/crowbar_spec.rb and 2 other locations - About 2 hrs to fix
crowbar_framework/spec/models/api/crowbar_spec.rb on lines 309..333
crowbar_framework/spec/models/api/crowbar_spec.rb on lines 363..387

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 105.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

File restore.rb has 287 lines of code (exceeds 250 allowed). Consider refactoring.
Open

module Crowbar
  class Backup
    class Restore
      attr_accessor :backup, :version

Severity: Minor
Found in crowbar_framework/lib/crowbar/backup/restore.rb - About 2 hrs to fix

Function widget has 72 lines of code (exceeds 25 allowed). Consider refactoring.
Open

$.widget = function( name, base, prototype ) {
    var fullName, existingConstructor, constructor, basePrototype,
        // proxiedPrototype allows the provided prototype to remain unmodified
        // so that it can be used as a mixin for multiple widgets (#8876)
        proxiedPrototype = {},
Severity: Major
Found in crowbar_framework/vendor/assets/javascripts/jquery/ui.js - About 2 hrs to fix

Identical blocks of code found in 2 locations. Consider refactoring.
Open

        $.extend(this.offset, {
            click: { //Where the click happened, relative to the element
                left: event.pageX - this.offset.left,
                top: event.pageY - this.offset.top
            },
Severity: Major
Found in crowbar_framework/vendor/assets/javascripts/jquery/ui.js and 1 other location - About 2 hrs to fix
crowbar_framework/vendor/assets/javascripts/jquery/ui.js on lines 1597..1604

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 92.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Identical blocks of code found in 2 locations. Consider refactoring.
Open

        $.extend(this.offset, {
            click: { //Where the click happened, relative to the element
                left: event.pageX - this.offset.left,
                top: event.pageY - this.offset.top
            },
Severity: Major
Found in crowbar_framework/vendor/assets/javascripts/jquery/ui.js and 1 other location - About 2 hrs to fix
crowbar_framework/vendor/assets/javascripts/jquery/ui.js on lines 4165..4172

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 92.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

        if (that._helper && !o.animate && (/static/).test(ce.css("position"))) {
            $(this).css({ left: ho.left - cop.left - co.left, width: w, height: h });
        }
Severity: Major
Found in crowbar_framework/vendor/assets/javascripts/jquery/ui.js and 1 other location - About 2 hrs to fix
crowbar_framework/vendor/assets/javascripts/jquery/ui.js on lines 3560..3562

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 92.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Severity
Category
Status
Source
Language