estimancy/projestimate

View on GitHub

Showing 836 of 1,675 total issues

Consider simplifying this complex logical expression.
Open

                    if (searchFiltered) {
                        // cycle through all filters; include last (columnIndex + 1 = match any column). Fixes #669
                        for (indx = 0; indx < columnIndex + 1; indx++) {
                            val = filters[indx] || '';
                            // break out of loop if we've already determined not to search filtered rows
Severity: Critical
Found in app/assets/javascripts/tablesorter.min.js - About 3 hrs to fix

    Function Straight has 74 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

            Straight : function(params) {
                var self = this,
                    _super = jsPlumb.Segments.AbstractSegment.apply(this, arguments),
                    length, m, m2, x1, x2, y1, y2,
                    _recalc = function() {
    Severity: Major
    Found in app/assets/javascripts/jquery.jsPlumb-1.4.1-all.js - About 2 hrs to fix

      Function mutate_widget_in_gridmap has 74 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          fn.mutate_widget_in_gridmap = function($widget, wgd, new_wgd) {
              var old_size_x = wgd.size_x;
              var old_size_y = wgd.size_y;
      
              var old_cells_occupied = this.get_cells_occupied(wgd);
      Severity: Major
      Found in app/assets/javascripts/jquery.gridster.js - About 2 hrs to fix

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

          def update
            @user = User.find(params[:id])
            if current_user != @user
              authorize! :manage, User
            end
        Severity: Major
        Found in app/controllers/users_controller.rb - About 2 hrs to fix

          Function StateMachine has 73 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              jsPlumb.Connectors.StateMachine = function(params) {
                  params = params || {};
                  this.type = "StateMachine";
          
                  var self = this,
          Severity: Major
          Found in app/assets/javascripts/jquery.jsPlumb-1.4.1-all.js - About 2 hrs to fix

            Method build_ancestry has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
            Open

              def self.build_ancestry(elements, activity_id)
                elements.each do |elt|
                  ActiveRecord::Base.transaction do
                    hierarchy = elt.dotted_id
                    ancestors = []
            Severity: Minor
            Found in app/models/wbs_activity_element.rb - About 2 hrs to fix

            Cognitive Complexity

            Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

            A method's cognitive complexity is based on a few simple rules:

            • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
            • Code is considered more complex for each "break in the linear flow of the code"
            • Code is considered more complex when "flow breaking structures are nested"

            Further reading

            Method create has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
            Open

              def create
                authorize! :manage_estimation_widgets, @project
            
                # Add the position_x and position_y to params
                @view_id = params[:views_widget][:view_id]
            Severity: Minor
            Found in app/controllers/views_widgets_controller.rb - About 2 hrs to fix

            Cognitive Complexity

            Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

            A method's cognitive complexity is based on a few simple rules:

            • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
            • Code is considered more complex for each "break in the linear flow of the code"
            • Code is considered more complex when "flow breaking structures are nested"

            Further reading

            Method compute_probable_value has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
            Open

              def compute_probable_value(minimum, most_likely, maximum, estimation_value=nil)
                # Get the number of not null value
                input_data = {:min => minimum, :ml => most_likely, :max => maximum}
                not_integer_or_float = Array.new
                sum_of_not_null = 0.0
            Severity: Minor
            Found in app/helpers/module_projects_helper.rb - About 2 hrs to fix

            Cognitive Complexity

            Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

            A method's cognitive complexity is based on a few simple rules:

            • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
            • Code is considered more complex for each "break in the linear flow of the code"
            • Code is considered more complex when "flow breaking structures are nested"

            Further reading

            Function drawScale has 72 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                    function drawScale() {
            
                        var rotationDegree = (2 * Math.PI) / data.datasets[0].data.length;
                        ctx.save();
                        ctx.translate(midPosX, midPosY);
            Severity: Major
            Found in app/assets/javascripts/ChartNew.js - About 2 hrs to fix

              Function drawText_ has 72 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                contextPrototype.drawText_ = function(text, x, y, maxWidth, stroke) {
                  var m = this.m_,
                      delta = 1000,
                      left = 0,
                      right = delta,
              Severity: Major
              Found in app/assets/javascripts/jit-2.0.1-excanvas.js - About 2 hrs to fix

                Function _drop has 71 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                                _drop = function() {
                
                                    var originalEvent = jsPlumb.CurrentLibrary.getDropEvent(arguments),
                                        targetCount = _currentInstance.select({target:elid}).length;                                                                                            
                
                
                Severity: Major
                Found in app/assets/javascripts/jquery.jsPlumb-1.4.1-all.js - About 2 hrs to fix

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

                    def create
                      authorize! :create_organizations, Organization
                  
                      @organization = Organization.new(params[:organization])
                  
                  
                  Severity: Major
                  Found in app/controllers/organizations_controller.rb - About 2 hrs to fix

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

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

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

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

                        Function stroke has 69 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

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

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

                            def display_effort_balancing_input(module_project, last_estimation_result)
                              pbs_project_element = current_component
                              res = String.new
                              if module_project.compatible_with(current_component.work_element_type.alias) || current_component
                                pemodule = Pemodule.find(module_project.pemodule.id)
                          Severity: Major
                          Found in app/helpers/projects_helper.rb - About 2 hrs to fix

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

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

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

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

                              Cognitive Complexity

                              Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                              A method's cognitive complexity is based on a few simple rules:

                              • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                              • Code is considered more complex for each "break in the linear flow of the code"
                              • Code is considered more complex when "flow breaking structures are nested"

                              Further reading

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

                                def display_effort_balancing_output(module_project)
                                  pbs_project_element = @pbs_project_element || current_component
                                  res = String.new
                                  if module_project.compatible_with(current_component.work_element_type.alias) || current_component
                                    pemodule = Pemodule.find(module_project.pemodule.id)
                              Severity: Minor
                              Found in app/helpers/projects_helper.rb - About 2 hrs to fix

                              Cognitive Complexity

                              Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                              A method's cognitive complexity is based on a few simple rules:

                              • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                              • Code is considered more complex for each "break in the linear flow of the code"
                              • Code is considered more complex when "flow breaking structures are nested"

                              Further reading

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

                                def edit
                                  set_page_title 'Edit estimation'
                              
                                  @project = Project.find(params[:id])
                                  @organization = @project.organization
                              Severity: Minor
                              Found in app/controllers/projects_controller.rb - About 2 hrs to fix

                              Cognitive Complexity

                              Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                              A method's cognitive complexity is based on a few simple rules:

                              • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                              • Code is considered more complex for each "break in the linear flow of the code"
                              • Code is considered more complex when "flow breaking structures are nested"

                              Further reading

                              Severity
                              Category
                              Status
                              Source
                              Language