crowbar/crowbar-core

View on GitHub

Showing 1,006 of 6,062 total issues

Method wait_for_script_to_finish has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

  def wait_for_script_to_finish(script, seconds, args = [], enforce_timeout = false)
    cmd = script
    cmd += " " + args.join(" ") unless args.empty?

    raise "Script #{script} is not present on the node #{@node.name}." unless file_exist?(script)
Severity: Minor
Found in crowbar_framework/app/models/node.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 dl_item has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

  def dl_item(term, definition, options={})
    unless definition.blank? && options[:show_if_blank] != true
      html  = "<dt>#{options[:escape_html] != false ? (h term) : (term)}</dt>"
      dd = "<dd" + (options[:class].nil? ? "" : " class=""+options[:class]+""") + (options[:title].nil? ? "" : " title="" + options[:title]+""") + ">"
      html += "#{dd}#{options[:escape_html] != false ? (h definition) : (definition)}</dd>"
Severity: Minor
Found in crowbar_framework/app/helpers/nodes_helper.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 where has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

      def where(options = {})
        platform = options.fetch :platform, nil
        arch = options.fetch :arch, nil
        repo = options.fetch :repo, nil
        result = []
Severity: Minor
Found in crowbar_framework/lib/crowbar/repository.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

Function internalData has 47 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function internalData( elem, name, data, pvt /* Internal Use Only */ ) {
    if ( !jQuery.acceptData( elem ) ) {
        return;
    }

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

Function select has 47 lines of code (exceeds 25 allowed). Consider refactoring.
Open

select = Sizzle.select = function( selector, context, results, seed ) {
    var i, tokens, token, type, find,
        compiled = typeof selector === "function" && selector,
        match = !seed && tokenize( (selector = compiled.selector || selector) );

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

Function resize has 47 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    resize: function() {
        var that = $(this).data("ui-resizable"),
            o = that.options,
            cs = that.size,
            os = that.originalSize,
Severity: Minor
Found in crowbar_framework/vendor/assets/javascripts/jquery/ui.js - About 1 hr to fix

Function scale has 47 lines of code (exceeds 25 allowed). Consider refactoring.
Open

$.effects.effect.scale = function( o, done ) {

    // Create element
    var el = $( this ),
        options = $.extend( true, {}, o ),
Severity: Minor
Found in crowbar_framework/vendor/assets/javascripts/jquery/ui.js - About 1 hr to fix

Function registerEvents has 47 lines of code (exceeds 25 allowed). Consider refactoring.
Open

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

    $('.dropzone .delete').live('click', function(event) {
      event.preventDefault();
Severity: Minor
Found in crowbar_framework/vendor/assets/javascripts/jquery/nodeList.js - About 1 hr to fix

Method unique_name has 47 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        def unique_name
          # check first if we have already a claimed disk which points to the same
          # device node. if so, use that as "unique name"
          already_claimed_name = self.unique_name_already_claimed_by
          unless already_claimed_name.nil?
Severity: Minor
Found in chef/cookbooks/barclamp/libraries/barclamp_library.rb - About 1 hr to fix

Method node_detail_software has 47 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def node_detail_software
    @node_detail_software ||= begin
      [].tap do |result|
        result.push [
          t("model.attributes.node.name"),
Severity: Minor
Found in crowbar_framework/app/helpers/nodes_helper.rb - About 1 hr to fix

Function tokenize has 46 lines of code (exceeds 25 allowed). Consider refactoring.
Open

tokenize = Sizzle.tokenize = function( selector, parseOnly ) {
    var matched, match, tokens, type,
        soFar, groups, preFilters,
        cached = tokenCache[ selector + " " ];

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

Function matcherFromTokens has 46 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function matcherFromTokens( tokens ) {
    var checkContext, matcher, j,
        len = tokens.length,
        leadingRelative = Expr.relative[ tokens[0].type ],
        implicitRelative = leadingRelative || Expr.relative[" "],
Severity: Minor
Found in crowbar_framework/vendor/assets/javascripts/jquery/jquery.js - About 1 hr to fix

Function _generatePosition has 46 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    _generatePosition: function(event) {

        var top, left,
            o = this.options,
            pageX = event.pageX,
Severity: Minor
Found in crowbar_framework/vendor/assets/javascripts/jquery/ui.js - About 1 hr to fix

Function processGroups has 46 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  LedUpdate.prototype.processGroups = function(response, ignores) {
    var self   = this;
    var reload = false;
    $('[data-group]').each(function(index, current) {
      var current_handle = $(current).data('group');
Severity: Minor
Found in crowbar_framework/vendor/assets/javascripts/jquery/ledUpdate.js - About 1 hr to fix

Function fold has 46 lines of code (exceeds 25 allowed). Consider refactoring.
Open

$.effects.effect.fold = function( o, done ) {

    // Create element
    var el = $( this ),
        props = [ "position", "top", "bottom", "left", "right", "height", "width" ],
Severity: Minor
Found in crowbar_framework/vendor/assets/javascripts/jquery/ui.js - About 1 hr to fix

Function slide has 46 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  Carousel.prototype.slide = function (type, next) {
    var $active   = this.$element.find('.item.active')
    var $next     = next || this.getItemForDirection(type, $active)
    var isCycling = this.interval
    var direction = type == 'next' ? 'left' : 'right'
Severity: Minor
Found in crowbar_framework/vendor/assets/javascripts/bootstrap/carousel.js - About 1 hr to fix

Method proposal_commit has 46 lines of code (exceeds 25 allowed). Consider refactoring.
Open

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

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

Function _tabKeydown has 45 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    _tabKeydown: function( event ) {
        /*jshint maxcomplexity:15*/
        var focusedTab = $( this.document[0].activeElement ).closest( "li" ),
            selectedIndex = this.tabs.index( focusedTab ),
            goingForward = true;
Severity: Minor
Found in crowbar_framework/vendor/assets/javascripts/jquery/ui.js - About 1 hr to fix

Function _mouseStart has 44 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    _mouseStart: function(event) {

        var o = this.options;

        //Create and append the visible helper
Severity: Minor
Found in crowbar_framework/vendor/assets/javascripts/jquery/ui.js - About 1 hr to fix

Function _setContainment has 44 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    _setContainment: function() {

        var over, c, ce,
            o = this.options;

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