estimancy/projestimate

View on GitHub

Showing 836 of 1,675 total issues

Method display_effort_balancing_input has a Cognitive Complexity of 24 (exceeds 5 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: Minor
Found in app/helpers/projects_helper.rb - About 3 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

File wbs_activities_controller.rb has 309 lines of code (exceeds 250 allowed). Consider refactoring.
Open

require 'will_paginate/array'

class WbsActivitiesController < ApplicationController
  #include DataValidationHelper #Module for master data changes validation
  include ModuleProjectsHelper
Severity: Minor
Found in app/controllers/wbs_activities_controller.rb - About 3 hrs to fix

    Function start has 85 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

                var start = function() {    
                // drag might have started on an endpoint that is not actually a source, but which has
                // one or more connections.
                    jpc = self.connectorSelector();
                    var _continue = true;
    Severity: Major
    Found in app/assets/javascripts/jquery.jsPlumb-1.4.1-all.js - About 3 hrs to fix

      Consider simplifying this complex logical expression.
      Open

                          if (cornerRadius > 0 && current[4] != next[4]) {
                              var radiusToUse = Math.min(cornerRadius, segLength(current), segLength(next));
                              // right angle. adjust current segment's end point, and next segment's start point.
                              current[2] -= current[5] * radiusToUse;
                              current[3] -= current[6] * radiusToUse;
      Severity: Critical
      Found in app/assets/javascripts/jquery.jsPlumb-1.4.1-all.js - About 3 hrs to fix

        Consider simplifying this complex logical expression.
        Open

        if (!document.createElement('canvas').getContext) {
        
        (function() {
        
          // alias some functions to make (compiled) code shorter
        Severity: Critical
        Found in app/assets/javascripts/jit-2.0.1-excanvas.js - About 3 hrs to fix

          Function keydown has 83 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                  keydown: function(e){
                      if (this.picker.is(':not(:visible)')){
                          if (e.keyCode == 27) // allow escape to hide and re-show picker
                              this.show();
                          return;
          Severity: Major
          Found in app/assets/javascripts/bootstrap-datepicker.js - About 3 hrs to fix

            Function dispCrossText has 82 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                function dispCrossText(ctx, config, posX, posY, borderX, borderY, overlay, data, animPC) {
                    var i, disptxt, txtposx, txtposy, txtAlign, txtBaseline;
            
                    for (i = 0; i < config.crossText.length; i++) {
                        if (config.crossText[i] != "" && config.crossTextOverlay[Min([i, config.crossTextOverlay.length - 1])] == overlay) {
            Severity: Major
            Found in app/assets/javascripts/ChartNew.js - About 3 hrs to fix

              Method get_chart_data_by_phase_and_profile has 82 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                def get_chart_data_by_phase_and_profile(pbs_project_element, module_project, estimation_value, view_widget)
                  result = String.new
                  stacked_data = Array.new
                  profiles_wbs_data = Hash.new
                  probable_est_value = estimation_value.send("string_data_probable")
              Severity: Major
              Found in app/helpers/views_widgets_helper.rb - About 3 hrs to fix

                File organization_duplicate_project_worker.rb has 303 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                class OrganizationDuplicateProjectWorker
                  include Sidekiq::Worker
                
                  def perform(est_model_id, new_organization_id, user_id)
                    est_model = Project.find(est_model_id)
                Severity: Minor
                Found in app/workers/organization_duplicate_project_worker.rb - About 3 hrs to fix

                  Method display_inputs_without_activities has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
                  Open

                    def display_inputs_without_activities(module_project)
                      pbs_project_element = current_component
                      res = String.new
                  
                      if module_project.compatible_with(current_component.work_element_type.alias) || current_component
                  Severity: Minor
                  Found in app/helpers/projects_helper.rb - About 3 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 plotElement has 80 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    plotElement: function(elem, canvas, opt) {
                      var gl = canvas.getCtx(),
                          viewMatrix = new Matrix4,
                          lighting = canvas.config.Scene.Lighting,
                          wcanvas = canvas.canvases[0],
                  Severity: Major
                  Found in app/assets/javascripts/jit-2.0.1.js - About 3 hrs to fix

                    Method display_balancing_input has 80 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      def display_balancing_input(module_project, last_estimation_result)
                        pbs_project_element = current_component
                        #Get the current balancing attribute
                        @current_balancing_attribute = current_balancing_attribute
                    
                    
                    Severity: Major
                    Found in app/helpers/projects_helper.rb - About 3 hrs to fix

                      Function drawPieSegments has 79 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                              function drawPieSegments(animationDecimal) {
                      
                      
                      
                                  var cumulativeAngle = -config.startAngle * (Math.PI / 180)+2*Math.PI ,
                      Severity: Major
                      Found in app/assets/javascripts/ChartNew.js - About 3 hrs to fix

                        Function appendFill has 79 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                          function appendFill(ctx, lineStr, min, max) {
                            var fillStyle = ctx.fillStyle;
                            var arcScaleX = ctx.arcScaleX_;
                            var arcScaleY = ctx.arcScaleY_;
                            var width = max.x - min.x;
                        Severity: Major
                        Found in app/assets/javascripts/jit-2.0.1-excanvas.js - About 3 hrs to fix

                          Function initSort has 78 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                                      function initSort(table, cell, e){
                                          var a, i, j, o, s,
                                              c = table.config,
                                              k = !e[c.sortMultiSortKey],
                                              $this = $(table);
                          Severity: Major
                          Found in app/assets/javascripts/pager.js - About 3 hrs to fix

                            Method import has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
                            Open

                              def self.import(file, sep)
                                #find localstatus
                                @localstatus = RecordStatus.find_by_name('Local')
                            
                                #create wbs_activity
                            Severity: Minor
                            Found in app/models/wbs_activity_element.rb - About 3 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 append_pemodule has a Cognitive Complexity of 22 (exceeds 5 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: Minor
                            Found in app/controllers/projects_controller.rb - About 3 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 drawImage has 77 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                              contextPrototype.drawImage = function(image, var_args) {
                                var dx, dy, dw, dh, sx, sy, sw, sh;
                            
                                // to find the original width we overide the width and height
                                var oldRuntimeWidth = image.runtimeStyle.width;
                            Severity: Major
                            Found in app/assets/javascripts/jit-2.0.1-excanvas.js - About 3 hrs to fix

                              Function drawPieSegments has 76 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                      function drawPieSegments(animationDecimal) {
                                          var cumulativeAngle = -config.startAngle * (Math.PI / 180)+2*Math.PI ,
                                             cumvalue = 0,
                                                   scaleAnimation = 1,
                                                   rotateAnimation = 1;
                              Severity: Major
                              Found in app/assets/javascripts/ChartNew.js - About 3 hrs to fix

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

                                  def create
                                    @is_model = params[:project][:is_model]
                                    if @is_model == "true"
                                      authorize! :manage_estimation_models, Project
                                    else
                                Severity: Major
                                Found in app/controllers/projects_controller.rb - About 3 hrs to fix
                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language