estimancy/projestimate

View on GitHub

Showing 836 of 1,675 total issues

Consider simplifying this complex logical expression.
Open

              if ((config.savePngFunction.split(' ')[1]=="left" && event.which==1) ||
                  (config.savePngFunction.split(' ')[1]=="middle" && event.which==2) ||
                  (config.savePngFunction.split(' ')[1]=="right" && event.which==3) ||
                  (typeof(config.savePngFunction.split(' ')[1])!="string")) saveCanvas(ctx,data,config,tpgraph); 
Severity: Major
Found in app/assets/javascripts/ChartNew.js - About 1 hr to fix

    Consider simplifying this complex logical expression.
    Open

                  if ((config.annotateFunction.split(' ')[1]=="left" && event.which==1) ||
                      (config.annotateFunction.split(' ')[1]=="middle" && event.which==2) ||
                      (config.annotateFunction.split(' ')[1]=="right" && event.which==3) ||
                      (typeof(config.annotateFunction.split(' ')[1])!="string")) doMouseMove(ctx, config, event) 
    Severity: Major
    Found in app/assets/javascripts/ChartNew.js - About 1 hr to fix

      Function select_or_unselect_all_permissions has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

      function select_or_unselect_all_permissions(clicked_elt, cols_data_name, rows_data_name, rows_or_cols_name){
          var group_id = $(clicked_elt).data(cols_data_name);
          var permission_id = $(clicked_elt).data(rows_data_name);
          var rows_or_cols = $(clicked_elt).data("rows_or_cols_"+rows_or_cols_name);
          var at_least_one_selected = false;
      Severity: Minor
      Found in app/assets/javascripts/projestimate_script.js - About 55 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

      Method update_field has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

        def self.update_field(view_widget, organization, project, component)
      
          organization.fields.each do |field|
      
            pf = ProjectField.where(field_id: field.id,
      Severity: Minor
      Found in app/models/views_widget.rb - About 55 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

      Method update_view_widget_positions has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

        def update_view_widget_positions
          views_widgets = params[:views_widgets]
          unless views_widgets.empty?
            views_widgets.each_with_index do |element, index|
              view_widget_hash = element.last
      Severity: Minor
      Found in app/controllers/views_widgets_controller.rb - About 55 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

      Method set_technology_size_unit_abacus has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

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

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

        def destroy
          @views_widget = ViewsWidget.find(params[:id])
          current_view = @views_widget.view
          pemodule_id = current_view.pemodule_id
          @module_project = @views_widget.module_project
      Severity: Minor
      Found in app/controllers/views_widgets_controller.rb - About 55 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

      Method save_values has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

        def save_values
          authorize! :manage_modules_instances, ModuleProject
          #set ratio values
          ratio_values = params[:ratio_values]
          ratio_values.each do |key, value|
      Severity: Minor
      Found in app/controllers/wbs_activity_ratio_elements_controller.rb - About 55 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

      Function placeAnchorsOnLine has 7 arguments (exceeds 4 allowed). Consider refactoring.
      Open

                  placeAnchorsOnLine = function(desc, elementDimensions, elementPosition,
                                  connections, horizontal, otherMultiplier, reverse) {
      Severity: Major
      Found in app/assets/javascripts/jquery.jsPlumb-1.4.1-all.js - About 50 mins to fix

        Function _makeFloatingEndpoint has 7 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            var _makeFloatingEndpoint = function(paintStyle, referenceAnchor, endpoint, referenceCanvas, sourceElement, _jsPlumb, _newEndpoint) {            
        Severity: Major
        Found in app/assets/javascripts/jquery.jsPlumb-1.4.1-all.js - About 50 mins to fix

          Function prepareEndpoint has 7 arguments (exceeds 4 allowed). Consider refactoring.
          Open

                  prepareEndpoint = function(existing, index, params, element, elementId, connectorPaintStyle, connectorHoverPaintStyle) {
          Severity: Major
          Found in app/assets/javascripts/jquery.jsPlumb-1.4.1-all.js - About 50 mins to fix

            Function placeSomeAnchors has 7 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                            placeSomeAnchors = function(desc, elementDimensions, elementPosition, unsortedConnections, isHorizontal, otherMultiplier, orientation) {
            Severity: Major
            Found in app/assets/javascripts/jquery.jsPlumb-1.4.1-all.js - About 50 mins to fix

              Function add_widget has 7 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                  fn.add_widget = function(html, size_x, size_y, col, row, max_size, min_size) {
              Severity: Major
              Found in app/assets/javascripts/jquery.gridster.js - About 50 mins to fix

                Function WidgetInfo has 7 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                function WidgetInfo(helperId, widgetId, displayName, type, flags, startupMode, available) {
                Severity: Major
                Found in app/assets/javascripts/spk_multiwidget.js - About 50 mins to fix

                  Method pemodule_input has 7 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                    def pemodule_input(level, est_val, module_project, level_estimation_values, pbs_project_element, attribute_type="", read_only_value=false)
                  Severity: Major
                  Found in app/helpers/projects_helper.rb - About 50 mins to fix

                    Method display_text_field_tag has 7 arguments (exceeds 4 allowed). Consider refactoring.
                    Open

                      def display_text_field_tag(level, est_val, module_project, level_estimation_values, pbs_project_element, attribute_type="", read_only_value=false)
                    Severity: Major
                    Found in app/helpers/projects_helper.rb - About 50 mins to fix

                      Function populateLabels has 7 arguments (exceeds 4 allowed). Consider refactoring.
                      Open

                          function populateLabels(config, labelTemplateString, labels, numberOfSteps, graphMin, graphMax, stepValue) {
                      Severity: Major
                      Found in app/assets/javascripts/ChartNew.js - About 50 mins to fix

                        Avoid deeply nested control flow statements.
                        Open

                                              if(typeof adj[j] != 'string') {
                                                data = $.merge(node.data, {});
                                                node = node.nodeTo;
                                              }
                        Severity: Major
                        Found in app/assets/javascripts/jit-2.0.1.js - About 45 mins to fix

                          Avoid deeply nested control flow statements.
                          Open

                                                          if ($.inArray(type, noAnyMatch) < 0) {
                                                              matches = typeFunction( c, data );
                                                              if (matches !== null) {
                                                                  filterMatched = matches;
                                                                  return false;
                          Severity: Major
                          Found in app/assets/javascripts/tablesorter.min.js - About 45 mins to fix

                            Avoid deeply nested control flow statements.
                            Open

                                                    if (i === c.columns && $column.length) {
                                                        wo.filter_$anyMatch = $column;
                                                    }
                            Severity: Major
                            Found in app/assets/javascripts/tablesorter.min.js - About 45 mins to fix
                              Severity
                              Category
                              Status
                              Source
                              Language