Showing 3,486 of 3,486 total issues
Function onKeyDown
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
onKeyDown : function(e){
var s = this.selNode || this.lastSelNode;
// undesirable, but required
var sm = this;
if(!s){
Function expandPath
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
expandPath : function(path, attr, callback){
if(Ext.isEmpty(path)){
if(callback){
callback(false, undefined);
}
Function selectPath
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
selectPath : function(path, attr, callback){
if(Ext.isEmpty(path)){
if(callback){
callback(false, undefined);
}
Function initEditor
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
initEditor : function(){
//Destroying the component during/before initEditor can cause issues.
try{
var dbody = this.getEditorBody(),
ss = this.el.getStyles('font-size', 'font-family', 'background-image', 'background-repeat', 'background-color', 'color'),
Function getErrors
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
getErrors: function(value) {
var errors = Ext.form.TextField.superclass.getErrors.apply(this, arguments);
value = Ext.isDefined(value) ? value : this.processValue(this.getRawValue());
Function Layer
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
Ext.Layer = function(config, existingEl){
config = config || {};
var dh = Ext.DomHelper,
cp = config.parentEl, pel = cp ? Ext.getDom(cp) : document.body;
Function onLayout
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
onLayout : function(ct, target) {
//render the Toolbar <table> HTML if it's not already present
if (!this.leftTr) {
var align = ct.buttonAlign == 'center' ? 'center' : 'left';
Function open
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
open: function(image, sel, group) {
group = group || false;
this.setViewSize();
els.overlay.fadeIn({
duration: this.overlayDuration,
Function SplitBar
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
Ext.SplitBar = function(dragElement, resizingElement, orientation, placement, existingProxy){
/** @private */
this.el = Ext.get(dragElement, true);
this.el.dom.unselectable = "on";
Function step
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
step: function(gotoEnd){
var t = (new Date()).getTime();
if ( gotoEnd || t > this.options.duration + this.startTime ) {
this.now = this.end;
Function showEditWindow
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
showEditWindow: function(){
var htmleditor = new Talho.ux.PhinHtmlEditor({
linksInNewWindow: true,
name: 'htmlportlet',
region: 'center',
Function initComponent
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
initComponent: function() {
this.rss_store = new Ext.data.JsonStore({
url: '/rss_feed.json',
baseParams: {
'urls[]': this.urls,
Function load
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
load: function( url, params, callback ) {
if ( jQuery.isFunction( url ) )
return this.bind("load", url);
var off = url.indexOf(" ");
Function showEditWindow
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
showEditWindow: function(){
var htmleditor = new Ext.form.HtmlEditor({
linksInNewWindow: true,
name: 'htmlportlet',
region: 'center',
Function parseStringItem
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
function parseStringItem( string , context , thread ) {
var done,
func,
data = {},
Method handle_org_requests
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
def handle_org_requests(req_json, current_user)
return [ false, [ "Permission denied" ] ] unless editable_by?(current_user)
rq_list = ActiveSupport::JSON.decode(req_json)
result = "success"
rq_errors = []
Function getStore
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
getStore: function(){
if(!this.store){
var writer = new Ext.data.JsonWriter({
encode: false,
createRecord: function(record){
Method import
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
def import
invitees = []
csvfile = params[:invitation][:csvfile]
newfile = File.join(Rails.root.to_s,'tmp',csvfile.original_filename)
File.open(newfile,'wb') do |file|
Method update
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
def update
if (params[:topic] && params[:topic][:comment_attributes] && params[:topic][:comment_attributes][:comment_id])
parent_topic = Topic.find(params[:topic][:comment_attributes][:comment_id])
while not parent_topic.comment_id.nil?
parent_topic = Topic.find(parent_topic.comment_id)
Identical blocks of code found in 2 locations. Consider refactoring. Open
b = {x: xy[0], y: xy[1], 0: xy[0], 1: xy[1], width: dom.offsetWidth, height: dom.offsetHeight};
- 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 62.
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