fossasia/engelsystem

View on GitHub
includes/controller/user_angeltypes_controller.php

Summary

Maintainability
F
3 days
Test Coverage

Function user_angeltype_add_controller has a Cognitive Complexity of 54 (exceeds 5 allowed). Consider refactoring.
Open

function user_angeltype_add_controller() {
  global $user, $privileges;

  if (! isset($_REQUEST['angeltype_id'])) {
    error(_("Angeltype doesn't exist."));
Severity: Minor
Found in includes/controller/user_angeltypes_controller.php - 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

File user_angeltypes_controller.php has 318 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

/**
 * Display a hint for team/angeltype coordinators if there are unconfirmed users for his angeltype.
 */
Severity: Minor
Found in includes/controller/user_angeltypes_controller.php - About 3 hrs to fix

    Method user_angeltype_add_controller has 75 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function user_angeltype_add_controller() {
      global $user, $privileges;
    
      if (! isset($_REQUEST['angeltype_id'])) {
        error(_("Angeltype doesn't exist."));
    Severity: Major
    Found in includes/controller/user_angeltypes_controller.php - About 3 hrs to fix

      Method user_angeltype_update_controller has 49 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function user_angeltype_update_controller() {
        global $user, $privileges;
      
        if (! in_array('admin_angel_types', $privileges)) {
          error(_("You are not allowed to set coordinator rights."));
      Severity: Minor
      Found in includes/controller/user_angeltypes_controller.php - About 1 hr to fix

        Function user_angeltype_update_controller has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
        Open

        function user_angeltype_update_controller() {
          global $user, $privileges;
        
          if (! in_array('admin_angel_types', $privileges)) {
            error(_("You are not allowed to set coordinator rights."));
        Severity: Minor
        Found in includes/controller/user_angeltypes_controller.php - About 1 hr 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 user_angeltype_delete_controller has 43 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        function user_angeltype_delete_controller() {
          global $user, $privileges;
        
          if (! isset($_REQUEST['user_angeltype_id'])) {
            error(_("User angeltype doesn't exist."));
        Severity: Minor
        Found in includes/controller/user_angeltypes_controller.php - About 1 hr to fix

          Method user_angeltype_confirm_controller has 42 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          function user_angeltype_confirm_controller() {
            global $user, $privileges;
          
            if (! isset($_REQUEST['user_angeltype_id'])) {
              error(_("User angeltype doesn't exist."));
          Severity: Minor
          Found in includes/controller/user_angeltypes_controller.php - About 1 hr to fix

            Function user_angeltype_delete_controller has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
            Open

            function user_angeltype_delete_controller() {
              global $user, $privileges;
            
              if (! isset($_REQUEST['user_angeltype_id'])) {
                error(_("User angeltype doesn't exist."));
            Severity: Minor
            Found in includes/controller/user_angeltypes_controller.php - About 1 hr 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 user_angeltypes_confirm_all_controller has 35 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            function user_angeltypes_confirm_all_controller() {
              global $user, $privileges;
            
              if (! isset($_REQUEST['angeltype_id'])) {
                error(_("Angeltype doesn't exist."));
            Severity: Minor
            Found in includes/controller/user_angeltypes_controller.php - About 1 hr to fix

              Function user_angeltype_confirm_controller has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
              Open

              function user_angeltype_confirm_controller() {
                global $user, $privileges;
              
                if (! isset($_REQUEST['user_angeltype_id'])) {
                  error(_("User angeltype doesn't exist."));
              Severity: Minor
              Found in includes/controller/user_angeltypes_controller.php - About 1 hr 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 user_angeltypes_delete_all_controller has 28 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              function user_angeltypes_delete_all_controller() {
                global $user, $privileges;
              
                if (! isset($_REQUEST['angeltype_id'])) {
                  error(_("Angeltype doesn't exist."));
              Severity: Minor
              Found in includes/controller/user_angeltypes_controller.php - About 1 hr to fix

                Function user_angeltypes_confirm_all_controller has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                Open

                function user_angeltypes_confirm_all_controller() {
                  global $user, $privileges;
                
                  if (! isset($_REQUEST['angeltype_id'])) {
                    error(_("Angeltype doesn't exist."));
                Severity: Minor
                Found in includes/controller/user_angeltypes_controller.php - About 1 hr 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

                Function user_angeltypes_delete_all_controller has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                Open

                function user_angeltypes_delete_all_controller() {
                  global $user, $privileges;
                
                  if (! isset($_REQUEST['angeltype_id'])) {
                    error(_("Angeltype doesn't exist."));
                Severity: Minor
                Found in includes/controller/user_angeltypes_controller.php - 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

                Avoid too many return statements within this method.
                Open

                      return user_angeltype_update_controller();
                Severity: Major
                Found in includes/controller/user_angeltypes_controller.php - About 30 mins to fix

                  Avoid too many return statements within this method.
                  Open

                        return user_angeltype_add_controller();
                  Severity: Major
                  Found in includes/controller/user_angeltypes_controller.php - About 30 mins to fix

                    There are no issues that match your filters.

                    Category
                    Status