crowbar/crowbar-core

View on GitHub

Showing 6,062 of 6,062 total issues

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

  describe "POST role" do
    context "for existent node" do
      it "assignes role compute" do
        expect_any_instance_of(Node).to receive(:intended_role=).with("compute")

crowbar_framework/spec/controllers/machines_controller_spec.rb on lines 149..170

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 80.

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

Function readInput has 52 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    function readInput() {
      if (leaveInputAlone) return;
      var changed = false, text = input.value, sr = selRange(input);
      if (!sr) return false;
      var changed = editing.text != text, rs = reducedSelection;
Severity: Major
Found in crowbar_framework/vendor/assets/javascripts/codemirror/codemirror.js - About 2 hrs to fix

Function keydown has 52 lines of code (exceeds 25 allowed). Consider refactoring.
Open

            keydown: function( event ) {
                /*jshint maxcomplexity:15*/
                if ( this.element.prop( "readOnly" ) ) {
                    suppressKeyPress = true;
                    suppressInput = true;
Severity: Major
Found in crowbar_framework/vendor/assets/javascripts/jquery/ui.js - About 2 hrs to fix

Function _refreshValue has 52 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    _refreshValue: function() {
        var lastValPercent, valPercent, value, valueMin, valueMax,
            oRange = this.options.range,
            o = this.options,
            that = this,
Severity: Major
Found in crowbar_framework/vendor/assets/javascripts/jquery/ui.js - About 2 hrs to fix

Function _processTabs has 52 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    _processTabs: function() {
        var that = this;

        this.tablist = this._getList()
            .addClass( "ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all" )
Severity: Major
Found in crowbar_framework/vendor/assets/javascripts/jquery/ui.js - About 2 hrs to fix

Method node_barclamp_list has 52 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def node_barclamp_list(node)
    all_proposals = Proposal.all

    list_items = ActiveSupport::OrderedHash.new.tap do |listing|
      node_barclamps(node).map do |role|
Severity: Major
Found in crowbar_framework/app/helpers/nodes_helper.rb - About 2 hrs to fix

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

                    if(!p.width()) { p.width(that.currentItem.innerWidth() - parseInt(that.currentItem.css("paddingLeft")||0, 10) - parseInt(that.currentItem.css("paddingRight")||0, 10)); }
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 4763..4763

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 76.

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 4 locations. Consider refactoring.
Open

  case 17:this.$ = new yy.MustacheNode($$[$0-1][0], $$[$0-1][1], $$[$0-2], stripFlags($$[$0-2], $$[$0]));
  break;
crowbar_framework/vendor/assets/javascripts/misc/handlebars.js on lines 720..721
crowbar_framework/vendor/assets/javascripts/misc/handlebars.js on lines 724..725
crowbar_framework/vendor/assets/javascripts/misc/handlebars.js on lines 726..727

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 76.

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 4 locations. Consider refactoring.
Open

  case 21:this.$ = new yy.MustacheNode($$[$0-1][0], $$[$0-1][1], $$[$0-2], stripFlags($$[$0-2], $$[$0]));
  break;
crowbar_framework/vendor/assets/javascripts/misc/handlebars.js on lines 718..719
crowbar_framework/vendor/assets/javascripts/misc/handlebars.js on lines 720..721
crowbar_framework/vendor/assets/javascripts/misc/handlebars.js on lines 724..725

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 76.

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(!p.height()) { p.height(that.currentItem.innerHeight() - parseInt(that.currentItem.css("paddingTop")||0, 10) - parseInt(that.currentItem.css("paddingBottom")||0, 10)); }
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 4764..4764

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 76.

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 4 locations. Consider refactoring.
Open

  case 18:this.$ = new yy.MustacheNode($$[$0-1][0], $$[$0-1][1], $$[$0-2], stripFlags($$[$0-2], $$[$0]));
  break;
crowbar_framework/vendor/assets/javascripts/misc/handlebars.js on lines 718..719
crowbar_framework/vendor/assets/javascripts/misc/handlebars.js on lines 724..725
crowbar_framework/vendor/assets/javascripts/misc/handlebars.js on lines 726..727

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 76.

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 4 locations. Consider refactoring.
Open

  case 20:this.$ = new yy.MustacheNode($$[$0-1][0], $$[$0-1][1], $$[$0-2], stripFlags($$[$0-2], $$[$0]));
  break;
crowbar_framework/vendor/assets/javascripts/misc/handlebars.js on lines 718..719
crowbar_framework/vendor/assets/javascripts/misc/handlebars.js on lines 720..721
crowbar_framework/vendor/assets/javascripts/misc/handlebars.js on lines 726..727

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 76.

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

Function onMouseDown has 51 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    function onMouseDown(e) {
      var ld = lastDoubleClick; lastDoubleClick = null;
      // First, see if this is a click in the gutter
      for (var n = e.target(); n != wrapper; n = n.parentNode)
        if (n.parentNode == gutterText) {
Severity: Major
Found in crowbar_framework/vendor/assets/javascripts/codemirror/codemirror.js - About 2 hrs to fix

Function remove has 51 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    remove: function( elem, types, handler, selector, mappedTypes ) {
        var j, handleObj, tmp,
            origCount, t, events,
            special, handlers, type,
            namespaces, origType,
Severity: Major
Found in crowbar_framework/vendor/assets/javascripts/jquery/jquery.js - About 2 hrs to fix

Function retrieveAllocated has 51 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  NodeList.prototype.retrieveAllocated = function() {
    var self = this;

    $.each(self.json.elements, function(role, nodes) {
      var $role = $(self.dataBag.roleTarget.format(role));
Severity: Major
Found in crowbar_framework/vendor/assets/javascripts/jquery/nodeList.js - About 2 hrs to fix

Method unique_device_for has 51 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def unique_device_for(device)
    # check first if we have already a claimed disk which points to the same
    # device node. if so, use that as "unique device"
    already_claimed_name = self.unique_name_already_claimed_by(device)
    unless already_claimed_name.nil?
Severity: Major
Found in crowbar_framework/app/models/node.rb - About 2 hrs to fix

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

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

    node = Node.find_by_name(name)
    if node.allocated? && !node.role?("logging-server")
Severity: Major
Found in crowbar_framework/app/models/logging_service.rb and 1 other location - About 2 hrs to fix
crowbar_framework/app/models/ntp_service.rb on lines 55..71

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 78.

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

  def proposal_reset
    code, message = @service_object.reset_proposal(
      params[:id]
    )

Severity: Major
Found in crowbar_framework/app/controllers/barclamp_controller.rb and 1 other location - About 2 hrs to fix
crowbar_framework/app/controllers/barclamp_controller.rb on lines 816..849

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 78.

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

  def proposal_dequeue
    code, message = @service_object.dequeue_proposal(
      params[:id]
    )

Severity: Major
Found in crowbar_framework/app/controllers/barclamp_controller.rb and 1 other location - About 2 hrs to fix
crowbar_framework/app/controllers/barclamp_controller.rb on lines 772..805

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 78.

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

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

    node = Node.find_by_name(name)
    if node.allocated? && !node.role?("ntp-server")
Severity: Major
Found in crowbar_framework/app/models/ntp_service.rb and 1 other location - About 2 hrs to fix
crowbar_framework/app/models/logging_service.rb on lines 55..71

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 78.

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