estimancy/projestimate

View on GitHub

Showing 1,675 of 1,675 total issues

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

        toHsvString: function() {
            var hsv = rgbToHsv(this._r, this._g, this._b);
            var h = mathRound(hsv.h * 360), s = mathRound(hsv.s * 100), v = mathRound(hsv.v * 100);
            return (this._a == 1) ?
              "hsv("  + h + ", " + s + "%, " + v + "%)" :
Severity: Major
Found in app/assets/javascripts/spectrum.js and 1 other location - About 6 hrs to fix
app/assets/javascripts/spectrum.js on lines 1242..1248

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

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

        toHslString: function() {
            var hsl = rgbToHsl(this._r, this._g, this._b);
            var h = mathRound(hsl.h * 360), s = mathRound(hsl.s * 100), l = mathRound(hsl.l * 100);
            return (this._a == 1) ?
              "hsl("  + h + ", " + s + "%, " + l + "%)" :
Severity: Major
Found in app/assets/javascripts/spectrum.js and 1 other location - About 6 hrs to fix
app/assets/javascripts/spectrum.js on lines 1231..1237

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

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 save_estimation_results has a Cognitive Complexity of 42 (exceeds 5 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: Minor
Found in app/controllers/projects_controller.rb - About 6 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 _compute has 160 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        this._compute = function(paintInfo, params) {
            
            if (params.clearEdits)
                userSuppliedSegments = null;
            
Severity: Major
Found in app/assets/javascripts/jquery.jsPlumb-1.4.1-all.js - About 6 hrs to fix

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

          Events: {
            enable: true,
            type: 'Native',
            onClick: function(node, eventInfo, evt) {
              if(!config.Events.enable) return;
    Severity: Major
    Found in app/assets/javascripts/jit-2.0.1.js and 1 other location - About 6 hrs to fix
    app/assets/javascripts/jit-2.0.1.js on lines 11171..11188

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

    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

          Events: {
            enable: true,
            type: 'Native',
            onClick: function(node, eventInfo, evt) {
              if(!config.Events.enable) return;
    Severity: Major
    Found in app/assets/javascripts/jit-2.0.1.js and 1 other location - About 6 hrs to fix
    app/assets/javascripts/jit-2.0.1.js on lines 12728..12745

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

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

                if(canvasConfig.useCanvas) {
                  this.canvas = canvasConfig.useCanvas;
                  this.config.labelContainer = this.canvas.id + '-label';
                } else {
                  if(canvasConfig.background) {
    Severity: Major
    Found in app/assets/javascripts/jit-2.0.1.js and 5 other locations - About 6 hrs to fix
    app/assets/javascripts/jit-2.0.1.js on lines 11901..11912
    app/assets/javascripts/jit-2.0.1.js on lines 14507..14518
    app/assets/javascripts/jit-2.0.1.js on lines 15113..15124
    app/assets/javascripts/jit-2.0.1.js on lines 15891..15902
    app/assets/javascripts/jit-2.0.1.js on lines 16544..16555

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

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

        if(canvasConfig.useCanvas) {
          this.canvas = canvasConfig.useCanvas;
          this.config.labelContainer = this.canvas.id + '-label';
        } else {
          if(canvasConfig.background) {
    Severity: Major
    Found in app/assets/javascripts/jit-2.0.1.js and 5 other locations - About 6 hrs to fix
    app/assets/javascripts/jit-2.0.1.js on lines 8569..8580
    app/assets/javascripts/jit-2.0.1.js on lines 11901..11912
    app/assets/javascripts/jit-2.0.1.js on lines 14507..14518
    app/assets/javascripts/jit-2.0.1.js on lines 15113..15124
    app/assets/javascripts/jit-2.0.1.js on lines 16544..16555

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

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

        if(canvasConfig.useCanvas) {
          this.canvas = canvasConfig.useCanvas;
          this.config.labelContainer = this.canvas.id + '-label';
        } else {
          if(canvasConfig.background) {
    Severity: Major
    Found in app/assets/javascripts/jit-2.0.1.js and 5 other locations - About 6 hrs to fix
    app/assets/javascripts/jit-2.0.1.js on lines 8569..8580
    app/assets/javascripts/jit-2.0.1.js on lines 11901..11912
    app/assets/javascripts/jit-2.0.1.js on lines 15113..15124
    app/assets/javascripts/jit-2.0.1.js on lines 15891..15902
    app/assets/javascripts/jit-2.0.1.js on lines 16544..16555

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

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

        if(canvasConfig.useCanvas) {
          this.canvas = canvasConfig.useCanvas;
          this.config.labelContainer = this.canvas.id + '-label';
        } else {
          if(canvasConfig.background) {
    Severity: Major
    Found in app/assets/javascripts/jit-2.0.1.js and 5 other locations - About 6 hrs to fix
    app/assets/javascripts/jit-2.0.1.js on lines 8569..8580
    app/assets/javascripts/jit-2.0.1.js on lines 11901..11912
    app/assets/javascripts/jit-2.0.1.js on lines 14507..14518
    app/assets/javascripts/jit-2.0.1.js on lines 15113..15124
    app/assets/javascripts/jit-2.0.1.js on lines 15891..15902

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

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

        if(canvasConfig.useCanvas) {
          this.canvas = canvasConfig.useCanvas;
          this.config.labelContainer = this.canvas.id + '-label';
        } else {
          if(canvasConfig.background) {
    Severity: Major
    Found in app/assets/javascripts/jit-2.0.1.js and 5 other locations - About 6 hrs to fix
    app/assets/javascripts/jit-2.0.1.js on lines 8569..8580
    app/assets/javascripts/jit-2.0.1.js on lines 14507..14518
    app/assets/javascripts/jit-2.0.1.js on lines 15113..15124
    app/assets/javascripts/jit-2.0.1.js on lines 15891..15902
    app/assets/javascripts/jit-2.0.1.js on lines 16544..16555

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

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

        if (canvasConfig.useCanvas) {
          this.canvas = canvasConfig.useCanvas;
          this.config.labelContainer = this.canvas.id + '-label';
        } else {
          if(canvasConfig.background) {
    Severity: Major
    Found in app/assets/javascripts/jit-2.0.1.js and 5 other locations - About 6 hrs to fix
    app/assets/javascripts/jit-2.0.1.js on lines 8569..8580
    app/assets/javascripts/jit-2.0.1.js on lines 11901..11912
    app/assets/javascripts/jit-2.0.1.js on lines 14507..14518
    app/assets/javascripts/jit-2.0.1.js on lines 15891..15902
    app/assets/javascripts/jit-2.0.1.js on lines 16544..16555

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

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

      def execute_duplication(project_id, new_organization_id)
        #begin
          old_prj = Project.find(project_id)
          new_organization = Organization.find(new_organization_id)
    
    
    Severity: Major
    Found in app/controllers/organizations_controller.rb - About 6 hrs to fix

      Method execute_duplication has 156 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        def execute_duplication(project_id, new_organization_id, user_id)
      
          user = User.find(user_id)
      
          #begin
      Severity: Major
      Found in app/workers/organization_duplicate_project_worker.rb - About 6 hrs to fix

        Function _initDropTarget has 154 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

                var _initDropTarget = function(canvas, forceInit, isTransient, endpoint) {
                    if ((params.isTarget || forceInit) && jpcl.isDropSupported(_element)) {
                        var dropOptions = params.dropOptions || _jsPlumb.Defaults.DropOptions || jsPlumb.Defaults.DropOptions;
                        dropOptions = jsPlumb.extend( {}, dropOptions);
                        dropOptions.scope = dropOptions.scope || self.scope;
        Severity: Major
        Found in app/assets/javascripts/jquery.jsPlumb-1.4.1-all.js - About 6 hrs to fix

          Function initializeViz has 152 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

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

            Function overlayCapableJsPlumbUIComponent has 151 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                    overlayCapableJsPlumbUIComponent = window.overlayCapableJsPlumbUIComponent = function(params) {
                        jsPlumbUIComponent.apply(this, arguments);
                        var self = this;            
                        this.overlays = [];
            
            
            Severity: Major
            Found in app/assets/javascripts/jquery.jsPlumb-1.4.1-all.js - About 6 hrs to fix

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

                    'contains': function(adj, pos) {
                      var from = adj.nodeFrom.pos.getc(true),
                          to = adj.nodeTo.pos.getc(true),
                          r = adj.nodeFrom.scale;
                      this.edgeHelper.arrow.contains({x:from.x*r, y:from.y*r}, {x:to.x*r, y:to.y*r}, pos, this.edge.epsilon);
              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 17123..17128

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

              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 from = adj.nodeFrom.pos.getc(true),
                          to = adj.nodeTo.pos.getc(true),
                          r = adj.nodeFrom.scale;
                          this.edgeHelper.line.contains({x:from.x*r, y:from.y*r}, {x:to.x*r, y:to.y*r}, pos, this.edge.epsilon);
              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 17140..17145

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

              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

                      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/workers/organization_duplicate_project_worker.rb and 1 other location - About 5 hrs to fix
              app/controllers/organizations_controller.rb on lines 334..386

              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

              Severity
              Category
              Status
              Source
              Language