fossasia/engelsystem

View on GitHub

Showing 271 of 271 total issues

Function view_user_shifts has a Cognitive Complexity of 324 (exceeds 5 allowed). Consider refactoring.
Open

function view_user_shifts() {
  global $user, $privileges;
  global $ical_shifts;

  $ical_shifts = array();
Severity: Minor
Found in includes/controller/user_shifts_controller.php - About 6 days 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_shifts has a Cognitive Complexity of 287 (exceeds 5 allowed). Consider refactoring.
Open

function user_shifts() {
  global $user, $privileges;
  $timezone_identifiers = DateTimeZone::listIdentifiers();
  $timezone = $user['timezone'];
  date_default_timezone_set ("$timezone_identifiers[$timezone]");
Severity: Minor
Found in includes/controller/user_shifts_controller.php - About 5 days 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_shifts has a Cognitive Complexity of 164 (exceeds 5 allowed). Consider refactoring.
Open

function admin_shifts() {
  global $user;
  $timezone_identifiers = DateTimeZone::listIdentifiers();
  $timezone = $user['timezone'];
  date_default_timezone_set ("$timezone_identifiers[$timezone]");
Severity: Minor
Found in includes/controller/admin_shifts_controller.php - About 3 days 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_rooms has a Cognitive Complexity of 116 (exceeds 5 allowed). Consider refactoring.
Open

function admin_rooms() {
  global $user;

  $event_source = sql_select("SELECT * FROM `Events` ORDER BY `name`");
  $events = array();
Severity: Minor
Found in includes/controller/admin_rooms_controller.php - About 2 days 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_shifts has 452 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function user_shifts() {
  global $user, $privileges;
  $timezone_identifiers = DateTimeZone::listIdentifiers();
  $timezone = $user['timezone'];
  date_default_timezone_set ("$timezone_identifiers[$timezone]");
Severity: Major
Found in includes/controller/user_shifts_controller.php - About 2 days to fix

    File user_shifts_controller.php has 874 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    <?php
    
    function shifts_title() {
      return _("Shifts");
    }
    Severity: Major
    Found in includes/controller/user_shifts_controller.php - About 2 days to fix

      Function guest_register has a Cognitive Complexity of 103 (exceeds 5 allowed). Consider refactoring.
      Open

      function guest_register() {
        global $tshirt_sizes, $enable_tshirt_size, $default_theme;
      
        $msg = "";
        $nick = "";
      Severity: Minor
      Found in includes/controller/guest_login_controller.php - About 2 days 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_settings has a Cognitive Complexity of 102 (exceeds 5 allowed). Consider refactoring.
      Open

      function user_settings() {
        global $enable_tshirt_size, $tshirt_sizes, $themes, $locales;
        global $user;
        $msg = "";
        $nick = $user['Nick'];
      Severity: Minor
      Found in includes/controller/user_settings_controller.php - About 2 days 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 view_user_shifts has 382 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function view_user_shifts() {
        global $user, $privileges;
        global $ical_shifts;
      
        $ical_shifts = array();
      Severity: Major
      Found in includes/controller/user_shifts_controller.php - About 1 day to fix

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

          } elseif (isset($_REQUEST['submit'])) {
            if (! is_array($_SESSION['admin_shifts_shifts']) || ! is_array($_SESSION['admin_shifts_types']))
              redirect(page_link_to('admin_shifts'));
        
            foreach ($_SESSION['admin_shifts_shifts'] as $shift) {
        Severity: Major
        Found in includes/controller/admin_shifts_controller.php and 1 other location - About 1 day to fix
        includes/controller/user_shifts_controller.php on lines 355..380

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

        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['save'])) {
            if (! is_array($_SESSION['admin_shifts_shifts']) || ! is_array($_SESSION['admin_shifts_types']))
              redirect(page_link_to('admin_shifts'));
        
            foreach ($_SESSION['admin_shifts_shifts'] as $shift) {
        Severity: Major
        Found in includes/controller/user_shifts_controller.php and 1 other location - About 1 day to fix
        includes/controller/admin_shifts_controller.php on lines 299..324

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

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

        function guest_register() {
          global $tshirt_sizes, $enable_tshirt_size, $default_theme;
        
          $msg = "";
          $nick = "";
        Severity: Major
        Found in includes/controller/guest_login_controller.php - About 1 day to fix

          Method user_settings has 318 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          function user_settings() {
            global $enable_tshirt_size, $tshirt_sizes, $themes, $locales;
            global $user;
            $msg = "";
            $nick = $user['Nick'];
          Severity: Major
          Found in includes/controller/user_settings_controller.php - About 1 day to fix

            Method admin_shifts has 314 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            function admin_shifts() {
              global $user;
              $timezone_identifiers = DateTimeZone::listIdentifiers();
              $timezone = $user['timezone'];
              date_default_timezone_set ("$timezone_identifiers[$timezone]");
            Severity: Major
            Found in includes/controller/admin_shifts_controller.php - About 1 day to fix

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

                    return page_with_title(_("Preview"), array(
                        form(array(
                            $hidden_types,
                            form_hidden('shifttype_id', $shifttype_id),
                            form_hidden('title', $title),
              Severity: Major
              Found in includes/controller/user_shifts_controller.php and 1 other location - About 1 day to fix
              includes/controller/admin_shifts_controller.php on lines 275..297

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

              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 page_with_title(_("Preview"), array(
                        form(array(
                            $hidden_types,
                            form_hidden('shifttype_id', $shifttype_id),
                            form_hidden('title', $title),
              Severity: Major
              Found in includes/controller/admin_shifts_controller.php and 1 other location - About 1 day to fix
              includes/controller/user_shifts_controller.php on lines 330..352

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

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

              function user_messages() {
                global $user;
              
                if (! isset($_REQUEST['action'])) {
                  $users = user_by_nick($user['UID']);
              Severity: Minor
              Found in includes/controller/user_messages_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 admin_import has a Cognitive Complexity of 62 (exceeds 5 allowed). Consider refactoring.
              Open

              function admin_import() {
                global $rooms_import;
                global $user;
                $html = "";
              
              
              Severity: Minor
              Found in includes/controller/admin_import_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 admin_active has a Cognitive Complexity of 60 (exceeds 5 allowed). Consider refactoring.
              Open

              function admin_active() {
                global $tshirt_sizes, $shift_sum_formula;
              
                $msg = "";
                $search = "";
              Severity: Minor
              Found in includes/controller/admin_active_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 admin_export has a Cognitive Complexity of 57 (exceeds 5 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: Minor
              Found in includes/controller/admin_export_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

              Severity
              Category
              Status
              Source
              Language