SysMO-DB/seek

View on GitHub
app/helpers/projects_helper.rb

Summary

Maintainability
F
3 days
Test Coverage

Method indented_tree_child_options has a Cognitive Complexity of 55 (exceeds 5 allowed). Consider refactoring.
Open

  def indented_tree_child_options parent, depth=0, show_edit=true, show_delete=true, selected_id=nil, related_resource_type="Person",selected_display_items=nil, foldable=true
    result = []
    unless parent.children.empty?
      parent.children.sort { |a, b| a.title.downcase <=> b.title.downcase }.each do |child|
        display_style = (foldable==true) ? "display:none" : "display:block"
Severity: Minor
Found in app/helpers/projects_helper.rb - About 1 day 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 tree_editor_display has a Cognitive Complexity of 40 (exceeds 5 allowed). Consider refactoring.
Open

  def tree_editor_display type, show_edit=true, show_delete=true, selected_id=nil, related_resource_type="Person",selective_display=false, foldable=false

    selected_display_items = nil

    if selected_id && selective_display
Severity: Minor
Found in app/helpers/projects_helper.rb - About 6 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 tree_editor_display has 41 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def tree_editor_display type, show_edit=true, show_delete=true, selected_id=nil, related_resource_type="Person",selective_display=false, foldable=false

    selected_display_items = nil

    if selected_id && selective_display
Severity: Minor
Found in app/helpers/projects_helper.rb - About 1 hr to fix

    Method indented_tree_child_options has 36 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      def indented_tree_child_options parent, depth=0, show_edit=true, show_delete=true, selected_id=nil, related_resource_type="Person",selected_display_items=nil, foldable=true
        result = []
        unless parent.children.empty?
          parent.children.sort { |a, b| a.title.downcase <=> b.title.downcase }.each do |child|
            display_style = (foldable==true) ? "display:none" : "display:block"
    Severity: Minor
    Found in app/helpers/projects_helper.rb - About 1 hr to fix

      Method indented_tree_child_options has 8 arguments (exceeds 4 allowed). Consider refactoring.
      Open

        def indented_tree_child_options parent, depth=0, show_edit=true, show_delete=true, selected_id=nil, related_resource_type="Person",selected_display_items=nil, foldable=true
      Severity: Major
      Found in app/helpers/projects_helper.rb - About 1 hr to fix

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

          def tree_editor_display type, show_edit=true, show_delete=true, selected_id=nil, related_resource_type="Person",selective_display=false, foldable=false
        Severity: Major
        Found in app/helpers/projects_helper.rb - About 50 mins to fix

          Method tree_single_select_tag has 6 arguments (exceeds 4 allowed). Consider refactoring.
          Open

            def tree_single_select_tag type, id, selected_item=nil, disabled_items=[], name=nil, html_options={:multiple => false, :size => 10, :style => "width:600px;"}
          Severity: Minor
          Found in app/helpers/projects_helper.rb - About 45 mins to fix

            Method child_single_select_options has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

              def child_single_select_options parent, depth=0
                result = []
            
                unless parent.children.empty?
                  parent.children.sort { |a, b| a.title.downcase <=> b.title.downcase }.each do |child|
            Severity: Minor
            Found in app/helpers/projects_helper.rb - About 35 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

            Similar blocks of code found in 2 locations. Consider refactoring.
            Open

                    expand_link = link_to_function expand_plus_image, :style => "float:left;" + "display:" + (display_style=='display:none' ? 'block;' : 'none;'), :id =>"projects_hierarchies_expand_#{parent.id}_#{child.id}" do |page|
                      page.visual_effect :toggle_blind, "#{parent.id}_#{child.id}", :duration => 0.5
                      page["projects_hierarchies_expand_#{parent.id}_#{child.id}"].toggle
                      page["projects_hierarchies_collapse_#{parent.id}_#{child.id}"].toggle
            Severity: Major
            Found in app/helpers/projects_helper.rb and 1 other location - About 1 hr to fix
            app/helpers/projects_helper.rb on lines 158..161

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 63.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 2 locations. Consider refactoring.
            Open

                    collapse_link = link_to_function collapse_minus_image,:style => "float:left;" + "display:" + (display_style=='display:none' ? 'none;' : 'block;'), :id =>"projects_hierarchies_collapse_#{parent.id}_#{child.id}" do |page|
                      page.visual_effect :toggle_blind, "#{parent.id}_#{child.id}", :duration => 0.5
                      page["projects_hierarchies_expand_#{parent.id}_#{child.id}"].toggle
                      page["projects_hierarchies_collapse_#{parent.id}_#{child.id}"].toggle
            Severity: Major
            Found in app/helpers/projects_helper.rb and 1 other location - About 1 hr to fix
            app/helpers/projects_helper.rb on lines 153..156

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 63.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 2 locations. Consider refactoring.
            Open

                  expand_link = link_to_function expand_plus_image, :style => "float:left;" + "display:" + (display_style=='display:none' ? 'block;' : 'none;'), :id =>"projects_hierarchies_expand_#{root.id}" do |page|
                    page.visual_effect :toggle_blind, "#{root.id}", :duration => 0.5
                    page["projects_hierarchies_expand_#{root.id}"].toggle
                    page["projects_hierarchies_collapse_#{root.id}"].toggle
            Severity: Minor
            Found in app/helpers/projects_helper.rb and 1 other location - About 1 hr to fix
            app/helpers/projects_helper.rb on lines 115..118

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 47.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 2 locations. Consider refactoring.
            Open

                  collapse_link = link_to_function collapse_minus_image,:style => "float:left;"+ "display:" + (display_style=='display:none' ? 'none;' : 'block;'), :id =>"projects_hierarchies_collapse_#{root.id}" do |page|
                    page.visual_effect :toggle_blind, "#{root.id}", :duration => 0.5
                    page["projects_hierarchies_expand_#{root.id}"].toggle
                    page["projects_hierarchies_collapse_#{root.id}"].toggle
            Severity: Minor
            Found in app/helpers/projects_helper.rb and 1 other location - About 1 hr to fix
            app/helpers/projects_helper.rb on lines 109..112

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 47.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 3 locations. Consider refactoring.
            Open

              def pals_link_list project
                if project.pals.empty?
                  html = "<span class='none_text'>No PALs for this #{t('project')}</span>";
                else
                  html = project.pals.select(&:can_view?).collect { |p| link_to(h(p.name), p) }.join(", ")
            Severity: Minor
            Found in app/helpers/projects_helper.rb and 2 other locations - About 25 mins to fix
            app/helpers/projects_helper.rb on lines 31..37
            app/helpers/projects_helper.rb on lines 49..55

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 30.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 3 locations. Consider refactoring.
            Open

              def asset_managers_link_list project
                if project.asset_managers.empty?
                  html = "<span class='none_text'>No Asset Managers for this #{t('project')}</span>";
                else
                  html = project.asset_managers.select(&:can_view?).collect { |p| link_to(h(p.name), p) }.join(", ")
            Severity: Minor
            Found in app/helpers/projects_helper.rb and 2 other locations - About 25 mins to fix
            app/helpers/projects_helper.rb on lines 22..28
            app/helpers/projects_helper.rb on lines 49..55

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 30.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 3 locations. Consider refactoring.
            Open

              def gatekeepers_link_list project
                if project.gatekeepers.empty?
                  html = "<span class='none_text'>No Gatekeepers for this #{t('project')}</span>";
                else
                  html = project.gatekeepers.select(&:can_view?).collect { |p| link_to(h(p.name), p) }.join(", ")
            Severity: Minor
            Found in app/helpers/projects_helper.rb and 2 other locations - About 25 mins to fix
            app/helpers/projects_helper.rb on lines 22..28
            app/helpers/projects_helper.rb on lines 31..37

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 30.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            There are no issues that match your filters.

            Category
            Status