Showing 1,675 of 1,675 total issues
Similar blocks of code found in 4 locations. Consider refactoring. Open
xmax = Math.max(d.hxy.x, d.tail[0].x, d.tail[1].x, d.cxy.x),
- Read upRead up
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 56.
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
this.onWidgets = function(fct) {
var evtHandler = new EventHandler(EvtNames.WIDGETS, fct);
this.eventHandlers[this.eventHandlers.length] = evtHandler;
};
- Read upRead up
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 56.
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
this.onError = function(fct) {
var evtHandler = new EventHandler(EvtNames.ERROR, fct);
this.eventHandlers[this.eventHandlers.length] = evtHandler;
};
- Read upRead up
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 56.
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 plotTree
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
plotTree: function(node, opt, animating) {
var that = this,
viz = this.viz,
canvas = viz.canvas,
config = this.config,
Function deleteEndpoint
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
this.deleteEndpoint = function(object, doNotRepaintAfterwards) {
_currentInstance.doWhileSuspended(function() {
var endpoint = (typeof object == "string") ? endpointsByUUID[object] : object;
if (endpoint) {
var uuid = endpoint.getUuid();
Function applyOptions
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
function applyOptions() {
if (opts.showPaletteOnly) {
opts.showPalette = true;
}
Function placeAnchors
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
placeAnchors = function(elementId, _anchorLists) {
var cd = jsPlumbInstance.getCachedData(elementId), sS = cd.s, sO = cd.o,
placeSomeAnchors = function(desc, elementDimensions, elementPosition, unsortedConnections, isHorizontal, otherMultiplier, orientation) {
if (unsortedConnections.length > 0) {
var sc = _sortHelper(unsortedConnections, edgeSortFunctions[desc]), // puts them in order based on the target element's pos on screen
Function VmlEndpoint
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
VmlEndpoint = window.VmlEndpoint = function(params) {
VmlComponent.apply(this, arguments);
var vml = null, self = this, opacityStrokeNode = null, opacityFillNode = null;
self.canvas = document.createElement("div");
self.canvas.style["position"] = "absolute";
Function on_dragstart
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
fn.on_dragstart = function(e) {
e.preventDefault();
if (this.is_dragging) { return this; }
Function keydown
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
, keydown: function (e) {
var $this
, $items
, $active
, $parent
Function draggable
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
fn.draggable = function() {
var self = this;
var draggable_options = $.extend(true, {}, this.options.draggable, {
offset_left: this.options.widget_margins[0],
offset_top: this.options.widget_margins[1],
Function refresh_me
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
function refresh_me(data){
var show_exclude = false;
//if($('input:checkbox').is(":checked")) {
if($('#show_excluded_elt:checkbox').is(":checked")) { show_exclude = true; }
else{ show_exclude = false; }
Method create
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
def create
@project = Project.find(params[:project_id])
authorize! :alter_project_pbs_products, @project
@pbs_project_element = PbsProjectElement.new(params[:pbs_project_element])
Consider simplifying this complex logical expression. Open
if(this.config.animate) {
this.compute('end');
this.config.levelsToShow > 0 && this.geom.setRightLevelToShow(this.graph.getNode(this.clickedNode
&& this.clickedNode.id || this.root));
this.fx.animate($.merge(this.config, {
Consider simplifying this complex logical expression. Open
if ((wo.filter_$anyMatch && wo.filter_$anyMatch.length) || filters[c.columns]) {
data.anyMatchFlag = true;
data.anyMatchFilter = wo.filter_$anyMatch && ts.filter.getLatestSearch( wo.filter_$anyMatch ).val() || filters[c.columns] || '';
if (c.sortLocaleCompare) {
// replace accents
Function computeSubtree
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
computeSubtree: function (root, x, y, width, height, initialDepth, maxDepth, posType) {
Consider simplifying this complex logical expression. Open
if ( ts.filter.regex.toTest.test(data.iFilter) ) {
var result, tmp,
table = c.table,
index = data.index,
parsed = data.parsed[index],
Consider simplifying this complex logical expression. Open
if (!self.isFull() && !(idx == 0 && !self.isSource) && !(idx == 1 && !self.isTarget) && endpointEnabled) {
var _doContinue = true;
// the second check here is for the case that the user is dropping it back
// where it came from.
Consider simplifying this complex logical expression. Open
} else if (/\s+(-|to)\s+/.test(val)){
s = val.split(/(?: - | to )/); // make sure the dash is for a range and not indicating a negative number
r1 = fmt(s[0].replace(wo.filter_regex.nondigit, ''), table);
r2 = fmt(s[1].replace(wo.filter_regex.nondigit, ''), table);
// parse filter value in case we're comparing numbers (dates)
Consider simplifying this complex logical expression. Open
if ((config.savePngFunction.split(' ')[1]=="left" && event.which==1) ||
(config.savePngFunction.split(' ')[1]=="middle" && event.which==2) ||
(config.savePngFunction.split(' ')[1]=="right" && event.which==3) ||
(typeof(config.savePngFunction.split(' ')[1])!="string")) saveCanvas(ctx,data,config,tpgraph);