fossasia/engelsystem

View on GitHub

Showing 198 of 271 total issues

Function user_news has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

function user_news() {
  global $DISPLAY_NEWS, $privileges, $user;

  $html = '<div class="col-md-12"><h1>' . news_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

Method prepare_events has 45 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function prepare_events($file, $shifttype_id, $add_minutes_start, $add_minutes_end) {
  global $rooms_import;
  $data = read_xml($file);

  $rooms = Room_all();
Severity: Minor
Found in includes/controller/admin_import_controller.php - About 1 hr to fix

    Method ShiftEntry_edit_view has 44 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function ShiftEntry_edit_view($angel, $date, $location, $title, $type, $comment, $freeloaded, $freeload_comment, $user_admin_shifts = false) {
      if ($user_admin_shifts) {
        $freeload_form = array(
            form_checkbox('freeloaded', _("Freeloaded"), $freeloaded),
            form_textarea('freeload_comment', _("Freeload comment (Only for shift coordination):"), $freeload_comment) 
    Severity: Minor
    Found in includes/view/ShiftEntry_view.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

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

      function prepare_events($file, $shifttype_id, $add_minutes_start, $add_minutes_end) {
        global $rooms_import;
        $data = read_xml($file);
      
        $rooms = Room_all();
      Severity: Minor
      Found in includes/controller/admin_import_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 shift_controller has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
      Open

      function shift_controller() {
        global $user, $privileges;
      
        if (! in_array('user_shifts', $privileges))
          redirect(page_link_to('?'));
      Severity: Minor
      Found in includes/controller/shifts_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_ical has 43 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        function user_ical() {
          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/user_ical_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

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

            function user_questions() {
              global $user;
              if (! isset($_REQUEST['action'])) {
                $open_questions = select_open_questions($user['UID']);
                $answered_questions = select_ansd_questions($user['UID']);
            Severity: Minor
            Found in includes/controller/user_questions_controller.php - About 1 hr to fix

              Method user_news has 40 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              function user_news() {
                global $DISPLAY_NEWS, $privileges, $user;
              
                $html = '<div class="col-md-12"><h1>' . news_title() . '</h1>' . msg();
              
              
              Severity: Minor
              Found in includes/controller/user_news_controller.php - About 1 hr to fix

                Function user_edit_vouchers_controller has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                Open

                function user_edit_vouchers_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 table has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                Open

                function table($columns, $rows_raw, $data = true) {
                  // If only one column is given
                  if (! is_array($columns)) {
                    $columns = array(
                        'col' => $columns
                Severity: Minor
                Found in includes/sys_template.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_delete_controller has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                Open

                function user_delete_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 Shifts_filtered has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                Open

                function Shifts_filtered() {
                  global $_REQUEST;
                  $filter = "";
                
                  // filterRoom (Array of integer) - Array of Room IDs (optional, for list request)
                Severity: Minor
                Found in includes/model/Shifts_model.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 mail_shift_change has 38 lines of code (exceeds 25 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 1 hr to fix

                  Method UserDriverLicense_edit_view has 38 lines of code (exceeds 25 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) {
                    return page_with_title(sprintf(_("Edit %s driving license information"), User_Nick_render($user_source)), [
                        buttons([
                            button(user_link($user_source), _("Back to profile"), 'back')
                        ]),
                  Severity: Minor
                  Found in includes/view/UserDriverLicenses_view.php - About 1 hr to fix

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

                    function Shift_signup_allowed($shift, $angeltype, $user_angeltype = null, $user_shifts = null) {
                      global $user, $privileges;
                    
                      if ($user_shifts == null) {
                        $user_shifts = Shifts_by_user($user);
                    Severity: Minor
                    Found in includes/model/Shifts_model.php - About 1 hr to fix

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

                      function make_navigation() {
                        global $p, $privileges;
                      
                        $menu = array();
                        $pages = array(
                      Severity: Minor
                      Found in includes/sys_menu.php - About 1 hr to fix

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

                        function user_ical() {
                          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/user_ical_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

                        Severity
                        Category
                        Status
                        Source
                        Language