Showing 6,062 of 6,062 total issues
Similar blocks of code found in 2 locations. Consider refactoring. Open
if (that._helper && !o.animate && (/relative/).test(ce.css("position"))) {
$(this).css({ left: ho.left - cop.left - co.left, width: w, height: h });
}
- 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 92.
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
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
Similar blocks of code found in 2 locations. Consider refactoring. Open
pageY: function() {
if (this.e.pageY != null) return this.e.pageY;
var doc = this.target().ownerDocument;
return this.e.clientY + doc.body.scrollTop + doc.documentElement.scrollTop;
}
- 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 90.
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
pageX: function() {
if (this.e.pageX != null) return this.e.pageX;
var doc = this.target().ownerDocument;
return this.e.clientX + doc.body.scrollLeft + doc.documentElement.scrollLeft;
},
- 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 90.
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 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 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 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
Similar blocks of code found in 2 locations. Consider refactoring. Open
def activate
return render_not_found if params[:platform].nil? || params[:arch].nil? || params[:repo].nil?
ret, _message = ProvisionerService.new.enable_repository(
params[:platform],
params[:arch],
- 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 98.
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
def deactivate
return render_not_found if params[:platform].nil? || params[:arch].nil? || params[:repo].nil?
ret, _message = ProvisionerService.new.disable_repository(
params[:platform],
params[:arch],
- 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 98.
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 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
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 ) {
- Create a ticketCreate a ticket
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
- Create a ticketCreate a ticket
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 ] ) {
- Create a ticketCreate a ticket