Showing 3,486 of 3,486 total issues
Similar blocks of code found in 2 locations. Consider refactoring. Open
this.edge = this.strip.createChild({
tag : 'span',
cls : 'x-tab-edge',
cn : [{
tag : 'span',
- 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 show
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
show: function(speed,callback){
if ( speed ) {
return this.animate( genFx("show", 3), speed, callback);
} else {
for ( var i = 0, l = this.length; i < l; i++ ){
Function clone
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
clone: function( events ) {
// Do the clone
var ret = this.map(function(){
if ( !jQuery.support.noCloneEvent && !jQuery.isXMLDoc(this) ) {
// IE copies events bound via attachEvent when
Function extend
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
jQuery.extend = jQuery.fn.extend = function() {
// copy reference to target object
var target = arguments[0] || {}, i = 1, length = arguments.length, deep = false, options;
// Handle a deep copy situation
Function _createSelectionGrid
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
_createSelectionGrid: function(){
this.jurisdictionContextMenu = new Ext.menu.Menu({
defaultAlign: 'tl-b?',
defaultOffsets: [0, 2],
plain: true,
Function acknowledgement_clicked
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
acknowledgement_clicked: function(ev, el, op){
el = Ext.get(el);
if(el.hasClass('selected')){
return;
}
Function initComponent
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
initComponent: function(){
this.items = [
{xtype: 'form', itemId: 'form', border: false, padding: 5, unstyled: true, region: 'center', labelAlign: 'top', method: 'GET', url: '/report_schedules/' + this.report_type + '.json', items: [
{xtype: 'textfield', fieldLabel: 'Report Type', anchor: '100%', value: '', name: 'report_schedule[report_type]', disabled: true},
{xtype: 'label', text: 'Days to run the report:'},
Function bindReady
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
function bindReady(){
if ( readyBound ) return;
readyBound = true;
// Mozilla, Opera and webkit nightlies currently support this event
Function fix
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
fix: function(event) {
if ( event[expando] )
return event;
// store a copy of the original event object
Function checkIFrame
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
function checkIFrame() {
if (!iframe.contentWindow || !iframe.contentWindow.document) {
setTimeout(checkIFrame, 10);
return;
}
Function doForm
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
doForm : function(c, m, form, callback, scope){
var t = new Ext.Direct.Transaction({
provider: this,
action: c,
method: m.name,
Function constrainTo
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
constrainTo : function(constrainTo, pad, inContent){
if(Ext.isNumber(pad)){
pad = {left: pad, right:pad, top:pad, bottom:pad};
}
pad = pad || this.defaultPadding;
Function groupBy
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
groupBy : function(field, forceRegroup, direction) {
direction = direction ? (String(direction).toUpperCase() == 'DESC' ? 'DESC' : 'ASC') : this.groupDir;
if (this.groupField == field && this.groupDir == direction && !forceRegroup) {
return; // already grouped by this field
Function getStyleSize
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
getStyleSize : function(){
var me = this,
w, h,
doc = document,
d = this.dom,
Function extractData
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
extractData : function(root, returnRecords) {
// A bit ugly this, too bad the Record's raw data couldn't be saved in a common property named "raw" or something.
var rawName = (this instanceof Ext.data.JsonReader) ? 'json' : 'node';
var rs = [];
Function mon
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
mon : function(item, ename, fn, scope, opt){
this.createMons();
if(Ext.isObject(ename)){
var propRe = /^(?:scope|delay|buffer|single|stopEvent|preventDefault|stopPropagation|normalized|args|delegate)$/;
Function initComponent
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
initComponent : function(){
this.addEvents(
/**
* @event change
* Fires after the button's active menu item has changed. Note that if a {@link #changeHandler} function
Function select
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
select : function(nodeInfo, keepExisting, suppressEvent){
if(Ext.isArray(nodeInfo)){
if(!keepExisting){
this.clearSelections(true);
}
Function isValidDropPoint
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
isValidDropPoint : function(n, pt, dd, e, data){
if(!n || !data){ return false; }
var targetNode = n.node;
var dropNode = data.node;
// default drop rules
Function bindStore
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
bindStore : function(store, initial){
if(!initial && this.store){
if(store !== this.store && this.store.autoDestroy){
this.store.destroy();
}else{