theblackwidower/CICE-Scheduler

View on GitHub

Showing 105 of 105 total issues

File wordlist.php has 3913 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

/*
English worldlist sourced from http://wordlist.aspell.net/ file: english-words.10
Removed one and two-letter words, as well as words with apostrophies.
Severity: Major
Found in Website/modules/functions/wordlist.php - About 1 wk to fix

    Function display_search_results has a Cognitive Complexity of 135 (exceeds 5 allowed). Consider refactoring.
    Open

    function display_search_results($id, $results, $extra_info = null)
    {
        echo '<div class="search_results">';
        if (sizeof($results) > 0)
        {
    Severity: Minor
    Found in Website/modules/functions/lists.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 form_ajax_search has a Cognitive Complexity of 89 (exceeds 5 allowed). Consider refactoring.
    Open

    function form_ajax_search($id)
    {
        echo '
        <form id="ajax_search" onsubmit="return false;">
            <label for="search_box">Search</label>
    Severity: Minor
    Found in Website/modules/functions/forms.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

    File help.php has 722 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    <?php
    require_once "../modules/constants.php";
    $restrictionCode = PUBLIC_ACCESS;
    require_once "../modules/init.php";
    
    
    Severity: Major
    Found in Website/ajax/help.php - About 1 day to fix

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

      function auto_complete_keyboard_controls(event)
      {
          var autoCompleteBox = event.currentTarget.parentNode.getElementsByClassName('auto_complete_box')[0];
          var selected = document.getElementById('auto_complete_selected');
          if (event.key === "Tab" || event.keyCode === 9 ||
      Severity: Minor
      Found in Website/scripts/ajax-autocomplete.js - 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

      Function build_timetable has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
      Open

      function build_timetable($contents, $include_link = TT_LINK_NONE,
              $start_schedule = START_SCHEDULE, $end_schedule = END_SCHEDULE)
      {
          $table = array();
          $days = get_all_days();
      Severity: Minor
      Found in Website/modules/functions/build.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

          else if (event.key === "Down" || event.key === "ArrowDown" || event.keyCode === 40)
          {
              event.preventDefault();
              if (autoCompleteBox.contains(selected))
              {
      Severity: Major
      Found in Website/scripts/ajax-autocomplete.js and 1 other location - About 3 hrs to fix
      Website/scripts/ajax-autocomplete.js on lines 154..181

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

      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

          else if (event.key === "Up" || event.key === "ArrowUp" || event.keyCode === 38)
          {
              event.preventDefault();
              if (autoCompleteBox.contains(selected))
              {
      Severity: Major
      Found in Website/scripts/ajax-autocomplete.js and 1 other location - About 3 hrs to fix
      Website/scripts/ajax-autocomplete.js on lines 168..181

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

      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

          if (start_time === read_only)
          {
              if (parseInt(end_time.value, 10) <= parseInt(start_time.value, 10))
                  end_time.value = parseInt(start_time.value, 10) + 1;
              else if ((parseInt(end_time.value, 10) - parseInt(start_time.value, 10)) > MAX_CLASS_LENGTH)
      Severity: Major
      Found in Website/scripts/main.js and 1 other location - About 3 hrs to fix
      Website/scripts/main.js on lines 125..131

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

      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

          else if (end_time === read_only)
          {
              if (parseInt(end_time.value, 10) <= parseInt(start_time.value, 10))
                  start_time.value = parseInt(end_time.value, 10) - 1;
              else if ((parseInt(end_time.value, 10) - parseInt(start_time.value, 10)) > MAX_CLASS_LENGTH)
      Severity: Major
      Found in Website/scripts/main.js and 1 other location - About 3 hrs to fix
      Website/scripts/main.js on lines 118..131

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

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

      <?php
      /*
      display_search_results:
      id: type of results to display
      results: results of search
      Severity: Minor
      Found in Website/modules/functions/lists.php - About 3 hrs to fix

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

        if ($_SERVER["REQUEST_METHOD"] == "POST")
        {
            $student_id = trim($_POST["student_id"]);
            $first_name = trim($_POST["first_name"]);
            $last_name = trim($_POST["last_name"]);
        Severity: Major
        Found in Website/student-edit.php and 1 other location - About 3 hrs to fix
        Website/facilitator-edit.php on lines 7..59

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

        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

        if ($_SERVER["REQUEST_METHOD"] == "POST")
        {
            $email = trim($_POST["email"]);
            $first_name = trim($_POST["first_name"]);
            $last_name = trim($_POST["last_name"]);
        Severity: Major
        Found in Website/facilitator-edit.php and 1 other location - About 3 hrs to fix
        Website/student-edit.php on lines 7..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 144.

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

        <?php
        /*
        form_ajax_search:
        id: type of records to search for.
        Builds AJAX search field and search results box.
        Severity: Minor
        Found in Website/modules/functions/forms.php - About 3 hrs to fix

          Function search_page has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
          Open

          function search_page(pageNumber, resultsBox)
          {
              resultsBox.classList.remove('view_all');
          
              var currentPage = resultsBox.getElementsByClassName('page_' + pageNumber)[0];
          Severity: Minor
          Found in Website/scripts/ajax-search.js - 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

          Method display_search_results has 69 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          function display_search_results($id, $results, $extra_info = null)
          {
              echo '<div class="search_results">';
              if (sizeof($results) > 0)
              {
          Severity: Major
          Found in Website/modules/functions/lists.php - About 2 hrs to fix

            Function build_sidebar has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
            Open

            function build_sidebar($sidebar_data, $source)
            {
                $result = '';
                $has_current = false;
                foreach ($sidebar_data as $name => $address)
            Severity: Minor
            Found in Website/modules/functions/build.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

            Function auto_complete_keyboard_controls has 68 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            function auto_complete_keyboard_controls(event)
            {
                var autoCompleteBox = event.currentTarget.parentNode.getElementsByClassName('auto_complete_box')[0];
                var selected = document.getElementById('auto_complete_selected');
                if (event.key === "Tab" || event.keyCode === 9 ||
            Severity: Major
            Found in Website/scripts/ajax-autocomplete.js - About 2 hrs to fix

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

              function reset_form(form)
              {
                  var casings;
              
                  casings = form.getElementsByClassName('text_box_casing');
              Severity: Minor
              Found in Website/scripts/main.js - 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

              Function ajax_submit has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
              Open

              function ajax_submit(form)
              {
                  var ajaxRequest;
                  if (window.XMLHttpRequest)
                      ajaxRequest = new XMLHttpRequest();
              Severity: Minor
              Found in Website/scripts/ajax-popup.js - 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