crowbar/crowbar-core

View on GitHub

Showing 1,006 of 6,062 total issues

Function __module9__ has 462 lines of code (exceeds 25 allowed). Consider refactoring.
Open

var __module9__ = (function() {
  "use strict";
  var __exports__;
  /* Jison generated parser */
  var handlebars = (function(){
Severity: Major
Found in crowbar_framework/vendor/assets/javascripts/misc/handlebars.js - About 2 days to fix

Function handlebars has 458 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  var handlebars = (function(){
  var parser = {trace: function trace() { },
  yy: {},
  symbols_: {"error":2,"root":3,"statements":4,"EOF":5,"program":6,"simpleInverse":7,"statement":8,"openInverse":9,"closeBlock":10,"openBlock":11,"mustache":12,"partial":13,"CONTENT":14,"COMMENT":15,"OPEN_BLOCK":16,"inMustache":17,"CLOSE":18,"OPEN_INVERSE":19,"OPEN_ENDBLOCK":20,"path":21,"OPEN":22,"OPEN_UNESCAPED":23,"CLOSE_UNESCAPED":24,"OPEN_PARTIAL":25,"partialName":26,"partial_option0":27,"inMustache_repetition0":28,"inMustache_option0":29,"dataName":30,"param":31,"STRING":32,"INTEGER":33,"BOOLEAN":34,"hash":35,"hash_repetition_plus0":36,"hashSegment":37,"ID":38,"EQUALS":39,"DATA":40,"pathSegments":41,"SEP":42,"$accept":0,"$end":1},
  terminals_: {2:"error",5:"EOF",14:"CONTENT",15:"COMMENT",16:"OPEN_BLOCK",18:"CLOSE",19:"OPEN_INVERSE",20:"OPEN_ENDBLOCK",22:"OPEN",23:"OPEN_UNESCAPED",24:"CLOSE_UNESCAPED",25:"OPEN_PARTIAL",32:"STRING",33:"INTEGER",34:"BOOLEAN",38:"ID",39:"EQUALS",40:"DATA",42:"SEP"},
Severity: Major
Found in crowbar_framework/vendor/assets/javascripts/misc/handlebars.js - About 2 days to fix

Function setup has 413 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    function setup($) {
        $.fn._fadeIn = $.fn.fadeIn;

        var noOp = $.noop || function() {};

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

Class ServiceObject has 98 methods (exceeds 20 allowed). Consider refactoring.
Open

class ServiceObject
  include CrowbarPacemakerProxy

  FORBIDDEN_PROPOSAL_NAMES=["template","nodes","commit","status"]

Severity: Major
Found in crowbar_framework/app/models/service_object.rb - About 1 day to fix

Function __module10__ has 363 lines of code (exceeds 25 allowed). Consider refactoring.
Open

var __module10__ = (function(__dependency1__, __dependency2__, __dependency3__, __dependency4__) {
  "use strict";
  var __exports__ = {};
  var Exception = __dependency1__;
  var parse = __dependency2__.parse;
Severity: Major
Found in crowbar_framework/vendor/assets/javascripts/misc/handlebars.js - About 1 day to fix

Method proposal_update has a Cognitive Complexity of 86 (exceeds 5 allowed). Consider refactoring.
Open

  def proposal_update
    if params[:submit].nil?
      #
      # This is RESTFul path
      #
Severity: Minor
Found in crowbar_framework/app/controllers/barclamp_controller.rb - About 1 day 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 nic.rb has 723 lines of code (exceeds 250 allowed). Consider refactoring.
Open

class ::Nic
  include Comparable
  private
  @@interfaces = Hash.new
  @nic = nil
Severity: Major
Found in chef/cookbooks/barclamp/libraries/nic.rb - About 1 day to fix

File upgrade_controller.rb has 668 lines of code (exceeds 250 allowed). Consider refactoring.
Open

class Api::UpgradeController < ApiController
  # disable upgrade API until upgrade to next version is implemented
  before_action(except: :show) do
    # skip filter if we're in the middle of upgrade from previos version
    unless File.exist?("/var/lib/crowbar/upgrade/8-to-9-upgrade-running")
Severity: Major
Found in crowbar_framework/app/controllers/api/upgrade_controller.rb - About 1 day to fix

Class Upgrade has 78 methods (exceeds 20 allowed). Consider refactoring.
Open

  class Upgrade < Tableless
    class << self
      def timeouts
        ::Crowbar::UpgradeTimeouts.new.values
      end
Severity: Major
Found in crowbar_framework/app/models/api/upgrade.rb - About 1 day to fix

Method apply_role has 289 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def apply_role(role, inst, in_queue, bootstrap = false)
    Rails.logger.debug "apply_role(#{role.name}, #{inst}, #{in_queue}, #{bootstrap})"
    Rails.logger.progress("Starting to apply role #{role.name}")

    # Variables used in the global ensure
Severity: Major
Found in crowbar_framework/app/models/service_object.rb - About 1 day to fix

File default.rb has 621 lines of code (exceeds 250 allowed). Consider refactoring.
Open

return if node[:platform_family] == "windows"

dirty = false

# Make sure packages we need will be present
Severity: Major
Found in chef/cookbooks/network/recipes/default.rb - About 1 day to fix

Method bulk has a Cognitive Complexity of 66 (exceeds 5 allowed). Consider refactoring.
Open

  def bulk
    @report = {
      success: [],
      failed: [],
      duplicate_public: false,
Severity: Minor
Found in crowbar_framework/app/controllers/nodes_controller.rb - About 1 day 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 lexer has 243 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  var lexer = (function(){
  var lexer = ({EOF:1,
  parseError:function parseError(str, hash) {
          if (this.yy.parser) {
              this.yy.parser.parseError(str, hash);
Severity: Major
Found in crowbar_framework/vendor/assets/javascripts/misc/handlebars.js - About 1 day to fix

Class Nic has 66 methods (exceeds 20 allowed). Consider refactoring.
Open

class ::Nic
  include Comparable
  private
  @@interfaces = Hash.new
  @nic = nil
Severity: Major
Found in chef/cookbooks/barclamp/libraries/nic.rb - About 1 day to fix

Function ajax has 240 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    ajax: function( url, options ) {

        // If url is an object, simulate pre-1.5 signature
        if ( typeof url === "object" ) {
            options = url;
Severity: Major
Found in crowbar_framework/vendor/assets/javascripts/jquery/jquery.js - About 1 day to fix

Method nodes has a Cognitive Complexity of 61 (exceeds 5 allowed). Consider refactoring.
Open

  def nodes
    if params[:component]
      component = params[:component]
      upgrade_status = ::Crowbar::UpgradeStatus.new
      substep = upgrade_status.current_substep
Severity: Minor
Found in crowbar_framework/app/controllers/api/upgrade_controller.rb - About 1 day 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 nodes_controller.rb has 545 lines of code (exceeds 250 allowed). Consider refactoring.
Open

class NodesController < ApplicationController
  # allow node polling during the upgrade
  skip_before_filter :upgrade, only: [:index]

  api :GET, "/nodes", "List all nodes and their status"
Severity: Major
Found in crowbar_framework/app/controllers/nodes_controller.rb - About 1 day to fix

Method services has a Cognitive Complexity of 57 (exceeds 5 allowed). Consider refactoring.
Open

      def services
        return unless cluster_health_check
        return unless check_schema_migrations
        return unless check_product_version
        begin
Severity: Minor
Found in crowbar_framework/app/models/api/upgrade.rb - About 1 day 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 setDocument has 218 lines of code (exceeds 25 allowed). Consider refactoring.
Open

setDocument = Sizzle.setDocument = function( node ) {
    var hasCompare, parent,
        doc = node ? node.ownerDocument || node : preferredDoc;

    // If no document and documentElement is available, return
Severity: Major
Found in crowbar_framework/vendor/assets/javascripts/jquery/jquery.js - About 1 day to fix

Method provided_with_enabled has a Cognitive Complexity of 55 (exceeds 5 allowed). Consider refactoring.
Open

      def provided_with_enabled(feature,
                                platform = nil,
                                arch = nil,
                                check_enabled = true,
                                ignore_cloud = false,
Severity: Minor
Found in crowbar_framework/lib/crowbar/repository.rb - About 1 day 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