Showing 6,062 of 6,062 total issues
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;
- Create a ticketCreate a ticket
File role_object.rb
has 275 lines of code (exceeds 250 allowed). Consider refactoring. Open
require "ostruct"
class RoleObject < ChefObject
self.chef_type = "role"
- Create a ticketCreate a ticket
Identical blocks of code found in 2 locations. Consider refactoring. Open
this.element.siblings( ":visible" ).each(function() {
var elem = $( this ),
position = elem.css( "position" );
if ( position === "absolute" || position === "fixed" ) {
- Read upRead up
- Create a ticketCreate a ticket
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 87.
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
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Identical blocks of code found in 2 locations. Consider refactoring. Open
this.element.siblings( ":visible" ).each(function() {
var elem = $( this ),
position = elem.css( "position" );
if ( position === "absolute" || position === "fixed" ) {
- Read upRead up
- Create a ticketCreate a ticket
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 87.
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
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
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"] ||= []
- 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 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, {
- Create a ticketCreate a ticket
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
- Create a ticketCreate a ticket
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");
}
- Create a ticketCreate a ticket
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:
- Create a ticketCreate a ticket
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}"
- Create a ticketCreate a ticket
Method switch
has 64 lines of code (exceeds 25 allowed). Consider refactoring. Open
def switch
@port_start = 1
@sum = 0
@vports = {}
@groups = {}
- Create a ticketCreate a ticket
Similar blocks of code found in 2 locations. Consider refactoring. Open
vel = '<v:shape coordorigin="0 0" coordsize="' + this.pixelWidth + ' ' + this.pixelHeight + '" ' +
' id="jqsshape' + shapeid + '" ' +
stroke +
fill +
' style="position:absolute;left:0px;top:0px;height:' + this.pixelHeight + 'px;width:' + this.pixelWidth + 'px;padding:0px;margin:0px;" ' +
- Read upRead up
- Create a ticketCreate a ticket
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 86.
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
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 2 locations. Consider refactoring. Open
vel = '<v:shape coordorigin="0 0" coordsize="' + this.pixelWidth + ' ' + this.pixelHeight + '" ' +
' id="jqsshape' + shapeid + '" ' +
stroke +
fill +
' style="position:absolute;left:0px;top:0px;height:' + this.pixelHeight + 'px;width:' + this.pixelWidth + 'px;padding:0px;margin:0px;" ' +
- Read upRead up
- Create a ticketCreate a ticket
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 86.
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
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
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;}
}
- Create a ticketCreate a ticket
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);
- Create a ticketCreate a ticket
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) {
- Create a ticketCreate a ticket
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|
- Create a ticketCreate a ticket
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") }
- Create a ticketCreate a ticket
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"
- Create a ticketCreate a ticket
Class Upload
has 23 methods (exceeds 20 allowed). Consider refactoring. Open
class Upload
def initialize
@checked_dependencies = Array.new
end
- Create a ticketCreate a ticket