estimancy/projestimate

View on GitHub

Showing 1,675 of 1,675 total issues

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

                    Avoid deeply nested control flow statements.
                    Open

                                      if wbs_profiles_value.nil?
                                        profiles_wbs_data["profile_id_#{profile.id}"]["#{wbs_activity_elt.name}"] = 0
                                      else
                                        value = number_with_delimiter(wbs_profiles_value.round(estimation_value.pe_attribute.precision.nil? ? user_number_precision : estimation_value.pe_attribute.precision))
                                        profiles_wbs_data["profile_id_#{profile.id}"]["#{wbs_activity_elt.name}"] = value
                    Severity: Major
                    Found in app/helpers/views_widgets_helper.rb - About 45 mins to fix

                      Avoid deeply nested control flow statements.
                      Open

                                        if wbs_project_elt.is_root? || wbs_project_elt.has_children?
                                          res << "#{text_field_tag "[#{level}][#{est_val_pe_attribute.alias.to_sym}][#{module_project.id.to_s}][#{wbs_project_elt.id.to_s}]",
                                                                   pbs_last_result[wbs_project_elt.id][:value],
                                                                   :readonly => true,
                                                                   :class => "input-small #{level} #{est_val.id} #{wbs_project_elt.id} #{attribute_type}",
                      Severity: Major
                      Found in app/helpers/projects_helper.rb - About 45 mins to fix

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

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

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

                          def product(pbs_project_element, is_project_show_view)
                            pbs_product = String.new
                            pbs_product << "<li>"
                        
                            pbs_product <<  "<div class='block_label #{ pbs_project_element == current_component ? 'selected_pbs' : '' }'>
                        Severity: Minor
                        Found in app/helpers/pe_wbs_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

                                    unless estimation_value.pe_attribute.alias == "ratio" || estimation_value.pe_attribute.alias == "ratio_name"
                                      wbs_activity_elt_root = module_project.wbs_activity.wbs_activity_elements.first.root
                        
                                      wbs_data_low = data_low.nil? ? nil : data_low
                                      wbs_data_high = data_high.nil? ? nil : data_high
                        Severity: Major
                        Found in app/helpers/views_widgets_helper.rb - About 45 mins to fix

                          Avoid deeply nested control flow statements.
                          Open

                                        if module_default_view.nil?
                                          mp_view = View.create(name: "#{@module_project} view", description: "", pemodule_id: @module_project.pemodule_id, organization_id: @project.organization_id, is_default_view: true)
                                          mp_view_id = mp_view.id
                                        else
                                          mp_view_id = module_default_view.id
                          Severity: Major
                          Found in app/controllers/module_projects_controller.rb - About 45 mins to fix
                            Severity
                            Category
                            Status
                            Source
                            Language