Showing 1,006 of 6,062 total issues
File upgrade_controller_spec.rb
has 290 lines of code (exceeds 250 allowed). Consider refactoring. Open
require "spec_helper"
describe Api::UpgradeController, type: :request do
context "with a successful upgrade API request" do
let(:headers) { { ACCEPT: "application/vnd.crowbar.v2.0+json" } }
- Create a ticketCreate a ticket
Function add
has 73 lines of code (exceeds 25 allowed). Consider refactoring. Open
add: function( elem, types, handler, data, selector ) {
var tmp, events, t, handleObjIn,
special, eventHandle, handleObj,
handlers, type, namespaces, origType,
elemData = jQuery._data( elem );
- Create a ticketCreate a ticket
Function _create
has 73 lines of code (exceeds 25 allowed). Consider refactoring. Open
_create: function() {
this.activeMenu = this.element;
// flag used to prevent firing of the click handler
// as the event bubbles up through nested menus
this.mouseHandled = false;
- Create a ticketCreate a ticket
Function write
has 73 lines of code (exceeds 25 allowed). Consider refactoring. Open
JsonAttribute.prototype.write = function(key, value, type) {
switch (type) {
case 'boolean':
value = value.toLowerCase() == 'true';
break;
- Create a ticketCreate a ticket
Method transition
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
def transition(inst, name, state)
Rails.logger.debug("Provisioner transition: entering: #{name} for #{state}")
# hardware-installing for the bootdisk finder
if ["hardware-installing", "installed", "readying"].include? state
- Read upRead up
- Create a ticketCreate a ticket
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 verify_claimed_disks
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
def verify_claimed_disks
unreferenced_disks = Array.new
crowbar_wall[:claimed_disks].each do |disk, _claim|
path, device_name = disk.split("/")[-2..-1]
- Read upRead up
- Create a ticketCreate a ticket
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 restore.rb
has 287 lines of code (exceeds 250 allowed). Consider refactoring. Open
module Crowbar
class Backup
class Restore
attr_accessor :backup, :version
- Create a ticketCreate a ticket
Function widget
has 72 lines of code (exceeds 25 allowed). Consider refactoring. Open
$.widget = function( name, base, prototype ) {
var fullName, existingConstructor, constructor, basePrototype,
// proxiedPrototype allows the provided prototype to remain unmodified
// so that it can be used as a mixin for multiple widgets (#8876)
proxiedPrototype = {},
- Create a ticketCreate a ticket
Class Disk
has 25 methods (exceeds 20 allowed). Consider refactoring. Open
class Disk
attr_reader :device
def initialize(node,name)
# comes from ohai, and can e.g. "hda", "sda", or "cciss!c0d0"
@device = name
- Create a ticketCreate a ticket
Class BarclampController
has 25 methods (exceeds 20 allowed). Consider refactoring. Open
class BarclampController < ApplicationController
wrap_parameters false
skip_before_filter :enforce_installer, if: proc { Crowbar::Installer.initial_chef_client? }
skip_before_filter :upgrade, only: [:transition]
- Create a ticketCreate a ticket
Class Attribute
has 25 methods (exceeds 20 allowed). Consider refactoring. Open
class Attribute
attr_accessor :attrs
attr_accessor :proposal
attr_accessor :view
attr_accessor :attribute
- Create a ticketCreate a ticket
Function _contactContainers
has 70 lines of code (exceeds 25 allowed). Consider refactoring. Open
_contactContainers: function(event) {
var i, j, dist, itemWithLeastDistance, posProperty, sizeProperty, base, cur, nearBottom, floating,
innermostContainer = null,
innermostIndex = null;
- Create a ticketCreate a ticket
Method bootstrap_ensure_proposal
has 70 lines of code (exceeds 25 allowed). Consider refactoring. Open
def bootstrap_ensure_proposal(bc, override_attr_path)
Rails.logger.info("Bootstrap: ensure proposal for bc: #{bc}, name: #{override_attr_path}")
unless override_attr_path == "default" || File.exist?(override_attr_path)
msg = "Cannot ensure proposal for #{bc} exists: #{override_attr_path} does not exist."
- Create a ticketCreate a ticket
Function statusCheck
has 69 lines of code (exceeds 25 allowed). Consider refactoring. Open
function statusCheck() {
$.ajax({
type: "GET",
dataType: "json",
url: Routes.status_installer_path(),
- Create a ticketCreate a ticket
Method find_node_boot_mac_addresses
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
def find_node_boot_mac_addresses(node, admin_data_net)
# If we don't have an admin IP allocated yet, using node.macaddress is
# our best guess for the boot macaddress.
if admin_data_net.nil? || \
admin_data_net.interface_list.nil?
- Read upRead up
- Create a ticketCreate a ticket
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 bootstrap_ensure_proposal
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
def bootstrap_ensure_proposal(bc, override_attr_path)
Rails.logger.info("Bootstrap: ensure proposal for bc: #{bc}, name: #{override_attr_path}")
unless override_attr_path == "default" || File.exist?(override_attr_path)
msg = "Cannot ensure proposal for #{bc} exists: #{override_attr_path} does not exist."
- Read upRead up
- Create a ticketCreate a ticket
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 reset_pk_sequence!
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
def reset_pk_sequence!(table, pk = nil, sequence = nil) #:nodoc:
unless pk and sequence
default_pk, default_sequence = pk_and_sequence_for(table)
pk ||= default_pk
- Read upRead up
- Create a ticketCreate a ticket
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 matcherFromGroupMatchers
has 68 lines of code (exceeds 25 allowed). Consider refactoring. Open
function matcherFromGroupMatchers( elementMatchers, setMatchers ) {
var bySet = setMatchers.length > 0,
byElement = elementMatchers.length > 0,
superMatcher = function( seed, context, xml, results, outermost ) {
var elem, j, matcher,
- Create a ticketCreate a ticket
Function updateDisplay
has 68 lines of code (exceeds 25 allowed). Consider refactoring. Open
function updateDisplay(changes) {
if (!scroller.clientWidth) {
showingFrom = showingTo = 0;
return;
}
- Create a ticketCreate a ticket
Function done
has 67 lines of code (exceeds 25 allowed). Consider refactoring. Open
function done( status, nativeStatusText, responses, headers ) {
var isSuccess, success, error, response, modified,
statusText = nativeStatusText;
// Called once
- Create a ticketCreate a ticket