estimancy/projestimate

View on GitHub

Showing 1,675 of 1,675 total issues

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

        if old_mp.view
          old_mp_view_widgets = old_mp.view.views_widgets.all
          old_mp_view_widgets.each do |view_widget|
            new_view_widget_mp = ModuleProject.find_by_project_id_and_copy_id(new_prj.id, view_widget.module_project_id)
            new_view_widget_mp_id = new_view_widget_mp.nil? ? nil : new_view_widget_mp.id
Severity: Major
Found in app/workers/organization_duplicate_project_worker.rb and 2 other locations - About 4 hrs to fix
app/controllers/organizations_controller.rb on lines 302..323
app/workers/organization_duplicate_project_worker.rb on lines 142..163

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

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

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

          if old_mp.view
            old_mp_view_widgets = old_mp.view.views_widgets.all
            old_mp_view_widgets.each do |view_widget|
              new_view_widget_mp = ModuleProject.find_by_project_id_and_copy_id(new_prj.id, view_widget.module_project_id)
              new_view_widget_mp_id = new_view_widget_mp.nil? ? nil : new_view_widget_mp.id
Severity: Major
Found in app/controllers/organizations_controller.rb and 2 other locations - About 4 hrs to fix
app/workers/organization_duplicate_project_worker.rb on lines 142..163
app/workers/organization_duplicate_project_worker.rb on lines 368..389

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

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

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

        if old_mp.view
          old_mp_view_widgets = old_mp.view.views_widgets.all
          old_mp_view_widgets.each do |view_widget|
            new_view_widget_mp = ModuleProject.find_by_project_id_and_copy_id(new_prj.id, view_widget.module_project_id)
            new_view_widget_mp_id = new_view_widget_mp.nil? ? nil : new_view_widget_mp.id
Severity: Major
Found in app/workers/organization_duplicate_project_worker.rb and 2 other locations - About 4 hrs to fix
app/controllers/organizations_controller.rb on lines 302..323
app/workers/organization_duplicate_project_worker.rb on lines 368..389

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

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

  def save_effort_breakdown
    authorize! :execute_estimation_plan, @project

    @pbs_project_element = current_component
    @tmp_results = Hash.new
Severity: Major
Found in app/controllers/wbs_activities_controller.rb - About 4 hrs to fix

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

        $("#views_widget_icon_class").change(function(){
            if ($(this).val() !== ""){
                $("#view_icon_class_image").removeClass();
                $("#view_icon_class_image").addClass( $(this).val());
                $("#view_icon_class_image").addClass( "icon-large blue" );
    Severity: Major
    Found in app/assets/javascripts/projestimate_script.js and 1 other location - About 4 hrs to fix
    app/assets/javascripts/projestimate_script.js on lines 598..608

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

    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

        $("#widget_icon_class").change(function(){
            if ($(this).val() !== ""){
                $("#icon_class_image").removeClass();
                $("#icon_class_image").addClass( $(this).val());
                $("#icon_class_image").addClass( "icon-large blue" );
    Severity: Major
    Found in app/assets/javascripts/projestimate_script.js and 1 other location - About 4 hrs to fix
    app/assets/javascripts/projestimate_script.js on lines 611..621

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

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

      def is_validate(val)
        pe_attribute = self.pe_attribute
        #if value is mandatory and not fill => false
        if self.is_mandatory and val.blank?
          false
    Severity: Minor
    Found in app/models/estimation_value.rb - About 4 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 doMouseMove has 101 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function doMouseMove(ctx, config, event) {
    
        font = "<font face=" + config.annotateFontFamily + " size=" + config.annotateFontSize + "px style=\"font-style:" + config.annotateFontStyle + ";color:" + config.annotateFontColor + "\">";
    
        var annotateDIV = document.getElementById('divCursor');
    Severity: Major
    Found in app/assets/javascripts/ChartNew.js - About 4 hrs to fix

      Function drawLines has 101 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

              function drawLines(animPc) {
              
                  var totvalue = new Array();
                  var maxvalue = new Array();
      
      
      Severity: Major
      Found in app/assets/javascripts/ChartNew.js - About 4 hrs to fix

        Function makeTarget has 100 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

                this.makeTarget = function(el, params, referenceParams) {                        
                    
                    var p = jsPlumb.extend({_jsPlumb:_currentInstance}, referenceParams);
                    jsPlumb.extend(p, params);
                    _setEndpointPaintStylesAndAnchor(p, 1);                                                    
        Severity: Major
        Found in app/assets/javascripts/jquery.jsPlumb-1.4.1-all.js - About 4 hrs to fix

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

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

            Method display_results_with_activities has 97 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              def display_results_with_activities(module_project)
                res = String.new
                pbs_project_element = @pbs_project_element || current_component
            
                pe_wbs_activity = module_project.project.pe_wbs_projects.activities_wbs.first
            Severity: Major
            Found in app/helpers/projects_helper.rb - About 3 hrs to fix

              Method display_effort_or_cost_per_phase has 97 lines of code (exceeds 25 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: Major
              Found in app/helpers/views_widgets_helper.rb - About 3 hrs to fix

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

                    setDataset: function(types, obj) {
                      types = $.splat(types);
                      for(var attr in obj) {
                        for(var i=0, val = $.splat(obj[attr]), l=types.length; i<l; i++) {
                          this.setData(attr, val[i], types[i]);
                Severity: Major
                Found in app/assets/javascripts/jit-2.0.1.js and 2 other locations - About 3 hrs to fix
                app/assets/javascripts/jit-2.0.1.js on lines 4439..4446
                app/assets/javascripts/jit-2.0.1.js on lines 4542..4549

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

                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

                    setCanvasStyles: function(types, obj) {
                      types = $.splat(types);
                      for(var attr in obj) {
                        for(var i=0, val = $.splat(obj[attr]), l=types.length; i<l; i++) {
                          this.setCanvasStyle(attr, val[i], types[i]);
                Severity: Major
                Found in app/assets/javascripts/jit-2.0.1.js and 2 other locations - About 3 hrs to fix
                app/assets/javascripts/jit-2.0.1.js on lines 4330..4337
                app/assets/javascripts/jit-2.0.1.js on lines 4542..4549

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

                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

                    setLabelDataset: function(types, obj) {
                      types = $.splat(types);
                      for(var attr in obj) {
                        for(var i=0, val = $.splat(obj[attr]), l=types.length; i<l; i++) {
                          this.setLabelData(attr, val[i], types[i]);
                Severity: Major
                Found in app/assets/javascripts/jit-2.0.1.js and 2 other locations - About 3 hrs to fix
                app/assets/javascripts/jit-2.0.1.js on lines 4330..4337
                app/assets/javascripts/jit-2.0.1.js on lines 4439..4446

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

                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

                                anchorLoc = this.endpoints[0].anchor.compute( {
                                    xy : [ myOffset.left, myOffset.top ], wh : myWH, element : this.endpoints[0],
                                    elementId:this.endpoints[0].elementId,
                                    txy : [ otherOffset.left, otherOffset.top ], twh : otherWH, tElement : this.endpoints[1],
                                    timestamp:initialTimestamp
                Severity: Major
                Found in app/assets/javascripts/jquery.jsPlumb-1.4.1-all.js and 1 other location - About 3 hrs to fix
                app/assets/javascripts/jquery.jsPlumb-1.4.1-all.js on lines 5876..5881

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

                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

                            anchorLoc = this.endpoints[1].anchor.compute( {
                                xy : [ otherOffset.left, otherOffset.top ], wh : otherWH, element : this.endpoints[1],
                                elementId:this.endpoints[1].elementId,                
                                txy : [ myOffset.left, myOffset.top ], twh : myWH, tElement : this.endpoints[0],
                                timestamp:initialTimestamp                
                Severity: Major
                Found in app/assets/javascripts/jquery.jsPlumb-1.4.1-all.js and 1 other location - About 3 hrs to fix
                app/assets/javascripts/jquery.jsPlumb-1.4.1-all.js on lines 5867..5872

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

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

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

                  $.fn.dropdown = function (option) {
                    return this.each(function () {
                      var $this = $(this)
                        , data = $this.data('dropdown')
                      if (!data) $this.data('dropdown', (data = new Dropdown(this)))
                Severity: Major
                Found in app/assets/javascripts/bootstrap.js and 1 other location - About 3 hrs to fix
                app/assets/javascripts/bootstrap.js on lines 132..139

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

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

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

                  $.fn.alert = function (option) {
                    return this.each(function () {
                      var $this = $(this)
                        , data = $this.data('alert')
                      if (!data) $this.data('alert', (data = new Alert(this)))
                Severity: Major
                Found in app/assets/javascripts/bootstrap.js and 1 other location - About 3 hrs to fix
                app/assets/javascripts/bootstrap.js on lines 772..779

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

                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