estimancy/projestimate

View on GitHub

Showing 1,675 of 1,675 total issues

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

            _attr(p1_2, {
                "d"        :    makePath(params.headLine[0], params.headLine[1]),
                stroke     :     "green",
                fill     :     null,
                transform:"translate(" + offset[0] + "," + offset[1] + ")"
Severity: Major
Found in app/assets/javascripts/jquery.jsPlumb-1.4.1-all.js and 1 other location - About 1 hr to fix
app/assets/javascripts/jquery.jsPlumb-1.4.1-all.js on lines 9206..9211

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

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 (len) {
                    for (indx = 0; indx < len; indx++) {
                        // add primary. secondary, tertiary, etc sort column classes
                        $rows.filter('[data-column="' + sortList[indx][0] + '"]').addClass(css[indx] || css[last]);
                    }
Severity: Major
Found in app/assets/javascripts/tablesorter.min.js and 1 other location - About 1 hr to fix
app/assets/javascripts/pager.js on lines 1988..1993

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

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

            _attr(p1_1, {
                "d"        :    makePath(params.tailLine[0], params.tailLine[1]),
                stroke     :     "blue",
                fill     :     null,
                transform:"translate(" + offset[0] + "," + offset[1] + ")"
Severity: Major
Found in app/assets/javascripts/jquery.jsPlumb-1.4.1-all.js and 1 other location - About 1 hr to fix
app/assets/javascripts/jquery.jsPlumb-1.4.1-all.js on lines 9213..9218

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

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 = 0, il = last.length; i < il; i++) {
            if ($.inArray(last[i], new_colliders_coords) === -1) {
                start_callback.call(this, last[i]);
            }
        }
Severity: Major
Found in app/assets/javascripts/jquery.gridster.js and 1 other location - About 1 hr to fix
app/assets/javascripts/jquery.gridster.js on lines 246..251

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

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

  loadJSON: function(json) {
    var prefix = $.time(), 
        ch = [], 
        delegate = this.delegate,
        name = $.splat(json.label),
Severity: Minor
Found in app/assets/javascripts/jit-2.0.1.js - About 1 hr to fix

    Function Anchor has 48 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        jsPlumb.Anchor = function(params) {
            var self = this;
            this.x = params.x || 0;
            this.y = params.y || 0;
            this.elementId = params.elementId;        
    Severity: Minor
    Found in app/assets/javascripts/jquery.jsPlumb-1.4.1-all.js - About 1 hr to fix

      Function _process_options has 48 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

              _process_options: function(opts){
                  // Store raw options for reference
                  this._o = $.extend({}, this._o, opts);
                  // Processed options
                  var o = this.o = $.extend({}, this._o);
      Severity: Minor
      Found in app/assets/javascripts/bootstrap-datepicker.js - About 1 hr to fix

        Function generate_stylesheet has 48 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            fn.generate_stylesheet = function(opts) {
                var styles = '';
                var max_size_x = this.options.max_size_x || this.cols;
                var max_rows = 0;
                var max_cols = 0;
        Severity: Minor
        Found in app/assets/javascripts/jquery.gridster.js - About 1 hr to fix

          Method show_element_name has 48 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            def show_element_name(element)
              if element.attributes.has_key? 'record_status_id'
                if element.is_root?
                  "<span class='#{h element.record_status.to_s }'>#{h element.name} </span>"
                else
          Severity: Minor
          Found in app/helpers/wbs_activity_elements_helper.rb - About 1 hr to fix

            Method edit has 48 lines of code (exceeds 25 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 1 hr to fix

              Method generate_wbs_project_elt_tree has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
              Open

                def generate_wbs_project_elt_tree(element, tree, show_hidden=false, is_project_show_view=false)
                  #Root is always display
                  gap = 2.5
                  tree ||= String.new
                  unless element.nil?
              Severity: Minor
              Found in app/helpers/wbs_activity_elements_helper.rb - About 1 hr 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_text_field_tag has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
              Open

                def display_text_field_tag(level, est_val, module_project, level_estimation_values, pbs_project_element, attribute_type="", read_only_value=false)
              
                  est_val_pe_attribute = est_val.pe_attribute
                  organization = module_project.project.organization
                  precision = est_val_pe_attribute.precision.nil? ? user_number_precision : est_val_pe_attribute.precision
              Severity: Minor
              Found in app/helpers/projects_helper.rb - About 1 hr 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 collapse_project_version has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
              Open

                def collapse_project_version
                  projects = Project.find_all_by_id(params[:project_ids])
                  flash_error = ""
                  Project.transaction do
                    projects.each do |project|
              Severity: Minor
              Found in app/controllers/projects_controller.rb - About 1 hr 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 3 locations. Consider refactoring.
              Open

                          if (a < Math.abs(1)) { a = 1; var s = p / 4; }
                          else var s = p / (2 * Math.PI) * Math.asin(1 / a);
              Severity: Major
              Found in app/assets/javascripts/ChartNew.js and 2 other locations - About 1 hr to fix
              app/assets/javascripts/ChartNew.js on lines 628..629
              app/assets/javascripts/ChartNew.js on lines 635..636

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

              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

                          if (a < Math.abs(1)) { a = 1; var s = p / 4; }
                          else var s = p / (2 * Math.PI) * Math.asin(1 / a);
              Severity: Major
              Found in app/assets/javascripts/ChartNew.js and 2 other locations - About 1 hr to fix
              app/assets/javascripts/ChartNew.js on lines 635..636
              app/assets/javascripts/ChartNew.js on lines 642..643

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

              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

                          if (a < Math.abs(1)) { a = 1; var s = p / 4; }
                          else var s = p / (2 * Math.PI) * Math.asin(1 / a);
              Severity: Major
              Found in app/assets/javascripts/ChartNew.js and 2 other locations - About 1 hr to fix
              app/assets/javascripts/ChartNew.js on lines 628..629
              app/assets/javascripts/ChartNew.js on lines 642..643

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

              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 (col) {
                          $widgets = $widgets.add(
                              this.$widgets.filter(function() {
                                  var tcol = $(this).attr('data-col');
                                  return (tcol === col || tcol > col);
              Severity: Major
              Found in app/assets/javascripts/jquery.gridster.js and 1 other location - About 1 hr to fix
              app/assets/javascripts/jquery.gridster.js on lines 3579..3586

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

              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 (row) {
                          $widgets = $widgets.add(
                              this.$widgets.filter(function() {
                                  var trow = $(this).attr('data-row');
                                  return (trow === row || trow > row);
              Severity: Major
              Found in app/assets/javascripts/jquery.gridster.js and 1 other location - About 1 hr to fix
              app/assets/javascripts/jquery.gridster.js on lines 3570..3577

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

              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 (number_of_checked_elt==0 || number_of_checked_elt < number_of_elt)
                          $('.'+cols_data_name+'_'+group_id).attr("checked", true);
                      else
                          $('.'+cols_data_name+'_'+group_id).attr("checked", false);
              Severity: Major
              Found in app/assets/javascripts/projestimate_script.js and 1 other location - About 1 hr to fix
              app/assets/javascripts/projestimate_script.js on lines 854..857

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

              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 (number_of_checked_elt==0 || number_of_checked_elt < number_of_elt)
                              $('.'+rows_data_name+'_'+permission_id).attr("checked", true);
                          else
                              $('.'+rows_data_name+'_'+permission_id).attr("checked", false);
              Severity: Major
              Found in app/assets/javascripts/projestimate_script.js and 1 other location - About 1 hr to fix
              app/assets/javascripts/projestimate_script.js on lines 841..844

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

              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