fossasia/engelsystem

View on GitHub

Showing 271 of 271 total issues

Function user_password_recovery_controller has a Cognitive Complexity of 56 (exceeds 5 allowed). Consider refactoring.
Open

function user_password_recovery_controller() {
  if (isset($_REQUEST['token'])) {
    $user_source = User_by_password_recovery_token($_REQUEST['token']);
    if ($user_source === false)
      engelsystem_error("Unable to load user.");
Severity: Minor
Found in includes/controller/users_controller.php - About 1 day 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_import has 218 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function admin_import() {
  global $rooms_import;
  global $user;
  $html = "";

Severity: Major
Found in includes/controller/admin_import_controller.php - About 1 day to fix

    Function admin_user has a Cognitive Complexity of 55 (exceeds 5 allowed). Consider refactoring.
    Open

    function admin_user() {
      global $user, $privileges, $tshirt_sizes, $privileges;
    
      $html = '';
    
    
    Severity: Minor
    Found in includes/controller/admin_user_controller.php - About 1 day 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_angeltype_add_controller has a Cognitive Complexity of 54 (exceeds 5 allowed). Consider refactoring.
    Open

    function user_angeltype_add_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 day 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

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

      return sql_query("
          UPDATE `User` SET
          `Nick`='" . sql_escape($nick) . "',
          `Vorname`='" . sql_escape($prename) . "',
          `Name`='" . sql_escape($lastname) . "',
    Severity: Major
    Found in includes/model/User_model.php and 1 other location - About 7 hrs to fix
    includes/model/User_model.php on lines 589..607

    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 241.

    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 2 locations. Consider refactoring.
    Open

      return sql_query("
              INSERT INTO `User` SET
              `color`='" . sql_escape($default_theme) . "',
              `Nick`='" . sql_escape($nick) . "',
              `Vorname`='" . sql_escape($prename) . "',
    Severity: Major
    Found in includes/model/User_model.php and 1 other location - About 7 hrs to fix
    includes/model/User_model.php on lines 674..691

    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 241.

    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

    Function admin_arrive has a Cognitive Complexity of 49 (exceeds 5 allowed). Consider refactoring.
    Open

    function admin_arrive() {
      $msg = "";
      $search = "";
      if (isset($_REQUEST['search']))
        $search = strip_request_item('search');
    Severity: Minor
    Found in includes/controller/admin_arrive_controller.php - About 7 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

    Function admin_settings has a Cognitive Complexity of 48 (exceeds 5 allowed). Consider refactoring.
    Open

    function admin_settings() {
    
      $ok = false;
      $msg = "";
      $event_name = "";
    Severity: Minor
    Found in includes/controller/admin_settings_controller.php - About 7 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

    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

      Function user_myshifts has a Cognitive Complexity of 45 (exceeds 5 allowed). Consider refactoring.
      Open

      function user_myshifts() {
        global $LETZTES_AUSTRAGEN;
        global $user, $privileges;
        $timezone_identifiers = DateTimeZone::listIdentifiers();
        $timezone = $user['timezone'];
      Severity: Minor
      Found in includes/controller/user_myshifts_controller.php - About 6 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

      Method admin_arrive has 171 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function admin_arrive() {
        $msg = "";
        $search = "";
        if (isset($_REQUEST['search']))
          $search = strip_request_item('search');
      Severity: Major
      Found in includes/controller/admin_arrive_controller.php - About 6 hrs to fix

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

              foreach ($shifts as $shift) {
              $shifts_table_entry = [
                  'timeslot' => '<span class="glyphicon glyphicon-time"></span> ' . date("Y-m-d H:i", $shift['start']) . ' - ' . date("H:i", $shift['end']) . '<br />' . Room_name_render(Room($shift['RID'])),
                  'title' => ShiftType_name_render(ShiftType($shifttype_id)) . ($shift['title'] ? '<br />' . $shift['title'] : ''),
                    'needed_angels' => ''
        Severity: Major
        Found in includes/controller/user_shifts_controller.php and 1 other location - About 6 hrs to fix
        includes/controller/admin_shifts_controller.php on lines 255..266

        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 219.

        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 ($shifts as $shift) {
                $shifts_table_entry = [
                    'timeslot' => '<span class="glyphicon glyphicon-time"></span> ' . date("Y-m-d H:i", $shift['start']) . ' - ' . date("H:i", $shift['end']) . '<br />' . Room_name_render(Room($shift['RID'])),
                    'title' => ShiftType_name_render(ShiftType($shifttype_id)) . ($shift['title'] ? '<br />' . $shift['title'] : ''),
                    'needed_angels' => ''
        Severity: Major
        Found in includes/controller/admin_shifts_controller.php and 1 other location - About 6 hrs to fix
        includes/controller/user_shifts_controller.php on lines 310..321

        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 219.

        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

        File guest_login_controller.php has 428 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        <?php
        
        function login_title() {
          return _("Login");
        }
        Severity: Minor
        Found in includes/controller/guest_login_controller.php - About 6 hrs to fix

          Function admin_groups has a Cognitive Complexity of 41 (exceeds 5 allowed). Consider refactoring.
          Open

          function admin_groups() {
            global $user;
          
            $html = "";
            $groups = Groups_by_name();
          Severity: Minor
          Found in includes/controller/admin_groups_controller.php - About 6 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

          Method admin_active has 155 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          function admin_active() {
            global $tshirt_sizes, $shift_sum_formula;
          
            $msg = "";
            $search = "";
          Severity: Major
          Found in includes/controller/admin_active_controller.php - About 6 hrs to fix

            Function user_driver_license_edit_controller has a Cognitive Complexity of 39 (exceeds 5 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: Minor
            Found in includes/controller/user_driver_licenses_controller.php - About 5 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

            File User_model.php has 410 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            <?php
            
            /**
             * User model
             */
            Severity: Minor
            Found in includes/model/User_model.php - About 5 hrs to fix

              Method admin_export has 142 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              function admin_export() {
                // Export User data
                if(isset($_REQUEST['download'])){
                  $filename = tempnam('/tmp', '.csv'); //  Temporary File Name
                  create_temporary_table(); // Create temporary table
              Severity: Major
              Found in includes/controller/admin_export_controller.php - About 5 hrs to fix

                Method admin_user has 141 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                function admin_user() {
                  global $user, $privileges, $tshirt_sizes, $privileges;
                
                  $html = '';
                
                
                Severity: Major
                Found in includes/controller/admin_user_controller.php - About 5 hrs to fix
                  Severity
                  Category
                  Status
                  Source
                  Language