fossasia/engelsystem

View on GitHub

Showing 271 of 271 total issues

Function admin_questions has a Cognitive Complexity of 36 (exceeds 5 allowed). Consider refactoring.
Open

function admin_questions() {
  global $user;

  if (! isset($_REQUEST['action'])) {
    $unanswered_questions_table = array();
Severity: Minor
Found in includes/controller/admin_questions_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

Function AngelType_view has a Cognitive Complexity of 36 (exceeds 5 allowed). Consider refactoring.
Open

function AngelType_view($angeltype, $members, $user_angeltype, $admin_user_angeltypes, $admin_angeltypes, $coordinator, $user_driver_license, $user) {
  $buttons = [
      button(page_link_to('angeltypes'), _("Angeltypes"), 'back')
  ];

Severity: Minor
Found in includes/view/AngelTypes_view.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

Function admin_events has a Cognitive Complexity of 36 (exceeds 5 allowed). Consider refactoring.
Open

function admin_events() {

  global $user;
  $timezone_identifiers = DateTimeZone::listIdentifiers();
  $timezone = $user['timezone'];
Severity: Minor
Found in includes/controller/admin_events_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

Function angeltype_edit_controller has a Cognitive Complexity of 36 (exceeds 5 allowed). Consider refactoring.
Open

function angeltype_edit_controller() {
  global $privileges, $user;

  $name = "";
  $restricted = false;
Severity: Minor
Found in includes/controller/angeltypes_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

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

function UserAngelType_confirm_view($user_angeltype, $user, $angeltype) {
  return page_with_title(_("Confirm angeltype for user"), array(
      msg(),
      info(sprintf(_("Do you really want to confirm %s for %s?"), User_Nick_render($user), $angeltype['name']), true),
      buttons(array(
Severity: Major
Found in includes/view/UserAngelTypes_view.php and 1 other location - About 5 hrs to fix
includes/view/UserAngelTypes_view.php on lines 46..55

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

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 UserAngelType_delete_view($user_angeltype, $user, $angeltype) {
  return page_with_title(_("Remove angeltype"), array(
      msg(),
      info(sprintf(_("Do you really want to delete %s from %s?"), User_Nick_render($user), $angeltype['name']), true),
      buttons(array(
Severity: Major
Found in includes/view/UserAngelTypes_view.php and 1 other location - About 5 hrs to fix
includes/view/UserAngelTypes_view.php on lines 35..44

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

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

function install_admin() {

  $ok = false;
  $msg = "";
  $username = "";
Severity: Minor
Found in install.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

Method user_messages has 130 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function user_messages() {
  global $user;

  if (! isset($_REQUEST['action'])) {
    $users = user_by_nick($user['UID']);
Severity: Major
Found in includes/controller/user_messages_controller.php - About 5 hrs to fix

    Function header_toolbar has a Cognitive Complexity of 34 (exceeds 5 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: Minor
    Found in includes/sys_menu.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

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

    function mail_shift_assign($user, $shift) {
      if ($user["email_shiftinfo"]) {
        $room = Room($shift["RID"]);
    
        $message = _("You have been assigned to a Shift:") . "\n";
    Severity: Major
    Found in includes/mailer/shifts_mailer.php and 1 other location - About 4 hrs to fix
    includes/mailer/shifts_mailer.php on lines 86..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 182.

    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 mail_shift_removed($user, $shift) {
      if ($user["email_shiftinfo"]) {
        $room = Room($shift["RID"]);
    
        $message = _("You have been removed from a Shift:") . "\n";
    Severity: Major
    Found in includes/mailer/shifts_mailer.php and 1 other location - About 4 hrs to fix
    includes/mailer/shifts_mailer.php on lines 72..84

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

    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_view has 118 lines of code (exceeds 25 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: Major
    Found in includes/view/User_view.php - About 4 hrs to fix

      Function shifttype_edit_controller has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
      Open

      function shifttype_edit_controller() {
        $shifttype_id = null;
        $name = "";
        $angeltype_id = null;
        $description = "";
      Severity: Minor
      Found in includes/controller/shifttypes_controller.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

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

            case "delete":
              if (isset($_REQUEST['id']) && preg_match("/^[0-9]{1,11}$/", $_REQUEST['id']))
                $id = $_REQUEST['id'];
              else
                return error(_("Incomplete call, missing Message ID."), true);
      Severity: Major
      Found in includes/controller/user_messages_controller.php and 1 other location - About 4 hrs to fix
      includes/controller/user_messages_controller.php on lines 96..108

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

      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

            case "read":
              if (isset($_REQUEST['id']) && preg_match("/^[0-9]{1,11}$/", $_REQUEST['id']))
                $id = $_REQUEST['id'];
              else
                return error(_("Incomplete call, missing Message ID."), true);
      Severity: Major
      Found in includes/controller/user_messages_controller.php and 1 other location - About 4 hrs to fix
      includes/controller/user_messages_controller.php on lines 110..122

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

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

      function AngelType_view($angeltype, $members, $user_angeltype, $admin_user_angeltypes, $admin_angeltypes, $coordinator, $user_driver_license, $user) {
        $buttons = [
            button(page_link_to('angeltypes'), _("Angeltypes"), 'back')
        ];
      
      
      Severity: Major
      Found in includes/view/AngelTypes_view.php - About 4 hrs to fix

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

        function UserAngelTypes_delete_all_view($angeltype) {
          return page_with_title(_("Deny all users"), array(
              msg(),
              info(sprintf(_("Do you really want to deny all users for %s?"), $angeltype['name']), true),
              buttons(array(
        Severity: Major
        Found in includes/view/UserAngelTypes_view.php and 1 other location - About 4 hrs to fix
        includes/view/UserAngelTypes_view.php on lines 24..33

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

        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 UserAngelTypes_confirm_all_view($angeltype) {
          return page_with_title(_("Confirm all users"), array(
              msg(),
              info(sprintf(_("Do you really want to confirm all users for %s?"), $angeltype['name']), true),
              buttons(array(
        Severity: Major
        Found in includes/view/UserAngelTypes_view.php and 1 other location - About 4 hrs to fix
        includes/view/UserAngelTypes_view.php on lines 13..22

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

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

        <?php
        /**
         * List of available themes
         */
        $themes = array(
        Severity: Minor
        Found in includes/sys_template.php - About 4 hrs to fix

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

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

          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

          Severity
          Category
          Status
          Source
          Language