fossasia/engelsystem

View on GitHub

Showing 198 of 271 total issues

Function angeltypes_list_controller has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

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

  if (! in_array('angeltypes', $privileges))
    redirect('?');
Severity: Minor
Found in includes/controller/angeltypes_controller.php - 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

Function User_shift_state_render has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

function User_shift_state_render($user) {
  $upcoming_shifts = ShiftEntries_upcoming_for_user($user);
  if ($upcoming_shifts === false)
    return false;

Severity: Minor
Found in includes/view/User_view.php - 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

Avoid deeply nested control flow statements.
Open

                  if ($ownshift['start'] >= $shift['start'] && $ownshift['start'] < $shift['end'] || $ownshift['end'] > $shift['start'] && $ownshift['end'] <= $shift['end'] || $ownshift['start'] < $shift['start'] && $ownshift['end'] > $shift['end']) {
                    $collides = true;
                    break;
                  }
Severity: Major
Found in includes/controller/user_shifts_controller.php - About 45 mins to fix

    Function user_driver_license_required_hint has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

    function user_driver_license_required_hint() {
      global $user;
    
      $angeltypes = User_angeltypes($user);
      if ($angeltypes === false)
    Severity: Minor
    Found in includes/controller/user_driver_licenses_controller.php - 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

    Avoid deeply nested control flow statements.
    Open

                      if ($angeltype['count'] - count($entries) - $freeloader > 0) {
                        $inner_text = sprintf(ngettext("%d helper needed", "%d helpers needed", $angeltype['count'] - count($entries)), $angeltype['count'] - count($entries));
                        // is the shift still running or alternatively is the user shift admin?
                        $user_may_join_shift = true;
    
    
    Severity: Major
    Found in includes/controller/user_shifts_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

        Function shifts_json_export_controller has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

        function shifts_json_export_controller() {
          global $ical_shifts, $user;
        
          if (isset($_REQUEST['key']) && preg_match("/^[0-9a-f]{32}$/", $_REQUEST['key']))
            $key = $_REQUEST['key'];
        Severity: Minor
        Found in includes/controller/shifts_controller.php - 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

        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

          Function User_angeltypes_render has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

          function User_angeltypes_render($user_angeltypes) {
            $output = array();
            foreach ($user_angeltypes as $angeltype) {
              $class = "";
              if ($angeltype['restricted'] == 1)
          Severity: Minor
          Found in includes/view/User_view.php - 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 Settings_create has 6 arguments (exceeds 4 allowed). Consider refactoring.
          Open

          function Settings_create($event_name, $buildup_start_date, $event_start_date, $event_end_date, $teardown_end_date, $event_welcome_msg) {
          Severity: Minor
          Found in includes/model/Settings_model.php - About 45 mins to fix

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

            function update_rooms($name, $from_pentabarf, $public, $number, $id, $event_id) {
            Severity: Minor
            Found in includes/model/Room_model.php - About 45 mins to fix

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

              function Settings_update($event_name, $buildup_start_date, $event_start_date, $event_end_date, $teardown_end_date, $event_welcome_msg) {
              Severity: Minor
              Found in includes/model/Settings_model.php - About 45 mins to fix

                Consider simplifying this complex logical expression.
                Open

                    if ($wants_to_drive && ! $has_license_car && ! $has_license_3_5t_transporter && ! $has_license_7_5t_truck && ! $has_license_12_5t_truck && ! $has_license_forklift) {
                      $ok = false;
                      error(_("Please select at least one driving license."));
                    }
                Severity: Major
                Found in includes/controller/user_driver_licenses_controller.php - About 40 mins to fix

                  Consider simplifying this complex logical expression.
                  Open

                                    if ($ownshift['start'] >= $shift['start'] && $ownshift['start'] < $shift['end'] || $ownshift['end'] > $shift['start'] && $ownshift['end'] <= $shift['end'] || $ownshift['start'] < $shift['start'] && $ownshift['end'] > $shift['end']) {
                                      $collides = true;
                                      break;
                                    }
                  Severity: Major
                  Found in includes/controller/user_shifts_controller.php - About 40 mins to fix

                    Consider simplifying this complex logical expression.
                    Open

                          if ($shift['shifttype_id'] != $tmp['shifttype_id'] || $shift['title'] != $tmp['title'] || $shift['start'] != $tmp['start'] || $shift['end'] != $tmp['end'] || $shift['RID'] != $tmp['RID'] || $shift['URL'] != $tmp['URL'])
                            $shifts_updated[] = $shift;
                    Severity: Major
                    Found in includes/controller/admin_import_controller.php - About 40 mins to fix

                      Method form_checkbox has 5 arguments (exceeds 4 allowed). Consider refactoring.
                      Open

                      function form_checkbox($name, $label, $selected, $value = 'checked', $div = true) {
                      Severity: Minor
                      Found in includes/sys_template.php - About 35 mins to fix

                        Method form_multi_checkboxes has 5 arguments (exceeds 4 allowed). Consider refactoring.
                        Open

                        function form_multi_checkboxes($names, $label, $items, $selected, $disabled = array()) {
                        Severity: Minor
                        Found in includes/sys_template.php - About 35 mins to fix

                          Method ShiftType_edit_view has 5 arguments (exceeds 4 allowed). Consider refactoring.
                          Open

                          function ShiftType_edit_view($name, $angeltype_id, $angeltypes, $description, $shifttype_id) {
                          Severity: Minor
                          Found in includes/view/ShiftTypes_view.php - About 35 mins to fix

                            Method AngelType_edit_view has 5 arguments (exceeds 4 allowed). Consider refactoring.
                            Open

                            function AngelType_edit_view($name, $restricted, $description, $coordinator_mode, $requires_driver_license) {
                            Severity: Minor
                            Found in includes/view/AngelTypes_view.php - About 35 mins to fix

                              Method progress_bar has 5 arguments (exceeds 4 allowed). Consider refactoring.
                              Open

                              function progress_bar($valuemin, $valuemax, $valuenow, $class = '', $content = '') {
                              Severity: Minor
                              Found in includes/sys_template.php - About 35 mins to fix
                                Severity
                                Category
                                Status
                                Source
                                Language