estimancy/projestimate

View on GitHub

Showing 1,675 of 1,675 total issues

Avoid deeply nested control flow statements.
Open

                        if(config.inGraphDataXPosition==1) { xPos=barOffset+config.inGraphDataPaddingX; } 
                        else if(config.inGraphDataXPosition==2) { xPos=barOffset+barWidth/2+config.inGraphDataPaddingX ;}
                        else if(config.inGraphDataXPosition==3) { xPos=barOffset+barWidth+config.inGraphDataPaddingX;} 
Severity: Major
Found in app/assets/javascripts/ChartNew.js - About 45 mins to fix

    Avoid deeply nested control flow statements.
    Open

                                if (typeof (data.labels[j]) == "string") lgtxt2 = data.labels[j].trim();
                                else lgtxt2 = "";
    Severity: Major
    Found in app/assets/javascripts/ChartNew.js - About 45 mins to fix

      Avoid deeply nested control flow statements.
      Open

                              if (ylabels[i].trim() != "") {
                                  var textLength = ctx.measureText(fmtChartJS(config,ylabels[i],config.fmtYLabel)).width;
                                  //If the text length is longer - make that equal to longest text!
                                  widestYLabel = (textLength > widestYLabel) ? textLength : widestYLabel;
                              }
      Severity: Major
      Found in app/assets/javascripts/ChartNew.js - About 45 mins to fix

        Avoid deeply nested control flow statements.
        Open

                                if (typeof (data[i].title) == "string") {
                                    if (data[i].title.trim() != "") {
                                        nbeltLegend++;
                                        var textLength = ctx.measureText(data[i].title).width;
                                        //If the text length is longer - make that equal to longest text!
        Severity: Major
        Found in app/assets/javascripts/ChartNew.js - About 45 mins to fix

          Method import_user_from_ldap has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

            def import_user_from_ldap(ldap_cn, login, ldap_server)
              login_filter = Net::LDAP::Filter.eq ldap_server.user_name_attribute, "#{login}"
              object_filter = Net::LDAP::Filter.eq 'objectClass', '*'
              #is_an_automatic_account_activation? ? status = 'active' : status = 'pending'
          
          
          Severity: Minor
          Found in app/models/user.rb - About 45 mins 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

          Avoid deeply nested control flow statements.
          Open

                                  if (typeof (data.datasets[i].title) == "string") {
          
                                      if (data.datasets[i].title.trim() != "") {
                                          nbeltLegend++;
                                          var textLength = ctx.measureText(data.datasets[i].title).width;
          Severity: Major
          Found in app/assets/javascripts/ChartNew.js - About 45 mins to fix

            Avoid deeply nested control flow statements.
            Open

                                       if(config.inGraphDataRotate=="inRadiusAxis" || posAngle< Math.PI/2 || (posAngle > 3*Math.PI/2 && posAngle < 5*Math.PI/2))ctx.textAlign = "left";
                                       else ctx.textAlign="right";
            Severity: Major
            Found in app/assets/javascripts/ChartNew.js - About 45 mins to fix

              Avoid deeply nested control flow statements.
              Open

                                      if (typeof (data.labels[j]) == "string") lgtxt2 = data.labels[j].trim();
                                      else lgtxt2 = "";
              Severity: Major
              Found in app/assets/javascripts/ChartNew.js - About 45 mins to fix

                Avoid deeply nested control flow statements.
                Open

                                         else if(config.inGraphDataVAlign=="to-center"){
                                            if((posAngle> Math.PI && posAngle<2*Math.PI) || (posAngle< 0 && posAngle>-Math.PI) || (posAngle< -2*Math.PI && posAngle>-3*Math.PI))ctx.textBaseline = "bottom";
                                            else ctx.textBaseline = "top";
                                         }
                                         else ctx.textBaseline = config.inGraphDataVAlign;
                Severity: Major
                Found in app/assets/javascripts/ChartNew.js - About 45 mins to fix

                  Avoid deeply nested control flow statements.
                  Open

                                          if (typeof (data.labels[j]) == "string") lgtxt2 = data.labels[j].trim();
                                          else lgtxt2 = "";
                  Severity: Major
                  Found in app/assets/javascripts/ChartNew.js - About 45 mins to fix

                    Avoid deeply nested control flow statements.
                    Open

                                                if (typeof (data.labels[j]) == "string") lgtxt2 = data.labels[j].trim();
                                                else lgtxt2 = "";
                    Severity: Major
                    Found in app/assets/javascripts/ChartNew.js - About 45 mins to fix

                      Avoid deeply nested control flow statements.
                      Open

                                              if(config.inGraphDataXPosition==1) { xPos=yAxisPosX +config.inGraphDataPaddingX; } 
                                              else if(config.inGraphDataXPosition==2) { xPos=yAxisPosX + (HorizontalCalculateOffset(data.datasets[i].data[j], calculatedScale, valueHop) + (config.barStrokeWidth / 2))/2+config.inGraphDataPaddingX ;}
                                              else if(config.inGraphDataXPosition==3) { xPos=yAxisPosX + HorizontalCalculateOffset(data.datasets[i].data[j], calculatedScale, valueHop) + (config.barStrokeWidth / 2) +config.inGraphDataPaddingX ;}
                      Severity: Major
                      Found in app/assets/javascripts/ChartNew.js - About 45 mins to fix

                        Avoid deeply nested control flow statements.
                        Open

                                      unless new_group.nil?
                                        new_group.users = group.users
                                        new_group.save
                                      end
                        Severity: Major
                        Found in app/controllers/organizations_controller.rb - About 45 mins to fix

                          Method convert_label has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                          Open

                            def convert_label(v, organization)
                              unless v.class == Hash
                                value = v.to_f
                                if value < organization.limit1.to_i
                                  organization.limit1_unit
                          Severity: Minor
                          Found in app/helpers/projects_helper.rb - About 45 mins 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

                          Avoid deeply nested control flow statements.
                          Open

                                                                      nullity_condition ? nil : level_estimation_values[pbs_project_element.id][wbs_project_elt.id],
                          Severity: Major
                          Found in app/helpers/projects_helper.rb - About 45 mins to fix

                            Avoid deeply nested control flow statements.
                            Open

                                                                        nullity_condition ? level_estimation_values["default_#{level}".to_sym] : level_estimation_values[pbs_project_element.id][wbs_project_elt.id],
                            Severity: Major
                            Found in app/helpers/projects_helper.rb - About 45 mins to fix

                              Method confirm_deletion has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                              Open

                                def confirm_deletion
                                  @project = Project.find(params[:project_id])
                                  authorize! :delete_project, @project
                              
                                  @from_tree_history_view = params[:from_tree_history_view]
                              Severity: Minor
                              Found in app/controllers/projects_controller.rb - About 45 mins 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

                              Avoid deeply nested control flow statements.
                              Open

                                          if new_view_saved_as.save
                                            #Copy current view widgets to the new created view
                                            selected_view.views_widgets.each do |view_widget|
                                              #widget_est_val = view_widget.estimation_value
                                              #in_out = widget_est_val.nil? ? "output" : widget_est_val.in_out
                              Severity: Major
                              Found in app/controllers/module_projects_controller.rb - About 45 mins to fix

                                Avoid deeply nested control flow statements.
                                Open

                                                  estimation_value_id = new_estimation_value.nil? ? nil : new_estimation_value.id
                                Severity: Major
                                Found in app/controllers/organizations_controller.rb - About 45 mins to fix

                                  Method convert has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                                  Open

                                    def convert(v, organization)
                                      unless v.class == Hash
                                        value = v.to_f
                                        if value < organization.limit1.to_i
                                          convert_with_precision(value / organization.limit1_coef.to_f, user_number_precision)
                                  Severity: Minor
                                  Found in app/helpers/projects_helper.rb - About 45 mins 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