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

  def stringify_keys!(recursive = false)
    keys.each do |key|
      value = delete(key)
      key = key.respond_to?(:to_s) ? key.to_s : key

Severity: Major
Found in crowbar_framework/lib/utils/extended_hash.rb and 1 other location - About 1 hr to fix
crowbar_framework/lib/utils/extended_hash.rb on lines 175..197

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

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 symbolize_keys!(recursive = false)
    keys.each do |key|
      value = delete(key)
      key = key.respond_to?(:to_sym) ? key.to_sym : key

Severity: Major
Found in crowbar_framework/lib/utils/extended_hash.rb and 1 other location - About 1 hr to fix
crowbar_framework/lib/utils/extended_hash.rb on lines 204..226

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

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

    function highlightWorker() {
      var end = +new Date + options.workTime;
      var foundWork = work.length;
      while (work.length) {
        if (!lines[showingFrom].stateAfter) var task = showingFrom;

Function _attachHandlers has 31 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    _attachHandlers: function(inst) {
        var stepMonths = this._get(inst, "stepMonths"),
            id = "#" + inst.id.replace( /\\\\/g, "\\" );
        inst.dpDiv.find("[data-handler]").map(function () {
            var handler = {
Severity: Minor
Found in crowbar_framework/vendor/assets/javascripts/jquery/ui.js - About 1 hr to fix

Function option has 31 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    option: function( key, value ) {
        var options = key,
            parts,
            curOption,
            i;
Severity: Minor
Found in crowbar_framework/vendor/assets/javascripts/jquery/ui.js - About 1 hr to fix

Function _destroy has 31 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    _destroy: function() {
        var contents;

        // clean up main element
        this.element
Severity: Minor
Found in crowbar_framework/vendor/assets/javascripts/jquery/ui.js - About 1 hr to fix

Function offsetString has 31 lines of code (exceeds 25 allowed). Consider refactoring.
Open

            offsetString = function(offset) {
                try {
                    return $.datepicker.parseDate($.datepicker._get(inst, "dateFormat"),
                        offset, $.datepicker._getFormatConfig(inst));
                }
Severity: Minor
Found in crowbar_framework/vendor/assets/javascripts/jquery/ui.js - About 1 hr to fix

Method node_state_valid_for_role? has 31 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def self.node_state_valid_for_role?(node, barclamp, role)
    # We always want deployer-client, both for heartbeat but also because it
    # sets up the ability to use the barclamp library
    return true if role == "deployer-client"

Severity: Minor
Found in chef/cookbooks/utils/libraries/role_recipe.rb - About 1 hr to fix

Function applyPlacement has 31 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  Tooltip.prototype.applyPlacement = function (offset, placement) {
    var $tip   = this.tip()
    var width  = $tip[0].offsetWidth
    var height = $tip[0].offsetHeight

Severity: Minor
Found in crowbar_framework/vendor/assets/javascripts/bootstrap/tooltip.js - About 1 hr to fix

Method upgrade! has 31 lines of code (exceeds 25 allowed). Consider refactoring.
Open

      def upgrade!
        if upgrading?
          return {
            status: :unprocessable_entity,
            message: I18n.t("api.crowbar.upgrade_ongoing")
Severity: Minor
Found in crowbar_framework/app/models/api/crowbar.rb - About 1 hr to fix

Method execute_scripts_and_wait_for_finish has 31 lines of code (exceeds 25 allowed). Consider refactoring.
Open

      def execute_scripts_and_wait_for_finish(nodes, script, seconds)
        nodes.each do |node|
          Rails.logger.info("Executing script '#{script}' at #{node.name}")
          ssh_status = node.ssh_cmd(script).first
          if ssh_status != 200
Severity: Minor
Found in crowbar_framework/app/models/api/upgrade.rb - About 1 hr to fix

Method keystone_migrate_and_restart has 31 lines of code (exceeds 25 allowed). Consider refactoring.
Open

      def keystone_migrate_and_restart(node)
        save_node_action("Making sure that Keystone is stopped on non-upgraded nodes")

        cluster = node[:pacemaker][:config][:environment]

Severity: Minor
Found in crowbar_framework/app/models/api/upgrade.rb - About 1 hr to fix

Method cancel has 31 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def cancel
    if Api::Upgrade.cancel
      head :ok
    else
      render json: {
Severity: Minor
Found in crowbar_framework/app/controllers/api/upgrade_controller.rb - About 1 hr to fix

Method export has 31 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def export
      @batch = Batch::Export.new(
        export_params
      )

Severity: Minor
Found in crowbar_framework/app/controllers/utils/batch_controller.rb - About 1 hr to fix

Method proposal_delete has 31 lines of code (exceeds 25 allowed). Consider refactoring.
Open

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

Severity: Minor
Found in crowbar_framework/app/controllers/barclamp_controller.rb - About 1 hr to fix

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

def proposal_show(name)
  usage(-1) if name.nil? or name == ""

  struct = get_json("/proposals/#{name}")

Severity: Major
Found in bin/barclamp_lib.rb and 1 other location - About 1 hr to fix
bin/barclamp_lib.rb on lines 241..252

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

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 show(name)
  usage(-1) if name.nil? or name == ""

  struct = get_json("/#{name}")

Severity: Major
Found in bin/barclamp_lib.rb and 1 other location - About 1 hr to fix
bin/barclamp_lib.rb on lines 286..297

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

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

jQuery.ready.promise = function( obj ) {
    if ( !readyList ) {

        readyList = jQuery.Deferred();

Severity: Minor
Found in crowbar_framework/vendor/assets/javascripts/jquery/jquery.js - About 1 hr to fix

Function handlers has 30 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    handlers: function( event, handlers ) {
        var sel, handleObj, matches, i,
            handlerQueue = [],
            delegateCount = handlers.delegateCount,
            cur = event.target;
Severity: Minor
Found in crowbar_framework/vendor/assets/javascripts/jquery/jquery.js - About 1 hr to fix

Function attr has 30 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    attr: function( elem, name, value ) {
        var hooks, ret,
            nType = elem.nodeType;

        // don't get/set attributes on text, comment and attribute nodes
Severity: Minor
Found in crowbar_framework/vendor/assets/javascripts/jquery/jquery.js - About 1 hr to fix
Severity
Category
Status
Source
Language