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

        if (that._helper && !o.animate && (/relative/).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 3564..3566

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

Class Disk has 25 methods (exceeds 20 allowed). Consider refactoring.
Open

      class Disk
        attr_reader :device
        def initialize(node,name)
          # comes from ohai, and can e.g. "hda", "sda", or "cciss!c0d0"
          @device = name
Severity: Minor
Found in chef/cookbooks/barclamp/libraries/barclamp_library.rb - About 2 hrs to fix

Class BarclampController has 25 methods (exceeds 20 allowed). Consider refactoring.
Open

class BarclampController < ApplicationController
  wrap_parameters false

  skip_before_filter :enforce_installer, if: proc { Crowbar::Installer.initial_chef_client? }
  skip_before_filter :upgrade, only: [:transition]
Severity: Minor
Found in crowbar_framework/app/controllers/barclamp_controller.rb - About 2 hrs to fix

Class Attribute has 25 methods (exceeds 20 allowed). Consider refactoring.
Open

    class Attribute
      attr_accessor :attrs
      attr_accessor :proposal
      attr_accessor :view
      attr_accessor :attribute
Severity: Minor
Found in crowbar_framework/lib/dsl/proposal/attribute.rb - About 2 hrs to fix

Function _contactContainers has 70 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    _contactContainers: function(event) {
        var i, j, dist, itemWithLeastDistance, posProperty, sizeProperty, base, cur, nearBottom, floating,
            innermostContainer = null,
            innermostIndex = null;

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

Method bootstrap_ensure_proposal has 70 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def bootstrap_ensure_proposal(bc, override_attr_path)
    Rails.logger.info("Bootstrap: ensure proposal for bc: #{bc}, name: #{override_attr_path}")

    unless override_attr_path == "default" || File.exist?(override_attr_path)
      msg = "Cannot ensure proposal for #{bc} exists: #{override_attr_path} does not exist."
Severity: Major
Found in crowbar_framework/app/models/crowbar_service.rb - About 2 hrs to fix

Function statusCheck has 69 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  function statusCheck() {
    $.ajax({
      type: "GET",
      dataType: "json",
      url: Routes.status_installer_path(),
Severity: Major
Found in crowbar_framework/app/assets/javascripts/installer.js - About 2 hrs to fix

Method find_node_boot_mac_addresses has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
Open

def find_node_boot_mac_addresses(node, admin_data_net)
  # If we don't have an admin IP allocated yet, using node.macaddress is
  # our best guess for the boot macaddress.
  if admin_data_net.nil? || \
      admin_data_net.interface_list.nil?
Severity: Minor
Found in chef/cookbooks/provisioner/recipes/update_nodes.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 bootstrap_ensure_proposal has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
Open

  def bootstrap_ensure_proposal(bc, override_attr_path)
    Rails.logger.info("Bootstrap: ensure proposal for bc: #{bc}, name: #{override_attr_path}")

    unless override_attr_path == "default" || File.exist?(override_attr_path)
      msg = "Cannot ensure proposal for #{bc} exists: #{override_attr_path} does not exist."
Severity: Minor
Found in crowbar_framework/app/models/crowbar_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

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

    pageY: function() {
      if (this.e.pageY != null) return this.e.pageY;
      var doc = this.target().ownerDocument;
      return this.e.clientY + doc.body.scrollTop + doc.documentElement.scrollTop;
    }
crowbar_framework/vendor/assets/javascripts/codemirror/codemirror.js on lines 1926..1930

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

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

    pageX: function() {
      if (this.e.pageX != null) return this.e.pageX;
      var doc = this.target().ownerDocument;
      return this.e.clientX + doc.body.scrollLeft + doc.documentElement.scrollLeft;
    },
crowbar_framework/vendor/assets/javascripts/codemirror/codemirror.js on lines 1931..1935

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

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

Method reset_pk_sequence! has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
Open

        def reset_pk_sequence!(table, pk = nil, sequence = nil) #:nodoc:
          unless pk and sequence
            default_pk, default_sequence = pk_and_sequence_for(table)

            pk ||= default_pk

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

Function updateDisplay has 68 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    function updateDisplay(changes) {
      if (!scroller.clientWidth) {
        showingFrom = showingTo = 0;
        return;
      }
Severity: Major
Found in crowbar_framework/vendor/assets/javascripts/codemirror/codemirror.js - About 2 hrs to fix

Function matcherFromGroupMatchers has 68 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function matcherFromGroupMatchers( elementMatchers, setMatchers ) {
    var bySet = setMatchers.length > 0,
        byElement = elementMatchers.length > 0,
        superMatcher = function( seed, context, xml, results, outermost ) {
            var elem, j, matcher,
Severity: Major
Found in crowbar_framework/vendor/assets/javascripts/jquery/jquery.js - About 2 hrs to fix

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

  def activate
    return render_not_found if params[:platform].nil? || params[:arch].nil? || params[:repo].nil?
    ret, _message = ProvisionerService.new.enable_repository(
      params[:platform],
      params[:arch],
Severity: Major
Found in crowbar_framework/app/controllers/repositories_controller.rb and 1 other location - About 2 hrs to fix
crowbar_framework/app/controllers/repositories_controller.rb on lines 143..164

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

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 deactivate
    return render_not_found if params[:platform].nil? || params[:arch].nil? || params[:repo].nil?
    ret, _message = ProvisionerService.new.disable_repository(
      params[:platform],
      params[:arch],
Severity: Major
Found in crowbar_framework/app/controllers/repositories_controller.rb and 1 other location - About 2 hrs to fix
crowbar_framework/app/controllers/repositories_controller.rb on lines 108..129

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

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 done has 67 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        function done( status, nativeStatusText, responses, headers ) {
            var isSuccess, success, error, response, modified,
                statusText = nativeStatusText;

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

Function _open has 67 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    _open: function( event, target, content ) {
        var tooltip, events, delayedShow,
            positionOption = $.extend( {}, this.options.position );

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

Method transition has 67 lines of code (exceeds 25 allowed). Consider refactoring.
Open

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

    # we need one state before "installed" (and after allocation) because we
    # need the node to have the admin network fully defined for
Severity: Major
Found in crowbar_framework/app/models/network_service.rb - About 2 hrs to fix

Function setMatcher has 66 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postSelector ) {
    if ( postFilter && !postFilter[ expando ] ) {
        postFilter = setMatcher( postFilter );
    }
    if ( postFinder && !postFinder[ expando ] ) {
Severity: Major
Found in crowbar_framework/vendor/assets/javascripts/jquery/jquery.js - About 2 hrs to fix
Severity
Category
Status
Source
Language