fossasia/engelsystem

View on GitHub

Showing 271 of 271 total issues

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

function AngelType_delete_view($angeltype) {
  return page_with_title(sprintf(_("Delete angeltype %s"), $angeltype['name']), array(
      info(sprintf(_("Do you want to delete angeltype %s?"), $angeltype['name']), true),
      buttons(array(
          button(page_link_to('angeltypes'), _("cancel"), 'cancel'),
Severity: Major
Found in includes/view/AngelTypes_view.php and 1 other location - About 4 hrs to fix
includes/view/ShiftTypes_view.php on lines 10..18

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

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

function User_view($user_source, $admin_user_privilege, $freeloader, $user_angeltypes, $user_groups, $shifts, $its_me) {
  global $LETZTES_AUSTRAGEN, $privileges;
  $user_name = htmlspecialchars($user_source['Vorname']) . " " . htmlspecialchars($user_source['Name']);
  $myshifts_table = array();
  $timesum = 0;
Severity: Minor
Found in includes/view/User_view.php - About 4 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_settings has 102 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function admin_settings() {

  $ok = false;
  $msg = "";
  $event_name = "";
Severity: Major
Found in includes/controller/admin_settings_controller.php - About 4 hrs to fix

    File User_view.php has 333 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    <?php
    
    /**
     * Available T-Shirt sizes
     */
    Severity: Minor
    Found in includes/view/User_view.php - About 4 hrs to fix

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

        $result = sql_query("INSERT INTO `Shifts` SET
            `shifttype_id`='" . sql_escape($shift['shifttype_id']) . "',
            `start`='" . sql_escape($shift['start']) . "',
            `end`='" . sql_escape($shift['end']) . "',
            `RID`='" . sql_escape($shift['RID']) . "',
      Severity: Major
      Found in includes/model/Shifts_model.php and 1 other location - About 3 hrs to fix
      includes/model/Shifts_model.php on lines 108..117

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

      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("UPDATE `Shifts` SET
            `shifttype_id`='" . sql_escape($shift['shifttype_id']) . "',
            `start`='" . sql_escape($shift['start']) . "',
            `end`='" . sql_escape($shift['end']) . "',
            `RID`='" . sql_escape($shift['RID']) . "',
      Severity: Major
      Found in includes/model/Shifts_model.php and 1 other location - About 3 hrs to fix
      includes/model/Shifts_model.php on lines 141..150

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

      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

      function AngelType_validate_name($name, $angeltype) {
        $name = strip_item($name);
        if ($name == "")
          return array(
              false,
      Severity: Major
      Found in includes/model/AngelType_model.php and 1 other location - About 3 hrs to fix
      includes/model/Events_model.php on lines 72..98

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

      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

      function event_validate_name($name, $event) {
        $name = strip_item($name);
        if ($name == "")
          return array(
              false,
      Severity: Major
      Found in includes/model/Events_model.php and 1 other location - About 3 hrs to fix
      includes/model/AngelType_model.php on lines 62..88

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

      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 admin_import_controller.php has 325 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      <?php
      
      function admin_import_title() {
        return _("Frab import");
      }
      Severity: Minor
      Found in includes/controller/admin_import_controller.php - About 3 hrs to fix

        File user_settings_controller.php has 325 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        <?php
        function settings_title() {
          return _("Settings");
        }
        function user_settings() {
        Severity: Minor
        Found in includes/controller/user_settings_controller.php - About 3 hrs to fix

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

            } elseif (isset($_REQUEST['not_tshirt']) && preg_match("/^[0-9]+$/", $_REQUEST['not_tshirt'])) {
              $id = $_REQUEST['not_tshirt'];
              $user_source = User($id);
              if ($user_source != null) {
                User_update_not_tshirt($id);
          Severity: Major
          Found in includes/controller/admin_active_controller.php and 1 other location - About 3 hrs to fix
          includes/controller/admin_active_controller.php on lines 65..74

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

          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

            } elseif (isset($_REQUEST['not_active']) && preg_match("/^[0-9]+$/", $_REQUEST['not_active'])) {
              $id = $_REQUEST['not_active'];
              $user_source = User($id);
              if ($user_source != null) {
                User_update_inactive($id);
          Severity: Major
          Found in includes/controller/admin_active_controller.php and 1 other location - About 3 hrs to fix
          includes/controller/admin_active_controller.php on lines 83..92

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

          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 admin_shifts_controller.php has 321 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          <?php
          
          function admin_shifts_title() {
            return _("Create shifts");
          }
          Severity: Minor
          Found in includes/controller/admin_shifts_controller.php - About 3 hrs to fix

            File user_angeltypes_controller.php has 318 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            <?php
            
            /**
             * Display a hint for team/angeltype coordinators if there are unconfirmed users for his angeltype.
             */
            Severity: Minor
            Found in includes/controller/user_angeltypes_controller.php - About 3 hrs to fix

              Method install_admin has 89 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              function install_admin() {
              
                $ok = false;
                $msg = "";
                $username = "";
              Severity: Major
              Found in install.php - About 3 hrs to fix

                Method admin_questions has 86 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                function admin_questions() {
                  global $user;
                
                  if (! isset($_REQUEST['action'])) {
                    $unanswered_questions_table = array();
                Severity: Major
                Found in includes/controller/admin_questions_controller.php - About 3 hrs to fix

                  Function user_questions has a Cognitive Complexity of 24 (exceeds 5 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 3 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_events has 82 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

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

                    Function guest_login has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
                    Open

                    function guest_login() {
                      global $user, $privileges;
                    
                      $nick = "";
                    
                    
                    Severity: Minor
                    Found in includes/controller/guest_login_controller.php - About 3 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_free has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
                    Open

                    function admin_free() {
                      global $privileges;
                    
                      $search = "";
                      if (isset($_REQUEST['search']))
                    Severity: Minor
                    Found in includes/controller/admin_free_controller.php - About 3 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