crowbar/crowbar-core

View on GitHub

Showing 1,006 of 6,062 total issues

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

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

    $.fn.sparkline = function (userValues, userOptions) {
      return this.each(function () {
        var options = new $.fn.sparkline.options(this, userOptions),
          $this = $(this),
          render, i;
Severity: Major
Found in crowbar_framework/vendor/assets/javascripts/jquery/sparkline.js - About 2 hrs to fix

File role_object.rb has 275 lines of code (exceeds 250 allowed). Consider refactoring.
Open

require "ostruct"

class RoleObject < ChefObject
  self.chef_type = "role"

Severity: Minor
Found in crowbar_framework/app/models/role_object.rb - About 2 hrs to fix

Method node_architectures has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
Open

      def node_architectures
        {}.tap do |ret|
          ::Node.all.each do |node|
            arch = node.architecture
            ret["os"] ||= []
Severity: Minor
Found in crowbar_framework/app/models/api/node.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

File application.js has 274 lines of code (exceeds 250 allowed). Consider refactoring.
Open

//= require_self

jQuery(document).ready(function($) {
  $('textarea.editor').each(function() {
    var cm = CodeMirror.fromTextArea(this, {
Severity: Minor
Found in crowbar_framework/app/assets/javascripts/application.js - About 2 hrs to fix

File ip.rb has 274 lines of code (exceeds 250 allowed). Consider refactoring.
Open

class IP
  include Comparable
  protected

  # Translate a CIDR subnet specification into a bitfield
Severity: Minor
Found in chef/cookbooks/barclamp/libraries/ip.rb - About 2 hrs to fix

Function bounce has 64 lines of code (exceeds 25 allowed). Consider refactoring.
Open

$.effects.effect.bounce = function( o, done ) {
    var el = $( this ),
        props = [ "position", "top", "bottom", "left", "right", "height", "width" ],

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

Function template has 64 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  function template(templateSpec, env) {
    if (!env) {
      throw new Error("No environment passed to template");
    }

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

Method make_zone has 64 lines of code (exceeds 25 allowed). Consider refactoring.
Open

def make_zone(zone)
  # copy over SOA records that we have not overridden
  populate_soa zone
  zonefile_entries=Array.new
  Chef::Log.debug "Processing zone: #{zone.inspect}"
Severity: Major
Found in chef/cookbooks/bind9/recipes/default.rb - About 2 hrs to fix

Method switch has 64 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def switch
    @port_start = 1
    @sum = 0
    @vports = {}
    @groups = {}
Severity: Major
Found in crowbar_framework/app/controllers/network_controller.rb - About 2 hrs to fix

Function updateLinesNoUndo has 63 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    function updateLinesNoUndo(from, to, newText, selFrom, selTo) {
      var recomputeMaxLength = false, maxLineLength = maxLine.length;
      for (var i = from.line; i <= to.line; ++i) {
        if (lines[i].text.length == maxLineLength) {recomputeMaxLength = true; break;}
      }
Severity: Major
Found in crowbar_framework/vendor/assets/javascripts/codemirror/codemirror.js - About 2 hrs to fix

Function SearchCursor has 63 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    function SearchCursor(query, pos, caseFold) {
      this.atOccurrence = false;
      if (caseFold == null) caseFold = typeof query == "string" && query == query.toLowerCase();

      if (pos && typeof pos == "object") pos = clipPos(pos);
Severity: Major
Found in crowbar_framework/vendor/assets/javascripts/codemirror/codemirror.js - About 2 hrs to fix

Function getHTML has 63 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    getHTML: function(sfrom, sto, includePre, endAt) {
      var html = [];
      if (includePre)
        html.push(this.className ? '<pre class="' + this.className + '">': "<pre>");
      function span(text, style) {
Severity: Major
Found in crowbar_framework/vendor/assets/javascripts/codemirror/codemirror.js - About 2 hrs to fix

Method node_role_list has 63 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def node_role_list(node)
    all_roles     = RoleObject.all
    all_proposals = Proposal.all

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

File service_object_spec.rb has 271 lines of code (exceeds 250 allowed). Consider refactoring.
Open

require "spec_helper"

describe ServiceObject do
  let(:service_object) { so = ServiceObject.new(Logger.new("/dev/null")); so.bc_name = "crowbar"; so }
  let(:proposal) { Proposal.where(barclamp: "crowbar", name:"default").first_or_create(barclamp: "crowbar", name: "default") }
Severity: Minor
Found in crowbar_framework/spec/models/service_object_spec.rb - About 2 hrs to fix

Class UcsController has 23 methods (exceeds 20 allowed). Consider refactoring.
Open

class UcsController < ApplicationController
  CREDENTIALS_XML_PATH = "/etc/crowbar/cisco-ucs/credentials.xml"
  COMPUTE_SERVICE_PROFILE = "suse-cloud-compute"
  STORAGE_SERVICE_PROFILE = "suse-cloud-storage"

Severity: Minor
Found in crowbar_framework/app/controllers/ucs_controller.rb - About 2 hrs to fix

Class Upload has 23 methods (exceeds 20 allowed). Consider refactoring.
Open

    class Upload

      def initialize
        @checked_dependencies = Array.new
      end
Severity: Minor
Found in crowbar_framework/lib/crowbar/chef/upload.rb - About 2 hrs to fix

Function handleRemote has 62 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    handleRemote: function(element) {
      var method, url, data, elCrossDomain, crossDomain, withCredentials, dataType, options;

      if (rails.fire(element, 'ajax:before')) {
        elCrossDomain = element.data('cross-domain');
Severity: Major
Found in crowbar_framework/vendor/assets/javascripts/jquery/rails.js - About 2 hrs to fix
Severity
Category
Status
Source
Language