estimancy/projestimate

View on GitHub

Showing 1,675 of 1,675 total issues

Method duplicate has a Cognitive Complexity of 65 (exceeds 5 allowed). Consider refactoring.
Open

  def duplicate
    # To duplicate a project user need to have the "show_project" and "create_project_from_scratch" authorizations
    if params[:action_name] == "duplication"
      authorize! :create_project_from_scratch, Project
      # To Create a project from a template user need to have "create_project_from_template" authorization
Severity: Minor
Found in app/controllers/projects_controller.rb - About 1 day 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 jsPlumbUIComponent has 256 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        jsPlumbUIComponent = window.jsPlumbUIComponent = function(params) {
            var self = this, 
                a = arguments, 
                _hover = false, 
                parameters = params.parameters || {}, 
Severity: Major
Found in app/assets/javascripts/jquery.jsPlumb-1.4.1-all.js - About 1 day to fix

    Function Radar has 244 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        var Radar = function (data, config, ctx) {
            var maxSize, scaleHop, calculatedScale, labelHeight, scaleHeight, valueBounds, labelTemplateString, msr, midPosX, midPosY;
    
            if (!dynamicFunction(data,config,ctx,"Radar"))return;
    
    
    Severity: Major
    Found in app/assets/javascripts/ChartNew.js - About 1 day to fix

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

                  for (var i = ((config.showYAxisMin) ? -1 : 0) ; i < calculatedScale.steps; i++) {
                      if (i >= 0) {
                          ctx.beginPath();
                          ctx.moveTo(yAxisPosX + i * valueHop, xAxisPosY + config.scaleTickSizeBottom);
                          ctx.lineWidth = config.scaleGridLineWidth;
      Severity: Major
      Found in app/assets/javascripts/ChartNew.js and 1 other location - About 1 day to fix
      app/assets/javascripts/ChartNew.js on lines 3100..3116

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

      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.inGraphDataAlign=="off-center"){
                                 if(config.inGraphDataRotate=="inRadiusAxis" || posAngle< Math.PI/2 || (posAngle > 3*Math.PI/2 && posAngle < 5*Math.PI/2))ctx.textAlign = "left";
                                 else ctx.textAlign="right";
                               }
                               else if(config.inGraphDataAlign=="to-center"){
      Severity: Major
      Found in app/assets/javascripts/ChartNew.js and 1 other location - About 1 day to fix
      app/assets/javascripts/ChartNew.js on lines 2116..2124

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

      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.inGraphDataAlign=="off-center"){
                                 if(config.inGraphDataRotate=="inRadiusAxis" || posAngle< Math.PI/2 || (posAngle > 3*Math.PI/2 && posAngle < 5*Math.PI/2))ctx.textAlign = "left";
                                 else ctx.textAlign="right";
                               }
                               else if(config.inGraphDataAlign=="to-center"){
      Severity: Major
      Found in app/assets/javascripts/ChartNew.js and 1 other location - About 1 day to fix
      app/assets/javascripts/ChartNew.js on lines 1918..1926

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

      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

                  for (var i = ((config.showYAxisMin) ? -1 : 0) ; i < calculatedScale.steps; i++) {
                      if (i >= 0) {
                          ctx.beginPath();
                          ctx.moveTo(yAxisPosX + i * valueHop, xAxisPosY + config.scaleTickSizeBottom);
                          ctx.lineWidth = config.scaleGridLineWidth;
      Severity: Major
      Found in app/assets/javascripts/ChartNew.js and 1 other location - About 1 day to fix
      app/assets/javascripts/ChartNew.js on lines 3676..3692

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

      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

              remove: function(table, c, wo){
                  var k, $tb,
                      b = c.$tbodies,
                      rmv = (wo.columns || [ "primary", "secondary", "tertiary" ]).join(' ');
                  c.$headers.removeClass(rmv);
      Severity: Major
      Found in app/assets/javascripts/pager.js and 1 other location - About 1 day to fix
      app/assets/javascripts/tablesorter.min.js on lines 337..350

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

      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

              remove: function(table, c, wo) {
                  var tbodyIndex, $tbody,
                      $tbodies = c.$tbodies,
                      remove = (wo.columns || [ "primary", "secondary", "tertiary" ]).join(' ');
                  c.$headers.removeClass(remove);
      Severity: Major
      Found in app/assets/javascripts/tablesorter.min.js and 1 other location - About 1 day to fix
      app/assets/javascripts/pager.js on lines 2000..2013

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

      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_effort_or_cost_per_phase has a Cognitive Complexity of 60 (exceeds 5 allowed). Consider refactoring.
      Open

        def display_effort_or_cost_per_phase(pbs_project_element, module_project_id, estimation_value, view_widget_id)
          res = String.new
          view_widget = ViewsWidget.find(view_widget_id)
      
          module_project = ModuleProject.find(module_project_id)
      Severity: Minor
      Found in app/helpers/views_widgets_helper.rb - About 1 day 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

      Method update has a Cognitive Complexity of 59 (exceeds 5 allowed). Consider refactoring.
      Open

        def update
          @module_project = ModuleProject.find(params[:id])
          @project = @module_project.project
      
          authorize! :alter_estimation_plan, @project
      Severity: Minor
      Found in app/controllers/module_projects_controller.rb - About 1 day 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 Bar has 228 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          var Bar = function (data, config, ctx) {
              var maxSize, scaleHop, calculatedScale, labelHeight, scaleHeight, valueBounds, labelTemplateString, valueHop, widestXLabel, xAxisLength, yAxisPosX, xAxisPosY, barWidth, rotateLabels = 0, msr;
              var annotateCnt = 0;
      
              if (!dynamicFunction(data,config,ctx,"Bar"))return;
      Severity: Major
      Found in app/assets/javascripts/ChartNew.js - About 1 day to fix

        File home.rb has 543 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        require 'open-uri'
        require 'mysql2'
        
        class Home < ActiveRecord::Base
          attr_accessible
        Severity: Major
        Found in app/models/home.rb - About 1 day to fix

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

              'star': {
                'render': function(node, canvas) {
                  var nconfig = this.node,
                      dim = node.getData('dim'),
                      p = node.pos.getc();
          Severity: Major
          Found in app/assets/javascripts/jit-2.0.1.js and 3 other locations - About 1 day to fix
          app/assets/javascripts/jit-2.0.1.js on lines 16985..17001
          app/assets/javascripts/jit-2.0.1.js on lines 17016..17032
          app/assets/javascripts/jit-2.0.1.js on lines 17053..17069

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

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

              'triangle': {
                'render': function(node, canvas) {
                  var nconfig = this.node,
                      dim = node.getData('dim'),
                      p = node.pos.getc();
          Severity: Major
          Found in app/assets/javascripts/jit-2.0.1.js and 3 other locations - About 1 day to fix
          app/assets/javascripts/jit-2.0.1.js on lines 16985..17001
          app/assets/javascripts/jit-2.0.1.js on lines 17016..17032
          app/assets/javascripts/jit-2.0.1.js on lines 17070..17086

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

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

              'circle': {
                'render': function(node, canvas) {
                  var nconfig = this.node,
                      dim = node.getData('dim'),
                      p = node.pos.getc();
          Severity: Major
          Found in app/assets/javascripts/jit-2.0.1.js and 3 other locations - About 1 day to fix
          app/assets/javascripts/jit-2.0.1.js on lines 17016..17032
          app/assets/javascripts/jit-2.0.1.js on lines 17053..17069
          app/assets/javascripts/jit-2.0.1.js on lines 17070..17086

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

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

              'square': {
                'render': function(node, canvas) {
                  var nconfig = this.node,
                      dim = node.getData('dim'),
                      p = node.pos.getc();
          Severity: Major
          Found in app/assets/javascripts/jit-2.0.1.js and 3 other locations - About 1 day to fix
          app/assets/javascripts/jit-2.0.1.js on lines 16985..17001
          app/assets/javascripts/jit-2.0.1.js on lines 17053..17069
          app/assets/javascripts/jit-2.0.1.js on lines 17070..17086

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

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

              var HorizontalBar = function (data, config, ctx) {
                  var maxSize, scaleHop, calculatedScale, labelHeight, scaleHeight, valueBounds, labelTemplateString, valueHop, widestXLabel, xAxisLength, yAxisPosX, xAxisPosY, barWidth, rotateLabels = 0, msr;
          
                  if (!dynamicFunction(data,config,ctx,"HorizontalBar"))return;
          
          
          Severity: Major
          Found in app/assets/javascripts/ChartNew.js - About 1 day to fix

            Method save_effort_breakdown has a Cognitive Complexity of 56 (exceeds 5 allowed). Consider refactoring.
            Open

              def save_effort_breakdown
                authorize! :execute_estimation_plan, @project
            
                @pbs_project_element = current_component
                @tmp_results = Hash.new
            Severity: Minor
            Found in app/controllers/wbs_activities_controller.rb - About 1 day 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

            Method get_view_widget_data has 214 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              def get_view_widget_data(module_project_id, view_widget_id)
            
                # General data
                view_widget = ViewsWidget.find(view_widget_id)
                pbs_project_elt = current_component
            Severity: Major
            Found in app/helpers/views_widgets_helper.rb - About 1 day to fix
              Severity
              Category
              Status
              Source
              Language