estimancy/projestimate

View on GitHub

Showing 1,675 of 1,675 total issues

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

          new_mp.guw_unit_of_work_groups.each do |guw_group|
            new_pbs_project_element = new_prj_components.find_by_copy_id(guw_group.pbs_project_element_id)
            new_pbs_project_element_id = new_pbs_project_element.nil? ? nil : new_pbs_project_element.id

            #technology
Severity: Major
Found in app/controllers/organizations_controller.rb and 1 other location - About 5 hrs to fix
app/workers/organization_duplicate_project_worker.rb on lines 174..226

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

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

  initializeViz: function() {
    var config = this.config,
        that = this,
        nodeType = config.type.split(":")[0],
        nodeLabels = {};
Severity: Major
Found in app/assets/javascripts/jit-2.0.1.js - About 5 hrs to fix

    Function initialize has 145 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

            function initialize() {
    
                if (IE) {
                    container.find("*:not(input)").attr("unselectable", "on");
                }
    Severity: Major
    Found in app/assets/javascripts/spectrum.js - About 5 hrs to fix

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

                  if (isIE() < 9 && isIE() != false) ctx.canvas.attachEvent("on"+ config.savePngFunction.split(' ')[0], function(event) { 
                    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 and 1 other location - About 5 hrs to fix
      app/assets/javascripts/ChartNew.js on lines 4693..4698

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

      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

                  else ctx.canvas.addEventListener(config.savePngFunction.split(' ')[0], function (event) {   
                    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 and 1 other location - About 5 hrs to fix
      app/assets/javascripts/ChartNew.js on lines 4687..4692

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

      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 3 locations. Consider refactoring.
      Open

        getLegend: function() {
          var legend = {};
          var n;
          this.delegate.graph.getNode(this.delegate.root).eachAdjacency(function(adj) {
            n = adj.nodeTo;
      Severity: Major
      Found in app/assets/javascripts/jit-2.0.1.js and 2 other locations - About 5 hrs to fix
      app/assets/javascripts/jit-2.0.1.js on lines 10620..10632
      app/assets/javascripts/jit-2.0.1.js on lines 11478..11490

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

      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 3 locations. Consider refactoring.
      Open

        getLegend: function() {
          var legend = {};
          var n;
          this.delegate.graph.getNode(this.delegate.root).eachAdjacency(function(adj) {
            n = adj.nodeTo;
      Severity: Major
      Found in app/assets/javascripts/jit-2.0.1.js and 2 other locations - About 5 hrs to fix
      app/assets/javascripts/jit-2.0.1.js on lines 10620..10632
      app/assets/javascripts/jit-2.0.1.js on lines 12956..12968

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

      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 3 locations. Consider refactoring.
      Open

        getLegend: function() {
          var legend = {};
          var n;
          this.delegate.graph.getNode(this.delegate.root).eachAdjacency(function(adj) {
            n = adj.nodeTo;
      Severity: Major
      Found in app/assets/javascripts/jit-2.0.1.js and 2 other locations - About 5 hrs to fix
      app/assets/javascripts/jit-2.0.1.js on lines 11478..11490
      app/assets/javascripts/jit-2.0.1.js on lines 12956..12968

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

      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 (isIE() < 9 && isIE() != false) ctx.canvas.attachEvent("on" + config.annotateFunction.split(' ')[0], function (event) { 
                    if ((config.annotateFunction.split(' ')[1]=="left" && event.which==1) ||
                        (config.annotateFunction.split(' ')[1]=="middle" && event.which==2) ||
                        (config.annotateFunction.split(' ')[1]=="right" && event.which==3) ||
                        (typeof(config.annotateFunction.split(' ')[1])!="string")) doMouseMove(ctx, config, event) 
      Severity: Major
      Found in app/assets/javascripts/ChartNew.js and 1 other location - About 5 hrs to fix
      app/assets/javascripts/ChartNew.js on lines 4677..4682

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

      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

            'contains': function(adj, pos) {
              var orn = this.getOrientation(adj),
                  nodeFrom = adj.nodeFrom, 
                  nodeTo = adj.nodeTo,
                  rel = nodeFrom._depth < nodeTo._depth,
      Severity: Major
      Found in app/assets/javascripts/jit-2.0.1.js and 1 other location - About 5 hrs to fix
      app/assets/javascripts/jit-2.0.1.js on lines 9929..9937

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

      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

                  else ctx.canvas.addEventListener(config.annotateFunction.split(' ')[0], function (event) { 
                    if ((config.annotateFunction.split(' ')[1]=="left" && event.which==1) ||
                        (config.annotateFunction.split(' ')[1]=="middle" && event.which==2) ||
                        (config.annotateFunction.split(' ')[1]=="right" && event.which==3) ||
                        (typeof(config.annotateFunction.split(' ')[1])!="string")) doMouseMove(ctx, config, event) 
      Severity: Major
      Found in app/assets/javascripts/ChartNew.js and 1 other location - About 5 hrs to fix
      app/assets/javascripts/ChartNew.js on lines 4671..4676

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

      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

             'contains': function(adj, pos) {
               var orn = this.getOrientation(adj),
                   nodeFrom = adj.nodeFrom, 
                   nodeTo = adj.nodeTo,
                   rel = nodeFrom._depth < nodeTo._depth,
      Severity: Major
      Found in app/assets/javascripts/jit-2.0.1.js and 1 other location - About 5 hrs to fix
      app/assets/javascripts/jit-2.0.1.js on lines 9907..9915

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

      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

      Consider simplifying this complex logical expression.
      Open

                  if (existing) {
                      self.endpoints[index] = existing;
                      existing.addConnection(self);                    
                  } else {
                      if (!params.endpoints) params.endpoints = [ null, null ];
      Severity: Critical
      Found in app/assets/javascripts/jquery.jsPlumb-1.4.1-all.js - About 5 hrs to fix

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

            $("#select_balancing_attribute").change(function(){
                $('.spiner').show();
                $.ajax({
                    url:'/selected_balancing_attribute',
                    data: {
        Severity: Major
        Found in app/assets/javascripts/projestimate_script.js and 1 other location - About 5 hrs to fix
        app/assets/javascripts/projestimate_script.js on lines 215..229

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

        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

            $("#select_balancing_attribute").change(function(){
                $('.spiner').show();
                $.ajax({
                    url:'/selected_balancing_attribute',
                    data: {
        Severity: Major
        Found in app/assets/javascripts/projestimate_script.js and 1 other location - About 5 hrs to fix
        app/assets/javascripts/projestimate_script.js on lines 901..915

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

        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

        Method display_balancing_input has a Cognitive Complexity of 37 (exceeds 5 allowed). Consider refactoring.
        Open

          def display_balancing_input(module_project, last_estimation_result)
            pbs_project_element = current_component
            #Get the current balancing attribute
            @current_balancing_attribute = current_balancing_attribute
        
        
        Severity: Minor
        Found in app/helpers/projects_helper.rb - About 5 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

        Function format has 138 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

                format: function(table, c, wo) {
                    // filter widget doesn't initialize on an empty table. Fixes #449
                    if ( c.$table.hasClass('hasStickyHeaders') || ($.inArray('filter', c.widgets) >= 0 && !c.$table.hasClass('hasFilters')) ) {
                        return;
                    }
        Severity: Major
        Found in app/assets/javascripts/tablesorter.min.js - About 5 hrs to fix

          Method update has 138 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            def update
              set_page_title 'Edit estimation'
              @project = Project.find(params[:id])
              @organization = @project.organization
          
          
          Severity: Major
          Found in app/controllers/projects_controller.rb - About 5 hrs to fix

            Class ApplicationController has 41 methods (exceeds 20 allowed). Consider refactoring.
            Open

            class ApplicationController < ActionController::Base
              protect_from_forgery
            
              before_filter :authenticate_user!
            
            
            Severity: Minor
            Found in app/controllers/application_controller.rb - About 5 hrs to fix

              Function Doughnut has 136 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  var Doughnut = function (data, config, ctx) {
                      var segmentTotal = 0;
                      var msr, midPieX, midPieY;
              
                      if (!dynamicFunction(data,config,ctx,"Doughnut"))return;
              Severity: Major
              Found in app/assets/javascripts/ChartNew.js - About 5 hrs to fix
                Severity
                Category
                Status
                Source
                Language