fossasia/engelsystem

View on GitHub

Showing 198 of 271 total issues

Method admin_log has 28 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function admin_log() {
  global $user;
  $timezone_identifiers = DateTimeZone::listIdentifiers();
  $timezone = $user['timezone'];
  date_default_timezone_set ("$timezone_identifiers[$timezone]");
Severity: Minor
Found in includes/controller/admin_log_controller.php - About 1 hr to fix

    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_controller has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
      Open

      function user_controller() {
        global $privileges, $user;
      
        if (isset($_REQUEST['user_id'])) {
          $user_source = User($_REQUEST['user_id']);
      Severity: Minor
      Found in includes/controller/users_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_meetings has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
      Open

      function user_meetings() {
        global $DISPLAY_NEWS, $privileges, $user;
      
        $html = '<div class="col-md-12"><h1>' . meetings_title() . '</h1>' . msg();
      
      
      Severity: Minor
      Found in includes/controller/user_news_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_news_comments has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
      Open

      function user_news_comments() {
        global $user;
      
        $html = '<div class="col-md-12"><h1>' . user_news_comments_title() . '</h1>';
        if (isset($_REQUEST["nid"]) && preg_match("/^[0-9]{1,}$/", $_REQUEST['nid']) && count_news_by_id($_REQUEST['nid']) > 0) {
      Severity: Minor
      Found in includes/controller/user_news_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_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

      Method User_insert has 27 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function User_insert($nick, $prename, $lastname, $age, $tel, $dect, $mobile, $mail, $email_shiftinfo, $jabber, $tshirt_size, $password_hash, $comment, $hometown, $twitter, $facebook, $github, $organization, $organization_web, $timezone, $planned_arrival_date) {
        return  sql_query("
                  INSERT INTO `User` SET
                  `Nick`='" . sql_escape($nick) . "',
                  `Vorname`='" . sql_escape($prename) . "',
      Severity: Minor
      Found in includes/model/User_model.php - About 1 hr to fix

        Method Users_view has 8 arguments (exceeds 4 allowed). Consider refactoring.
        Open

        function Users_view($users, $order_by, $arrived_count, $active_count, $force_active_count, $freeloads_count, $tshirts_count, $voucher_count) {
        Severity: Major
        Found in includes/view/User_view.php - About 1 hr to fix

          Method AngelType_view has 8 arguments (exceeds 4 allowed). Consider refactoring.
          Open

          function AngelType_view($angeltype, $members, $user_angeltype, $admin_user_angeltypes, $admin_angeltypes, $coordinator, $user_driver_license, $user) {
          Severity: Major
          Found in includes/view/AngelTypes_view.php - About 1 hr to fix

            Method event_create has 8 arguments (exceeds 4 allowed). Consider refactoring.
            Open

            function event_create($name, $description, $organizer, $start_date, $start_time, $end_date, $end_time, $venue) {
            Severity: Major
            Found in includes/model/Events_model.php - About 1 hr to fix

              Method UserDriverLicense_edit_view has 8 arguments (exceeds 4 allowed). Consider refactoring.
              Open

              function UserDriverLicense_edit_view($user_source, $wants_to_drive, $has_car, $has_license_car, $has_license_3_5t_transporter, $has_license_7_5t_truck, $has_license_12_5t_truck, $has_license_forklift) {
              Severity: Major
              Found in includes/view/UserDriverLicenses_view.php - About 1 hr to fix

                Function mail_shift_change has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                Open

                function mail_shift_change($old_shift, $new_shift) {
                  $users = ShiftEntries_by_shift($old_shift["SID"]);
                  $old_room = Room($old_shift["RID"]);
                  $new_room = Room($new_shift["RID"]);
                
                
                Severity: Minor
                Found in includes/mailer/shifts_mailer.php - 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 User_view has 7 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                function User_view($user_source, $admin_user_privilege, $freeloader, $user_angeltypes, $user_groups, $shifts, $its_me) {
                Severity: Major
                Found in includes/view/User_view.php - About 50 mins to fix

                  Method UserDriverLicenses_create has 7 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                  function UserDriverLicenses_create($user_id, $has_car, $has_license_car, $has_license_3_5t_transporter, $has_license_7_5t_truck, $has_license_12_5t_truck, $has_license_forklift) {
                  Severity: Major
                  Found in includes/model/UserDriverLicenses_model.php - About 50 mins to fix

                    Method UserDriverLicenses_update has 7 arguments (exceeds 4 allowed). Consider refactoring.
                    Open

                    function UserDriverLicenses_update($user_id, $has_car, $has_license_car, $has_license_3_5t_transporter, $has_license_7_5t_truck, $has_license_12_5t_truck, $has_license_forklift) {
                    Severity: Major
                    Found in includes/model/UserDriverLicenses_model.php - About 50 mins to fix

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

                      function form_multi_checkboxes($names, $label, $items, $selected, $disabled = array()) {
                        $html = "<table><thead><tr>";
                        foreach ($names as $title)
                          $html .= "<th>$title</th>";
                        $html .= "</tr></thead><tbody>";
                      Severity: Minor
                      Found in includes/sys_template.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 === 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 ($entry['freeloaded']) {
                                                $freeloader ++;
                                                $style = " text-decoration: line-through;";
                                              }
                          Severity: Major
                          Found in includes/controller/user_shifts_controller.php - About 45 mins to fix

                            Avoid deeply nested control flow statements.
                            Open

                                            if (in_array('user_shifts_admin', $privileges))
                                              $shifts_row .= ' ' . button(page_link_to('user_shifts') . '&amp;shift_id=' . $shift['SID'] . '&amp;type_id=' . $angeltype['id'], _("Add more angels"), 'btn-xs');
                            Severity: Major
                            Found in includes/controller/user_shifts_controller.php - About 45 mins to fix
                              Severity
                              Category
                              Status
                              Source
                              Language