estimancy/projestimate

View on GitHub

Showing 1,675 of 1,675 total issues

Similar blocks of code found in 2 locations. Consider refactoring.
Open

        if ((b.y1 >= a.y1 && b.y1 <= a.y2) ||
            (b.y2 >= a.y1 && b.y2 <= a.y2) ||
            (a.y1 >= b.y1 && a.y2 <= b.y2)
        ) { y = true; }
Severity: Major
Found in app/assets/javascripts/jquery.gridster.js and 1 other location - About 3 hrs to fix
app/assets/javascripts/jquery.gridster.js on lines 190..193

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 106.

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

            if (config.yAxisRight) {
                if (reverseAxis == false) rightNotUsableSize = borderWidth + config.spaceRight + yAxisLabelWidth + widestYLabel + 3 + config.yAxisSpaceLeft + config.yAxisSpaceRight;
                else rightNotUsableSize = borderWidth + config.spaceRight + yAxisLabelWidth + widestXLabel + 3 + config.yAxisSpaceLeft + config.yAxisSpaceRight;
            }
Severity: Major
Found in app/assets/javascripts/ChartNew.js and 1 other location - About 3 hrs to fix
app/assets/javascripts/ChartNew.js on lines 4226..4229

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 106.

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 render has 88 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    'render' : function(node, canvas) {
      var pos = node.pos.getp(true),
          dimArray = node.getData('dimArray'),
          valueArray = node.getData('valueArray'),
          colorArray = node.getData('colorArray'),
Severity: Major
Found in app/assets/javascripts/jit-2.0.1.js - About 3 hrs to fix

    Class OrganizationsController has 29 methods (exceeds 20 allowed). Consider refactoring.
    Open

    class OrganizationsController < ApplicationController
      load_resource
      require 'rubygems'
      require 'securerandom'
      include ProjectsHelper
    Severity: Minor
    Found in app/controllers/organizations_controller.rb - About 3 hrs to fix

      Function render has 87 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          'render' : function(node, canvas) {
            var pos = node.pos.getc(true), 
                width = node.getData('width'),
                height = node.getData('height'),
                algnPos = this.getAlignedPos(pos, width, height),
      Severity: Major
      Found in app/assets/javascripts/jit-2.0.1.js - About 3 hrs to fix

        Function parseDate has 87 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

                parseDate: function(date, format, language) {
                    if (date instanceof Date) return date;
                    if (/^[\-+]\d+[dmwy]([\s,]+[\-+]\d+[dmwy])*$/.test(date)) {
                        var part_re = /([\-+]\d+)([dmwy])/,
                            parts = date.match(/([\-+]\d+)([dmwy])/g),
        Severity: Major
        Found in app/assets/javascripts/bootstrap-datepicker.js - About 3 hrs to fix

          Identical blocks of code found in 3 locations. Consider refactoring.
          Open

                                  if(config.inGraphDataXPosition==1) { xPos=barOffset+config.inGraphDataPaddingX; } 
                                  else if(config.inGraphDataXPosition==2) { xPos=barOffset+barWidth/2+config.inGraphDataPaddingX ;}
                                  else if(config.inGraphDataXPosition==3) { xPos=barOffset+barWidth+config.inGraphDataPaddingX;} 
          Severity: Major
          Found in app/assets/javascripts/ChartNew.js and 2 other locations - About 3 hrs to fix
          app/assets/javascripts/ChartNew.js on lines 2682..2684
          app/assets/javascripts/ChartNew.js on lines 3363..3365

          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 104.

          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

          Identical blocks of code found in 3 locations. Consider refactoring.
          Open

                              if(config.inGraphDataXPosition==1) { xPos=barOffset+config.inGraphDataPaddingX; } 
                              else if(config.inGraphDataXPosition==2) { xPos=barOffset+barWidth/2+config.inGraphDataPaddingX ;}
                              else if(config.inGraphDataXPosition==3) { xPos=barOffset+barWidth+config.inGraphDataPaddingX;} 
          Severity: Major
          Found in app/assets/javascripts/ChartNew.js and 2 other locations - About 3 hrs to fix
          app/assets/javascripts/ChartNew.js on lines 2682..2684
          app/assets/javascripts/ChartNew.js on lines 2718..2720

          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 104.

          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

          Identical blocks of code found in 3 locations. Consider refactoring.
          Open

                                  if(config.inGraphDataXPosition==1) { xPos=barOffset+config.inGraphDataPaddingX; } 
                                  else if(config.inGraphDataXPosition==2) { xPos=barOffset+barWidth/2+config.inGraphDataPaddingX ;}
                                  else if(config.inGraphDataXPosition==3) { xPos=barOffset+barWidth+config.inGraphDataPaddingX;} 
          Severity: Major
          Found in app/assets/javascripts/ChartNew.js and 2 other locations - About 3 hrs to fix
          app/assets/javascripts/ChartNew.js on lines 2718..2720
          app/assets/javascripts/ChartNew.js on lines 3363..3365

          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 104.

          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

          Identical blocks of code found in 2 locations. Consider refactoring.
          Open

                                  if(config.inGraphDataYPosition==1) { yPos=barOffset + barWidth - config.inGraphDataPaddingY; }
                                  else if(config.inGraphDataYPosition==2) { yPos=barOffset + barWidth/2- config.inGraphDataPaddingY; }
                                  else if(config.inGraphDataYPosition==3) { yPos=barOffset- config.inGraphDataPaddingY; }
          Severity: Major
          Found in app/assets/javascripts/ChartNew.js and 1 other location - About 3 hrs to fix
          app/assets/javascripts/ChartNew.js on lines 3036..3038

          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 104.

          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

          Identical blocks of code found in 2 locations. Consider refactoring.
          Open

                                  if(config.inGraphDataYPosition==1) { yPos=barOffset + barWidth - config.inGraphDataPaddingY; }
                                  else if(config.inGraphDataYPosition==2) { yPos=barOffset + barWidth/2- config.inGraphDataPaddingY; }
                                  else if(config.inGraphDataYPosition==3) { yPos=barOffset- config.inGraphDataPaddingY; }
          Severity: Major
          Found in app/assets/javascripts/ChartNew.js and 1 other location - About 3 hrs to fix
          app/assets/javascripts/ChartNew.js on lines 3069..3071

          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 104.

          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 format has 86 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                  format: function(table, c, wo){
                      if (c.$table.hasClass('hasResizable')) { return; }
                      c.$table.addClass('hasResizable');
                      var $t, t, i, j, s = {}, $c, $cols, w, tw,
                          $tbl = c.$table,
          Severity: Major
          Found in app/assets/javascripts/pager.js - About 3 hrs to fix

            Method display_effort_balancing_input has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
            Open

              def display_effort_balancing_input(module_project, last_estimation_result)
                pbs_project_element = current_component
                res = String.new
                if module_project.compatible_with(current_component.work_element_type.alias) || current_component
                  pemodule = Pemodule.find(module_project.pemodule.id)
            Severity: Minor
            Found in app/helpers/projects_helper.rb - About 3 hrs to fix

            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

            File wbs_activities_controller.rb has 309 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            require 'will_paginate/array'
            
            class WbsActivitiesController < ApplicationController
              #include DataValidationHelper #Module for master data changes validation
              include ModuleProjectsHelper
            Severity: Minor
            Found in app/controllers/wbs_activities_controller.rb - About 3 hrs to fix

              Function start has 85 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                          var start = function() {    
                          // drag might have started on an endpoint that is not actually a source, but which has
                          // one or more connections.
                              jpc = self.connectorSelector();
                              var _continue = true;
              Severity: Major
              Found in app/assets/javascripts/jquery.jsPlumb-1.4.1-all.js - About 3 hrs to fix

                Consider simplifying this complex logical expression.
                Open

                                    if (cornerRadius > 0 && current[4] != next[4]) {
                                        var radiusToUse = Math.min(cornerRadius, segLength(current), segLength(next));
                                        // right angle. adjust current segment's end point, and next segment's start point.
                                        current[2] -= current[5] * radiusToUse;
                                        current[3] -= current[6] * radiusToUse;
                Severity: Critical
                Found in app/assets/javascripts/jquery.jsPlumb-1.4.1-all.js - About 3 hrs to fix

                  Consider simplifying this complex logical expression.
                  Open

                  if (!document.createElement('canvas').getContext) {
                  
                  (function() {
                  
                    // alias some functions to make (compiled) code shorter
                  Severity: Critical
                  Found in app/assets/javascripts/jit-2.0.1-excanvas.js - About 3 hrs to fix

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

                            keydown: function(e){
                                if (this.picker.is(':not(:visible)')){
                                    if (e.keyCode == 27) // allow escape to hide and re-show picker
                                        this.show();
                                    return;
                    Severity: Major
                    Found in app/assets/javascripts/bootstrap-datepicker.js - About 3 hrs to fix

                      Similar blocks of code found in 2 locations. Consider refactoring.
                      Open

                          fn.get_targeted_columns = function(from_col) {
                              var max = (from_col || this.player_grid_data.col) +
                                  (this.player_grid_data.size_x - 1);
                              var cols = [];
                              for (var col = from_col; col <= max; col++) {
                      Severity: Major
                      Found in app/assets/javascripts/jquery.gridster.js and 1 other location - About 3 hrs to fix
                      app/assets/javascripts/jquery.gridster.js on lines 3358..3366

                      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 101.

                      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

                          fn.get_targeted_rows = function(from_row) {
                              var max = (from_row || this.player_grid_data.row) +
                                  (this.player_grid_data.size_y - 1);
                              var rows = [];
                              for (var row = from_row; row <= max; row++) {
                      Severity: Major
                      Found in app/assets/javascripts/jquery.gridster.js and 1 other location - About 3 hrs to fix
                      app/assets/javascripts/jquery.gridster.js on lines 3340..3348

                      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 101.

                      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

                      Severity
                      Category
                      Status
                      Source
                      Language