estimancy/projestimate

View on GitHub

Showing 1,675 of 1,675 total issues

Method create has 71 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def create
    authorize! :create_organizations, Organization

    @organization = Organization.new(params[:organization])

Severity: Major
Found in app/controllers/organizations_controller.rb - About 2 hrs to fix

    Function Image has 70 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        jsPlumb.Endpoints.Image = function(params) {
                    
            this.type = "Image";
            DOMElementEndpoint.apply(this, arguments);
            
    Severity: Major
    Found in app/assets/javascripts/jquery.jsPlumb-1.4.1-all.js - About 2 hrs to fix

      Method save_estimation_results has 70 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        def save_estimation_results(start_module_project, input_attributes, output_data)
          #@project = current_project
          authorize! :execute_estimation_plan, @project
      
          @pbs_project_element = current_component
      Severity: Major
      Found in app/controllers/projects_controller.rb - About 2 hrs to fix

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

                        if (c.sortAppend !== null) {
                            a = c.sortAppend;
                            for (j = 0; j < a.length; j++) {
                                if (a[j][0] !== i) {
                                    c.sortList.push(a[j]);
        Severity: Major
        Found in app/assets/javascripts/pager.js and 1 other location - About 2 hrs to fix
        app/assets/javascripts/pager.js on lines 733..740

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

        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 (c.sortForce !== null) {
                                a = c.sortForce;
                                for (j = 0; j < a.length; j++) {
                                    if (a[j][0] !== i) {
                                        c.sortList.push(a[j]);
        Severity: Major
        Found in app/assets/javascripts/pager.js and 1 other location - About 2 hrs to fix
        app/assets/javascripts/pager.js on lines 788..795

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

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

          contextPrototype.stroke = function(aFill) {
            var lineStr = [];
            var lineOpen = false;
        
            var W = 10;
        Severity: Major
        Found in app/assets/javascripts/jit-2.0.1-excanvas.js - About 2 hrs to fix

          Method display_effort_balancing_input has 69 lines of code (exceeds 25 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: Major
          Found in app/helpers/projects_helper.rb - About 2 hrs to fix

            Method append_pemodule has 69 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              def append_pemodule
                @project = Project.find(params[:project_id])
                @pemodule = Pemodule.find(params[:module_selected].split(',').last.to_i)
            
                authorize! :alter_estimation_plan, @project
            Severity: Major
            Found in app/controllers/projects_controller.rb - About 2 hrs to fix

              Method is_validate has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
              Open

                def is_validate(val)
                  #deserialize options to do something like that : ['integer', '>=', 50]
                  array = pe_attribute.options.compact.reject { |s| s.nil? or s.empty? or s.blank? }
              
                  #test attribute type and check validity (numeric = float and integer)
              Severity: Minor
              Found in app/models/attribute_module.rb - About 2 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

              Method display_effort_balancing_output has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
              Open

                def display_effort_balancing_output(module_project)
                  pbs_project_element = @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 2 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

              Method edit has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
              Open

                def edit
                  set_page_title 'Edit estimation'
              
                  @project = Project.find(params[:id])
                  @organization = @project.organization
              Severity: Minor
              Found in app/controllers/projects_controller.rb - About 2 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

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

                    var labelPos = {
                      x: Math.round((pos.x * sx) * r + ox + radius.width / 2),
                      y: Math.round((pos.y * sy) * r + oy + radius.height / 2)
                    };
              Severity: Major
              Found in app/assets/javascripts/jit-2.0.1.js and 1 other location - About 2 hrs to fix
              app/assets/javascripts/jit-2.0.1.js on lines 16942..16945

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

              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

                  function saturate(color, amount) {
                      amount = (amount === 0) ? 0 : (amount || 10);
                      var hsl = tinycolor(color).toHsl();
                      hsl.s += amount / 100;
                      hsl.s = clamp01(hsl.s);
              Severity: Major
              Found in app/assets/javascripts/spectrum.js and 1 other location - About 2 hrs to fix
              app/assets/javascripts/spectrum.js on lines 1695..1701

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

              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(node, pos) {
                      var width = node.getData('width'),
                          height = node.getData('height'),
                          npos = node.pos.getc().$scale(node.scale);
                      return this.nodeHelper.circle.contains(npos, pos, width, height);
              Severity: Major
              Found in app/assets/javascripts/jit-2.0.1.js and 1 other location - About 2 hrs to fix
              app/assets/javascripts/jit-2.0.1.js on lines 17046..17051

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

              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

                    var labelPos = {
                      x: Math.round((pos.x * sx) * r + ox + radius.width / 2),
                      y: Math.round((pos.y * sy) * r + oy + radius.height / 2)
                    };
              Severity: Major
              Found in app/assets/javascripts/jit-2.0.1.js and 1 other location - About 2 hrs to fix
              app/assets/javascripts/jit-2.0.1.js on lines 16891..16894

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

              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(node, pos) {
                      var width = node.getData('width'),
                          height = node.getData('height'),
                          npos = node.pos.getc().$scale(node.scale);
                      return this.nodeHelper.rectangle.contains(npos, pos, width, height);
              Severity: Major
              Found in app/assets/javascripts/jit-2.0.1.js and 1 other location - About 2 hrs to fix
              app/assets/javascripts/jit-2.0.1.js on lines 17009..17014

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

              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

                  function lighten (color, amount) {
                      amount = (amount === 0) ? 0 : (amount || 10);
                      var hsl = tinycolor(color).toHsl();
                      hsl.l += amount / 100;
                      hsl.l = clamp01(hsl.l);
              Severity: Major
              Found in app/assets/javascripts/spectrum.js and 1 other location - About 2 hrs to fix
              app/assets/javascripts/spectrum.js on lines 1683..1689

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

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

                  jsPlumb.Overlays.Arrow = function(params) {
                      this.type = "Arrow";
                      AbstractOverlay.apply(this, arguments);
                      this.isAppendedAtTopLevel = false;
                      params = params || {};
              Severity: Major
              Found in app/assets/javascripts/jquery.jsPlumb-1.4.1-all.js - About 2 hrs to fix

                Function on_resize has 68 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    fn.on_resize = function(event, ui) {
                        var rel_x = (ui.pointer.diff_left);
                        var rel_y = (ui.pointer.diff_top);
                        var wbd_x = this.options.widget_base_dimensions[0];
                        var wbd_y = this.options.widget_base_dimensions[1];
                Severity: Major
                Found in app/assets/javascripts/jquery.gridster.js - About 2 hrs to fix

                  Function drawBars has 68 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                          function drawBars(animPc) {
                              var cumvalue = new Array();
                              var totvalue = new Array();
                              for (var i = 0; i < data.datasets.length; i++) { for (var j = 0; j < data.datasets[i].data.length; j++) { cumvalue[j] = 0; totvalue[j] = 0; } }
                              for (var i = 0; i < data.datasets.length; i++) { for (var j = 0; j < data.datasets[i].data.length; j++) totvalue[j] += data.datasets[i].data[j]; }
                  Severity: Major
                  Found in app/assets/javascripts/ChartNew.js - About 2 hrs to fix
                    Severity
                    Category
                    Status
                    Source
                    Language