estimancy/projestimate

View on GitHub

Showing 1,675 of 1,675 total issues

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

    delegate.config.offsetY = -size.height/2 + margin.bottom 
      + (config.showLabels && (config.labelOffset + config.Label.size));
Severity: Major
Found in app/assets/javascripts/jit-2.0.1.js and 1 other location - About 1 hr to fix
app/assets/javascripts/jit-2.0.1.js on lines 11289..11290

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

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

            c.$table
                .removeClass('hasResizable')
                .children('thead')
                .unbind('mouseup.tsresize mouseleave.tsresize contextmenu.tsresize')
                .children('tr').children()
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 2819..2826

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

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

    $("#technology").change(function() {
        return $.ajax({
            url: "/change_abacus",
            method: "GET",
            data: "technology=" + $(this).val()
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 568..574

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

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

            switch(o.startView){
                case 2:
                case 'decade':
                    o.startView = 2;
                    break;
Severity: Major
Found in app/assets/javascripts/bootstrap-datepicker.js and 1 other location - About 1 hr to fix
app/assets/javascripts/bootstrap-datepicker.js on lines 125..136

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

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

    function $design(node, maxsize, acum) {
      var sval = node.getData(s, prop);
      var notsval = maxsize
          || (node.getData(nots, prop));

Severity: Minor
Found in app/assets/javascripts/jit-2.0.1.js - About 1 hr to fix

    Function updateJSON has 32 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      updateJSON: function(json, onComplete) {
        if(this.busy) return;
        this.busy = true;
        
        var delegate = this.delegate;
    Severity: Minor
    Found in app/assets/javascripts/jit-2.0.1.js - About 1 hr to fix

      Function setEndpoint has 32 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

              this.setEndpoint = function(ep) {
      
                  var _e = function(t, p) {
                      var rm = _jsPlumb.getRenderMode();
                      if (jsPlumb.Endpoints[rm][t]) return new jsPlumb.Endpoints[rm][t](p);
      Severity: Minor
      Found in app/assets/javascripts/jquery.jsPlumb-1.4.1-all.js - About 1 hr to fix

        Function getPath has 32 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

                    getPath : function(segment) {
                        return ({
                            "Straight":function(segment) {
                                var d = segment.params;
                                return "m" + _conv(d.x1) + "," + _conv(d.y1) + " l" + _conv(d.x2) + "," + _conv(d.y2) + " e";
        Severity: Minor
        Found in app/assets/javascripts/jquery.jsPlumb-1.4.1-all.js - About 1 hr to fix

          Function on_drag has 32 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              fn.on_drag = function(event, ui) {
                  //break if dragstop has been fired
                  if (this.$player === null) {
                      return false;
                  }
          Severity: Minor
          Found in app/assets/javascripts/jquery.gridster.js - About 1 hr to fix

            Function getClassNames has 32 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                    getClassNames: function(date){
                        var cls = [],
                            year = this.viewDate.getUTCFullYear(),
                            month = this.viewDate.getUTCMonth(),
                            currentDate = this.date.valueOf(),
            Severity: Minor
            Found in app/assets/javascripts/bootstrap-datepicker.js - About 1 hr to fix

              Function multisort has 32 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                          function multisort(table) { /*jshint loopfunc:true */
                              var dir = 0, tc = table.config,
                                  sortList = tc.sortList, l = sortList.length, bl = table.tBodies.length,
                                  sortTime, i, k, c, colMax, cache, lc, s, order, orgOrderCol;
                              if (tc.serverSideSorting || !tc.cache[0]) { // empty table - fixes #206
              Severity: Minor
              Found in app/assets/javascripts/pager.js - About 1 hr to fix

                Method update_install has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  def update_install
                  #No authorize required
                  begin
                      expire_fragment('about_page')
                
                
                Severity: Minor
                Found in app/controllers/homes_controller.rb - About 1 hr to fix

                  Method update has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    def update
                      authorize! :edit_organizations, Organization
                  
                      @organization = Organization.find(params[:id])
                      if @organization.update_attributes(params[:organization])
                  Severity: Minor
                  Found in app/controllers/organizations_controller.rb - About 1 hr to fix

                    Method show_project_history has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      def show_project_history
                        #No authorize required as authorizations are manage  in each called function...
                        @counter = params['counter']
                        checked_node_ids = params['checked_node_ids']
                        action_id = params['action_id']
                    Severity: Minor
                    Found in app/controllers/projects_controller.rb - About 1 hr to fix

                      Method add_filter_on_project_version has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                        def add_filter_on_project_version
                          #No authorize required
                          selected_filter_version = params[:filter_selected]
                          #"Display leaves projects only",1], ["Display all versions",2], ["Display root version only",3], ["Most recent version",4]
                      
                      
                      Severity: Minor
                      Found in app/controllers/projects_controller.rb - About 1 hr to fix

                        Function select_or_unselect_all has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                        Open

                        function select_or_unselect_all(clicked_elt){
                            var mp_id = $(clicked_elt).data("mp_id");
                            var rows_or_cols = $(clicked_elt).data("rows_or_cols");
                            var at_least_one_selected = false;
                            var number_of_elt = 0;
                        Severity: Minor
                        Found in app/assets/javascripts/projestimate_script.js - 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

                        Function bind has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                        Open

                            bind : function() {
                                var matchClass = new RegExp('(^|\\s)('+jscolor.bindClass+')(\\s*(\\{[^}]*\\})|\\s|$)', 'i');
                                var e = document.getElementsByTagName('input');
                                for(var i=0; i<e.length; i+=1) {
                                    var m;
                        Severity: Minor
                        Found in app/assets/javascripts/jscolor.js - 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

                        Function setMeasures has 10 arguments (exceeds 4 allowed). Consider refactoring.
                        Open

                            function setMeasures(data, config, ctx, height, width, ylabels, reverseLegend, reverseAxis, drawAxis, drawLegendOnData) {
                        Severity: Major
                        Found in app/assets/javascripts/ChartNew.js - About 1 hr to fix

                          Method update_link_between_modules has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                          Open

                            def update_link_between_modules(project, module_project, last_position_x=nil)
                              authorize! :alter_estimation_plan, project
                          
                              return if @initialization_module.nil?
                              initialization_mod_proj = project.module_projects.find_by_pemodule_id(@initialization_module.id)
                          Severity: Minor
                          Found in app/controllers/pemodules_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

                          Method set_technology_size_type_abacus has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                          Open

                            def set_technology_size_type_abacus
                              authorize! :edit_organizations, Organization
                          
                              @organization = Organization.find(params[:organization])
                              @technologies = @organization.organization_technologies
                          Severity: Minor
                          Found in app/controllers/organizations_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

                          Severity
                          Category
                          Status
                          Source
                          Language