crowbar/crowbar-core

View on GitHub

Showing 6,062 of 6,062 total issues

Function hook has 41 lines of code (exceeds 25 allowed). Consider refactoring.
Open

color.hook = function( hook ) {
    var hooks = hook.split( " " );
    each( hooks, function( i, hook ) {
        jQuery.cssHooks[ hook ] = {
            set: function( elem, value ) {
Severity: Minor
Found in crowbar_framework/vendor/assets/javascripts/jquery/ui.js - About 1 hr to fix

Function renderButton has 41 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        renderButton: function (type) {
            var self = this, tmplt = self.getLayoutTemplate('btnDefault'), css = self[type + 'Class'],
                title = self[type + 'Title'], icon = self[type + 'Icon'], label = self[type + 'Label'],
                status = self.isDisabled ? ' disabled' : '', btnType = 'button';
            switch (type) {
Severity: Minor
Found in crowbar_framework/vendor/assets/javascripts/bootstrap/fileinput.js - About 1 hr to fix

Function setupParams has 41 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    setupParams: function(paramSize, params, useRegister) {
      var options = [], contexts = [], types = [], param, inverse, program;

      options.push("hash:" + this.popStack());

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

Function upload has 41 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        upload: function () {
            var self = this, totLen = self.getFileStack().length, params = {},
                i, outData, len, hasExtraData = !$.isEmptyObject(self.getExtraData());
            if (self.minFileCount > 0 && self.getFileCount(totLen) < self.minFileCount) {
                self.noFilesError(params);
Severity: Minor
Found in crowbar_framework/vendor/assets/javascripts/bootstrap/fileinput.js - About 1 hr to fix

Method start has 41 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def start
      header = :ok
      msg = ""
      msg_type = :alert

Function extend has 40 lines of code (exceeds 25 allowed). Consider refactoring.
Open

jQuery.extend = jQuery.fn.extend = function() {
    var src, copyIsArray, copy, name, options, clone,
        target = arguments[0] || {},
        i = 1,
        length = arguments.length,
Severity: Minor
Found in crowbar_framework/vendor/assets/javascripts/jquery/jquery.js - About 1 hr to fix

Function stop has 40 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    stop: function( type, clearQueue, gotoEnd ) {
        var stopQueue = function( hooks ) {
            var stop = hooks.stop;
            delete hooks.stop;
            stop( gotoEnd );
Severity: Minor
Found in crowbar_framework/vendor/assets/javascripts/jquery/jquery.js - About 1 hr to fix

Function val has 40 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    val: function( value ) {
        var hooks, ret, isFunction,
            elem = this[0];

        if ( !arguments.length ) {
Severity: Minor
Found in crowbar_framework/vendor/assets/javascripts/jquery/jquery.js - About 1 hr to fix

Function on has 40 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    on: function( types, selector, data, fn, /*INTERNAL*/ one ) {
        var type, origFn;

        // Types can be a map of types/handlers
        if ( typeof types === "object" ) {
Severity: Minor
Found in crowbar_framework/vendor/assets/javascripts/jquery/jquery.js - About 1 hr to fix

Function _attachments has 40 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    _attachments: function(input, inst) {
        var showOn, buttonText, buttonImage,
            appendText = this._get(inst, "appendText"),
            isRTL = this._get(inst, "isRTL");

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

Method restore_chef has 40 lines of code (exceeds 25 allowed). Consider refactoring.
Open

      def restore_chef
        Rails.logger.debug "Restoring chef backup files"

        begin
          [:nodes, :roles, :clients, :databags].each do |type|
Severity: Minor
Found in crowbar_framework/lib/crowbar/backup/restore.rb - About 1 hr to fix

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

            lookAhead = function(match) {
                var matches = (iFormat + 1 < format.length && format.charAt(iFormat + 1) === match);
                if (matches) {
                    iFormat++;
                }
Severity: Major
Found in crowbar_framework/vendor/assets/javascripts/jquery/ui.js and 2 other locations - About 1 hr to fix
crowbar_framework/vendor/assets/javascripts/jquery/ui.js on lines 7893..7899
crowbar_framework/vendor/assets/javascripts/jquery/ui.js on lines 8086..8092

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

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

def authenticate(req, uri, data = nil, limit = 10)
  uri.user = @username
  uri.password = @password

  h = Net::HTTP.new uri.host, uri.port
Severity: Minor
Found in bin/barclamp_lib.rb - About 1 hr to fix

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

            lookAhead = function(match) {
                var matches = (iFormat + 1 < format.length && format.charAt(iFormat + 1) === match);
                if (matches) {
                    iFormat++;
                }
Severity: Major
Found in crowbar_framework/vendor/assets/javascripts/jquery/ui.js and 2 other locations - About 1 hr to fix
crowbar_framework/vendor/assets/javascripts/jquery/ui.js on lines 7893..7899
crowbar_framework/vendor/assets/javascripts/jquery/ui.js on lines 8168..8174

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

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

                co.left + (parseInt($(ce).css("borderLeftWidth"),10) || 0) + (parseInt($(ce).css("paddingLeft"),10) || 0) - this.margins.left,
Severity: Major
Found in crowbar_framework/vendor/assets/javascripts/jquery/ui.js and 1 other location - About 1 hr to fix
crowbar_framework/vendor/assets/javascripts/jquery/ui.js on lines 5006..5006

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

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

                co.top + (parseInt($(ce).css("borderTopWidth"),10) || 0) + (parseInt($(ce).css("paddingTop"),10) || 0) - this.margins.top,
Severity: Major
Found in crowbar_framework/vendor/assets/javascripts/jquery/ui.js and 1 other location - About 1 hr to fix
crowbar_framework/vendor/assets/javascripts/jquery/ui.js on lines 5005..5005

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

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

            lookAhead = function(match) {
                var matches = (iFormat + 1 < format.length && format.charAt(iFormat + 1) === match);
                if (matches) {
                    iFormat++;
                }
Severity: Major
Found in crowbar_framework/vendor/assets/javascripts/jquery/ui.js and 2 other locations - About 1 hr to fix
crowbar_framework/vendor/assets/javascripts/jquery/ui.js on lines 8086..8092
crowbar_framework/vendor/assets/javascripts/jquery/ui.js on lines 8168..8174

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

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 parse_address has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

    def self.parse_address(a)
      addr,subnet = a.split("/",2)
      if addr.kind_of?(String) && (addr =~ MATCH_RE)
        addr = addr.split(".").map do |i|
          i = i.to_i
Severity: Minor
Found in chef/cookbooks/barclamp/libraries/ip.rb - About 1 hr 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 wait_for_reboot has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

  def wait_for_reboot(node)
    nobj = Node.find_by_name(node)
    if nobj[:crowbar_wall][:wait_for_reboot]
      puts "Waiting for reboot of node #{node}"
      if RemoteNode.ready?(node, 1200)
Severity: Minor
Found in crowbar_framework/app/models/service_object.rb - About 1 hr 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 status has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

  def status
    bc = item["deployment"][self.barclamp]
    if bc.nil?
      "hold"
    else
Severity: Minor
Found in crowbar_framework/app/models/proposal.rb - About 1 hr 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

Severity
Category
Status
Source
Language