fossasia/engelsystem

View on GitHub

Showing 271 of 271 total issues

Method Shift_view has 81 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function Shift_view($shift, $shifttype, $room, $shift_admin, $angeltypes_source, $user_shift_admin, $admin_rooms, $admin_shifttypes, $user_shifts, $signed_up) {
  $parsedown = new Parsedown();

  $angeltypes = [];
  foreach ($angeltypes_source as $angeltype)
Severity: Major
Found in includes/view/Shifts_view.php - About 3 hrs to fix

    Method insert_user has 25 arguments (exceeds 4 allowed). Consider refactoring.
    Open

    function insert_user($default_theme, $nick, $prename, $lastname, $age, $tel, $dect, $native_lang, $other_langs, $mobile, $mail, $email_shiftinfo, $jabber, $tshirt_size, $password_hash, $comment, $hometown, $twitter, $facebook, $github, $organization, $current_city, $organization_web, $timezone, $planned_arrival_date) {
    Severity: Major
    Found in includes/model/User_model.php - About 3 hrs to fix

      Method user_myshifts has 78 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function user_myshifts() {
        global $LETZTES_AUSTRAGEN;
        global $user, $privileges;
        $timezone_identifiers = DateTimeZone::listIdentifiers();
        $timezone = $user['timezone'];
      Severity: Major
      Found in includes/controller/user_myshifts_controller.php - About 3 hrs to fix

        Method admin_groups has 76 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        function admin_groups() {
          global $user;
        
          $html = "";
          $groups = Groups_by_name();
        Severity: Major
        Found in includes/controller/admin_groups_controller.php - About 3 hrs to fix

          Similar blocks of code found in 3 locations. Consider refactoring.
          Open

                    div('col-md-4', [
                        heading(_("Arrival statistics"), 2),
                        bargraph('arrives', 'day', [
                            'count' => _("arrived"),
                            'sum' => _("arrived sum")
          Severity: Major
          Found in includes/controller/admin_arrive_controller.php and 2 other locations - About 3 hrs to fix
          includes/controller/admin_arrive_controller.php on lines 144..158
          includes/controller/admin_arrive_controller.php on lines 174..188

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 142.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Similar blocks of code found in 3 locations. Consider refactoring.
          Open

                    div('col-md-4', [
                        heading(_("Planned arrival statistics"), 2),
                        bargraph('planned_arrives', 'day', [
                            'count' => _("arrived"),
                            'sum' => _("arrived sum")
          Severity: Major
          Found in includes/controller/admin_arrive_controller.php and 2 other locations - About 3 hrs to fix
          includes/controller/admin_arrive_controller.php on lines 159..173
          includes/controller/admin_arrive_controller.php on lines 174..188

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 142.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Similar blocks of code found in 3 locations. Consider refactoring.
          Open

                    div('col-md-4', [
                        heading(_("Planned departure statistics"), 2),
                        bargraph('planned_departures', 'day', [
                            'count' => _("arrived"),
                            'sum' => _("arrived sum")
          Severity: Major
          Found in includes/controller/admin_arrive_controller.php and 2 other locations - About 3 hrs to fix
          includes/controller/admin_arrive_controller.php on lines 144..158
          includes/controller/admin_arrive_controller.php on lines 159..173

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 142.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          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 Users_view has 73 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            function Users_view($users, $order_by, $arrived_count, $active_count, $force_active_count, $freeloads_count, $tshirts_count, $voucher_count) {
              $search = "";
              $users_matched = [];
              if (isset($_REQUEST['search']))
                $search = strip_request_item('search');
            Severity: Major
            Found in includes/view/User_view.php - About 2 hrs to fix

              Method admin_free has 72 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              function admin_free() {
                global $privileges;
              
                $search = "";
                if (isset($_REQUEST['search']))
              Severity: Major
              Found in includes/controller/admin_free_controller.php - About 2 hrs to fix

                Method user_driver_license_edit_controller has 70 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                function user_driver_license_edit_controller() {
                  global $privileges, $user;
                
                  if (isset($_REQUEST['user_id'])) {
                    $user_source = User($_REQUEST['user_id']);
                Severity: Major
                Found in includes/controller/user_driver_licenses_controller.php - About 2 hrs to fix

                  Function Shift_signup_allowed has a Cognitive Complexity of 20 (exceeds 5 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 2 hrs 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

                  Identical blocks of code found in 2 locations. Consider refactoring.
                  Open

                          foreach ($types as $type) {
                            if (isset($_REQUEST['type_' . $type['id']]) && preg_match("/^[0-9]+$/", trim($_REQUEST['type_' . $type['id']]))) {
                              $needed_angel_types[$type['id']] = trim($_REQUEST['type_' . $type['id']]);
                            } else {
                              $ok = false;
                  Severity: Major
                  Found in includes/controller/admin_shifts_controller.php and 1 other location - About 2 hrs to fix
                  includes/controller/user_shifts_controller.php on lines 281..288

                  Duplicated Code

                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                  Tuning

                  This issue has a mass of 136.

                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                  Refactorings

                  Further Reading

                  Identical blocks of code found in 2 locations. Consider refactoring.
                  Open

                      foreach ($types as $type) {
                        if (isset($_REQUEST['type_' . $type['id']]) && preg_match("/^[0-9]+$/", trim($_REQUEST['type_' . $type['id']]))) {
                          $needed_angel_types[$type['id']] = trim($_REQUEST['type_' . $type['id']]);
                        } else {
                          $ok = false;
                  Severity: Major
                  Found in includes/controller/user_shifts_controller.php and 1 other location - About 2 hrs to fix
                  includes/controller/admin_shifts_controller.php on lines 149..156

                  Duplicated Code

                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                  Tuning

                  This issue has a mass of 136.

                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                  Refactorings

                  Further Reading

                  Method guest_login has 68 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  function guest_login() {
                    global $user, $privileges;
                  
                    $nick = "";
                  
                  
                  Severity: Major
                  Found in includes/controller/guest_login_controller.php - About 2 hrs to fix

                    Method header_toolbar has 67 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    function header_toolbar() {
                      global $p, $privileges, $user, $enable_tshirt_size, $max_freeloadable_shifts;
                      $settings = array();
                      $no_migrated = "";
                      if (test_import()) {
                    Severity: Major
                    Found in includes/sys_menu.php - About 2 hrs to fix

                      Identical blocks of code found in 2 locations. Consider refactoring.
                      Open

                          if (isset($_REQUEST['shifttype_id'])) {
                            $shifttype = ShiftType($_REQUEST['shifttype_id']);
                            if ($shifttype === false)
                              engelsystem_error('Unable to load shift type.');
                            if ($shifttype == null) {
                      Severity: Major
                      Found in includes/controller/admin_shifts_controller.php and 1 other location - About 2 hrs to fix
                      includes/controller/user_shifts_controller.php on lines 212..224

                      Duplicated Code

                      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                      Tuning

                      This issue has a mass of 134.

                      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                      Refactorings

                      Further Reading

                      Identical blocks of code found in 2 locations. Consider refactoring.
                      Open

                          if (isset($_REQUEST['shifttype_id'])) {
                            $shifttype = ShiftType($_REQUEST['shifttype_id']);
                            if ($shifttype === false)
                              engelsystem_error('Unable to load shift type.');
                            if ($shifttype == null) {
                      Severity: Major
                      Found in includes/controller/user_shifts_controller.php and 1 other location - About 2 hrs to fix
                      includes/controller/admin_shifts_controller.php on lines 48..60

                      Duplicated Code

                      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                      Tuning

                      This issue has a mass of 134.

                      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                      Refactorings

                      Further Reading

                      Method User_insert has 21 arguments (exceeds 4 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) {
                      Severity: Major
                      Found in includes/model/User_model.php - About 2 hrs to fix

                        Function Shift_view has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
                        Open

                        function Shift_view($shift, $shifttype, $room, $shift_admin, $angeltypes_source, $user_shift_admin, $admin_rooms, $admin_shifttypes, $user_shifts, $signed_up) {
                          $parsedown = new Parsedown();
                        
                          $angeltypes = [];
                          foreach ($angeltypes_source as $angeltype)
                        Severity: Minor
                        Found in includes/view/Shifts_view.php - About 2 hrs 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