estimancy/projestimate

View on GitHub

Showing 836 of 1,675 total issues

Method dashboard has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring.
Open

  def dashboard
    authorize! :show_project, @project

    # return if user doesn't have the rigth to consult the estimation
    if !can_show_estimation?(@project)
Severity: Minor
Found in app/controllers/projects_controller.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 _doOne has 118 lines of code (exceeds 25 allowed). Consider refactoring.
Open

                _doOne = function(_el) {
                    // get the element's id and store the endpoint definition for it.  jsPlumb.connect calls will look for one of these,
                    // and use the endpoint definition if found.
                    var elid = _getId(_el),
                        parentElement = function() {
Severity: Major
Found in app/assets/javascripts/jquery.jsPlumb-1.4.1-all.js - About 4 hrs to fix

    Function DragManager has 117 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        var DragManager = function(_currentInstance) {        
            var _draggables = {}, _dlist = [], _delements = {}, _elementsWithEndpoints = {},            
                // elementids mapped to the draggable to which they belong.
                _draggablesForElements = {};
    
    
    Severity: Major
    Found in app/assets/javascripts/jquery.jsPlumb-1.4.1-all.js - About 4 hrs to fix

      Method update_records has 117 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        def self.update_records(external, local, fields)
          loc_defined_rs_id = RecordStatus.find_by_name('Defined').id
          loc_custom_rs_id = RecordStatus.find_by_name('Custom').id
          loc_local_rs_id = RecordStatus.find_by_name('Local').id
          ext_defined_rs_id = ExternalMasterDatabase::ExternalRecordStatus.find_by_name('Defined').id
      Severity: Major
      Found in app/models/home.rb - About 4 hrs to fix

        Function table_sorter_filter has 116 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        $(function table_sorter_filter() {
        
            var pagerOptions = {
        
                // target the pager markup - see the HTML block below
        Severity: Major
        Found in app/assets/javascripts/pager.js - About 4 hrs to fix

          Function findRows has 114 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                              findRows = function(filter, v, cv){
                                  var $tb, $tr, $td, cr, r, l, ff, time, r1, r2, searchFiltered;
                                  if (c.debug) { time = new Date(); }
                                  for (k = 0; k < b.length; k++ ){
                                      if (b.eq(k).hasClass(c.cssInfoBlock)) { continue; } // ignore info blocks, issue #264
          Severity: Major
          Found in app/assets/javascripts/pager.js - About 4 hrs to fix

            Method display_inputs_with_activities has 113 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              def display_inputs_with_activities(module_project, last_estimation_result=nil)
                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 4 hrs to fix

              Function drop has 109 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                                  drop = function() {
              
                                      self["removeClass"](_jsPlumb.endpointDropAllowedClass);
                                      self["removeClass"](_jsPlumb.endpointDropForbiddenClass);
                                                                  
              Severity: Major
              Found in app/assets/javascripts/jquery.jsPlumb-1.4.1-all.js - About 4 hrs to fix

                Method duplicate has 109 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  def duplicate
                    # To duplicate a project user need to have the "show_project" and "create_project_from_scratch" authorizations
                    if params[:action_name] == "duplication"
                      authorize! :create_project_from_scratch, Project
                      # To Create a project from a template user need to have "create_project_from_template" authorization
                Severity: Major
                Found in app/controllers/projects_controller.rb - About 4 hrs to fix

                  Method execute_duplication_SAVE_NOT_WORKING has 107 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    def self.execute_duplication_SAVE_NOT_WORKING(project_id, parameters, create_from_template = nil)
                      #Project.transaction do
                        begin
                          old_prj = Project.find(project_id)
                  
                  
                  Severity: Major
                  Found in app/models/project.rb - About 4 hrs to fix

                    Method destroy has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
                    Open

                      def destroy
                        @project = Project.find(params[:id])
                        authorize! :delete_project, @project
                    
                        is_model = @project.is_model
                    Severity: Minor
                    Found in app/controllers/projects_controller.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 format has 106 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                            format: function(table, c, wo) {
                                if (c.$table.hasClass('hasResizable')) { return; }
                                c.$table.addClass('hasResizable');
                                ts.resizableReset(table, true); // set default widths
                                var $rows, $columns, $column, column, timer,
                    Severity: Major
                    Found in app/assets/javascripts/tablesorter.min.js - About 4 hrs to fix

                      Method dashboard has 104 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                        def dashboard
                          authorize! :show_project, @project
                      
                          # return if user doesn't have the rigth to consult the estimation
                          if !can_show_estimation?(@project)
                      Severity: Major
                      Found in app/controllers/projects_controller.rb - About 4 hrs to fix

                        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

                          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
                                    Severity
                                    Category
                                    Status
                                    Source
                                    Language