fiedl/your_platform

View on GitHub
app/controllers/groups_controller.rb

Summary

Maintainability
B
4 hrs
Test Coverage

Method show has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
Open

  def show
    set_current_title group.title
    set_current_navable group
    set_current_tab :contacts

Severity: Minor
Found in app/controllers/groups_controller.rb - About 2 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 show has 30 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def show
    set_current_title group.title
    set_current_navable group
    set_current_tab :contacts

Severity: Minor
Found in app/controllers/groups_controller.rb - About 1 hr to fix

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

      def fill_small_map_address_fields
        # On collection groups, e.g. the corporations_parent group, only the
        # groups should be shown on the map. These groups have a lot of
        # child groups with address profile fields.
        #
    Severity: Minor
    Found in app/controllers/groups_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 permitted_group_attributes has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

      def permitted_group_attributes
        permitted_keys = []
        permitted_keys += [:name, :extensive_name] if can? :rename, @group
        permitted_keys += [:token] if can? :change_token, @group
        permitted_keys += [:internal_token] if can? :change_internal_token, @group
    Severity: Minor
    Found in app/controllers/groups_controller.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

    There are no issues that match your filters.

    Category
    Status