estimancy/projestimate

View on GitHub

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),
Severity: Major
Found in app/assets/javascripts/jquery.jsPlumb-1.4.1-all.js and 3 other locations - About 1 hr to fix
app/assets/javascripts/jquery.jsPlumb-1.4.1-all.js on lines 8577..8577
app/assets/javascripts/jquery.jsPlumb-1.4.1-all.js on lines 8578..8578
app/assets/javascripts/jquery.jsPlumb-1.4.1-all.js on lines 8580..8580

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

Further Reading

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;
    };
Severity: Major
Found in app/assets/javascripts/spk_multiwidget.js and 1 other location - About 1 hr to fix
app/assets/javascripts/spk_multiwidget.js on lines 33..36

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

Further Reading

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;
    };
Severity: Major
Found in app/assets/javascripts/spk_multiwidget.js and 1 other location - About 1 hr to fix
app/assets/javascripts/spk_multiwidget.js on lines 29..32

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

Further Reading

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,
Severity: Minor
Found in app/assets/javascripts/jit-2.0.1.js - About 1 hr to fix

    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();
    Severity: Minor
    Found in app/assets/javascripts/jquery.jsPlumb-1.4.1-all.js - About 1 hr to fix

      Function applyOptions has 26 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

              function applyOptions() {
      
                  if (opts.showPaletteOnly) {
                      opts.showPalette = true;
                  }
      Severity: Minor
      Found in app/assets/javascripts/spectrum.js - About 1 hr to fix

        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                
        Severity: Minor
        Found in app/assets/javascripts/jquery.jsPlumb-1.4.1-all.js - About 1 hr to fix

          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";
          Severity: Minor
          Found in app/assets/javascripts/jquery.jsPlumb-1.4.1-all.js - About 1 hr to fix

            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; }
            
            
            Severity: Minor
            Found in app/assets/javascripts/jquery.gridster.js - About 1 hr to fix

              Function keydown has 26 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                , keydown: function (e) {
                    var $this
                      , $items
                      , $active
                      , $parent
              Severity: Minor
              Found in app/assets/javascripts/bootstrap.js - About 1 hr to fix

                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],
                Severity: Minor
                Found in app/assets/javascripts/jquery.gridster.js - About 1 hr to fix

                  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; }
                  Severity: Minor
                  Found in app/assets/javascripts/projestimate_script.js - About 1 hr to fix

                    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])
                    Severity: Minor
                    Found in app/controllers/pbs_project_elements_controller.rb - About 1 hr to fix

                      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, {
                      Severity: Major
                      Found in app/assets/javascripts/jit-2.0.1.js - About 1 hr to fix

                        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
                        Severity: Major
                        Found in app/assets/javascripts/tablesorter.min.js - About 1 hr to fix

                          Function computeSubtree has 8 arguments (exceeds 4 allowed). Consider refactoring.
                          Open

                            computeSubtree: function (root, x, y, width, height, initialDepth, maxDepth, posType) {
                          Severity: Major
                          Found in app/assets/javascripts/jit-2.0.1.js - About 1 hr to fix

                            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],
                            Severity: Major
                            Found in app/assets/javascripts/tablesorter.min.js - About 1 hr to fix

                              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.
                              Severity: Major
                              Found in app/assets/javascripts/jquery.jsPlumb-1.4.1-all.js - About 1 hr to fix

                                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)
                                Severity: Major
                                Found in app/assets/javascripts/pager.js - About 1 hr to fix

                                  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); 
                                  Severity: Major
                                  Found in app/assets/javascripts/ChartNew.js - About 1 hr to fix
                                    Severity
                                    Category
                                    Status
                                    Source
                                    Language