fossasia/engelsystem

View on GitHub
includes/controller/admin_rooms_controller.php

Summary

Maintainability
F
3 days
Test Coverage

Function admin_rooms has a Cognitive Complexity of 116 (exceeds 5 allowed). Consider refactoring.
Open

function admin_rooms() {
  global $user;

  $event_source = sql_select("SELECT * FROM `Events` ORDER BY `name`");
  $events = array();
Severity: Minor
Found in includes/controller/admin_rooms_controller.php - About 2 days 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 admin_rooms has 180 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function admin_rooms() {
  global $user;

  $event_source = sql_select("SELECT * FROM `Events` ORDER BY `name`");
  $events = array();
Severity: Major
Found in includes/controller/admin_rooms_controller.php - About 7 hrs to fix

    Avoid deeply nested control flow statements.
    Open

                if ($angeltype === false)
                  engelsystem_error("Unable to load angeltype.");
    Severity: Major
    Found in includes/controller/admin_rooms_controller.php - About 45 mins to fix

      Avoid deeply nested control flow statements.
      Open

                  if ($id === false)
                    engelsystem_error("Unable to create room.");
      Severity: Major
      Found in includes/controller/admin_rooms_controller.php - About 45 mins to fix

        Avoid deeply nested control flow statements.
        Open

                  if ($event_id === false)
                    engelsystem_error('Unable to load event type.');
        Severity: Major
        Found in includes/controller/admin_rooms_controller.php - About 45 mins to fix

          Avoid deeply nested control flow statements.
          Open

                      if ($angeltype != null) {
                       insert_by_room($id, $angeltype_id, $angeltype_count);
                       $needed_angeltype_info[] = $angeltype['name'] . ": " . $angeltype_count;
                      }
          Severity: Major
          Found in includes/controller/admin_rooms_controller.php - About 45 mins to fix

            There are no issues that match your filters.

            Category
            Status