fiedl/wingolfsplattform

View on GitHub
app/models/ability.rb

Summary

Maintainability
C
1 day
Test Coverage

Method rights_for_local_admins has 81 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def rights_for_local_admins
    can :index, PublicActivity::Activity
    can :index, Issue

    if not read_only_mode?
Severity: Major
Found in app/models/ability.rb - About 3 hrs to fix

    Consider simplifying this complex logical expression.
    Open

        if not read_only_mode?
          can :update, Group do |group|
            group.admins_of_self_and_ancestors.include?(user)
          end
          can :update, Corporation do |group|
    Severity: Critical
    Found in app/models/ability.rb - About 2 hrs to fix

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

        def rights_for_signed_in_users
          #
          # Inherited from your_platform:
          # - terms of use
          # - users
      Severity: Minor
      Found in app/models/ability.rb - About 1 hr to fix

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

          def rights_for_signed_in_users
            #
            # Inherited from your_platform:
            # - terms of use
            # - users
        Severity: Minor
        Found in app/models/ability.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 rights_for_local_admins has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

          def rights_for_local_admins
            can :index, PublicActivity::Activity
            can :index, Issue
        
            if not read_only_mode?
        Severity: Minor
        Found in app/models/ability.rb - About 25 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