estimancy/projestimate

View on GitHub

Showing 836 of 1,675 total issues

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

          Avoid deeply nested control flow statements.
          Open

                          if d.nil?
                            dh = 1.hours
                          else
                            dh = d.hours
                          end
          Severity: Major
          Found in app/helpers/views_widgets_helper.rb - About 45 mins to fix

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

              def destroy
                authorize! :manage, Organization
            
                @organization = Organization.find(params[:id])
                @organization_id = @organization.id
            Severity: Minor
            Found in app/controllers/organizations_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

                                  unless ancestor.nil?
                                    ancestor_id = ancestor.id
                                    new_ancestor_ids_list.push(ancestor_id)
                                  end
            Severity: Major
            Found in app/controllers/organizations_controller.rb - About 45 mins to fix

              Avoid deeply nested control flow statements.
              Open

                                unless pf.nil?
                                  new_field = new_organization.fields.where(copy_id: pf.field_id).first
                                  pf.views_widget_id = widget_copy.id
                                  pf.field_id = new_field.nil? ? nil : new_field.id
                                  pf.save
              Severity: Major
              Found in app/controllers/organizations_controller.rb - About 45 mins to fix

                Avoid deeply nested control flow statements.
                Open

                                str_data_probable.nil? ? nil : (dev = str_data_probable[element.id])
                Severity: Major
                Found in app/helpers/views_widgets_helper.rb - About 45 mins to fix

                  Avoid deeply nested control flow statements.
                  Open

                                value_to_show =  raw estimation_value.nil? ? "#{ content_tag(:div, I18n.t(:notice_no_estimation_saved), :class => 'no_estimation_value')}" : display_effort_or_cost_per_phase(pbs_project_elt, module_project, estimation_value, view_widget_id)
                  Severity: Major
                  Found in app/helpers/views_widgets_helper.rb - About 45 mins to fix

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

                      def destroy
                        @module_project = ModuleProject.find(params[:id])
                        @project = @module_project.project
                    
                        authorize! :alter_estimation_plan, @project
                    Severity: Minor
                    Found in app/controllers/module_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

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

                      def generate_activity_element_tree(element, tree)
                        #Root is always display
                        tree ||= String.new
                        unless element.nil?
                          if element.is_root?
                    Severity: Minor
                    Found in app/helpers/wbs_activity_elements_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

                                unless refer_module_project.nil?
                                  # Get the estimation_value corresponding to the linked Effort_breakdown module (if there is one)
                                  last_estimation_results = EstimationValue.where('in_out = ? AND pe_attribute_id = ? AND module_project_id = ?', 'output', refer_attribute.id, refer_module_project.id).first
                    
                                  if last_estimation_results.nil?
                    Severity: Major
                    Found in app/helpers/projects_helper.rb - About 45 mins to fix

                      Avoid deeply nested control flow statements.
                      Open

                                      rescue
                                        is_ok = false
                      Severity: Major
                      Found in app/helpers/views_widgets_helper.rb - About 45 mins to fix

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

                          def destroy
                            authorize! :manage_master_data, :all
                        
                            @auth_method = AuthMethod.find(params[:id])
                            if is_master_instance?
                        Severity: Minor
                        Found in app/controllers/auth_methods_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

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

                          def convert_without_precision(v, organization)
                            unless v.class == Hash
                              value = v.to_f
                              if value < organization.limit1.to_i
                                value / organization.limit1_coef.to_f
                        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

                                    if corresponding_ratio_element.multiple_references == true
                                      strong_class = "strong"
                                    end
                        Severity: Major
                        Found in app/helpers/wbs_activity_elements_helper.rb - About 45 mins to fix

                          Avoid deeply nested control flow statements.
                          Open

                                        if element_ratio_elt.multiple_references == true
                                          strong_class = "strong"
                                        end
                          Severity: Major
                          Found in app/helpers/wbs_activity_elements_helper.rb - About 45 mins to fix
                            Severity
                            Category
                            Status
                            Source
                            Language