APO-Epsilon/apo-website

View on GitHub

Showing 11,898 of 11,898 total issues

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

function print_daily($day) {

    include('mysql_access.php');

    $gen=$db->query("SELECT * FROM events_listing WHERE event_type='Regular' ORDER BY event_name");
Severity: Minor
Found in event_signup.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

function add_permission($pageId, $execId) {
    include('mysql_access.php');
    $sql = "SELECT page FROM exec_permissions_pages WHERE entry_id=$pageId;";
    $result = $db->query($sql);
    $row = mysqli_fetch_array($result);
Severity: Major
Found in exec_permissions.php and 1 other location - About 4 hrs to fix
exec_permissions.php on lines 149..166

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

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 remove_permission($pageId, $execId) {
    include('mysql_access.php');
    $sql = "SELECT page FROM exec_permissions_pages WHERE entry_id=$pageId;";
    $result = $db->query($sql);
    $row = mysqli_fetch_array($result);
Severity: Major
Found in exec_permissions.php and 1 other location - About 4 hrs to fix
exec_permissions.php on lines 35..52

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

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

function show_active() {
    echo "<h1>Events you are leading:</h1>";

    $user_id = $_SESSION['sessionID'];
       include('mysql_access.php');
Severity: Major
Found in leader_list.php - About 4 hrs to fix

    Function show_active has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
    Open

    function show_active() {
        //dropdown list of events
        ?>
        <h1> Attendance Check-In </h1>
            <?php
    Severity: Minor
    Found in rec_sec_attendance_tool.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 show_public has 100 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function show_public() {
      include('mysql_access.php');
      //generate dot for viz.js
    ?>
      <script type='text/vnd.graphviz' id='family_tree_script'>
    Severity: Major
    Found in family_tree.php - About 4 hrs to fix

      File foundation.reveal.js has 333 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      ;(function ($, window, document, undefined) {
        'use strict';
      
        Foundation.libs.reveal = {
          name : 'reveal',
      Severity: Minor
      Found in r8conf2016/js/foundation/foundation.reveal.js - About 4 hrs to fix

        Method print_daily has 98 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        function print_daily($day) {
        
            include('mysql_access.php');
        
            $gen=$db->query("SELECT * FROM events_listing WHERE event_type='Regular' ORDER BY event_name");
        Severity: Major
        Found in event_signup.php - About 3 hrs to fix

          Method list_stats has 97 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          function list_stats($hours_id, $semester) {
            include ('mysql_access.php');
            include('requirements.php');
            // Total Hours
            $sql = "SELECT SUM(hours) AS `sum_hours` FROM `recorded_hours` WHERE `user_id` = '$hours_id' AND `semester` = '$semester' LIMIT 1";
          Severity: Major
          Found in check_requirements.php - About 3 hrs to fix

            File updateinfo.php has 324 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            <?php
            require_once ('session.php');
            require_once ('mysql_access.php');
            ?>
            <!doctype html>
            Severity: Minor
            Found in updateinfo.php - About 3 hrs to fix

              Method show_active has 94 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              function show_active() {
                  include('mysql_access.php');
                  $user_id = $_SESSION['sessionID'];    
                  $aresponse=$db->query("SELECT status FROM contact_information WHERE id=$user_id");
                  $aresult=mysqli_fetch_array($aresponse);
              Severity: Major
              Found in create_event_done.php - About 3 hrs to fix

                Function display has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
                Open

                function display($event_type) {
                        include('mysql_access.php');
                        $user_id = $_SESSION['sessionID'];    
                        $response=$db->query("SELECT MAX(event_id) FROM events_listing");
                        $result=mysqli_fetch_array($response);
                Severity: Minor
                Found in create_event.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 processAttendance has 92 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                function processAttendance($d,$o){
                  include('mysql_access.php');
                  echo "<h1>Process Attendance</h1>";
                  echo "<form method=\"post\" action=\"$_SERVER[PHP_SELF]\">";
                
                
                Severity: Major
                Found in service_leader_functions.php - About 3 hrs to fix

                  Method list_stats has 91 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  function list_stats($hours_id, $semester) {
                    include ('mysql_access.php');
                    global $total_query;
                    // Total Hours
                    $sql = "SELECT SUM(hours) AS `sum_hours` FROM `recorded_hours` WHERE `user_id` = '$hours_id' AND `semester` = '$semester' LIMIT 1";
                  Severity: Major
                  Found in service_hours.php - About 3 hrs to fix

                    Method display_add_form has 90 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    function display_add_form($active_semester){
                    
                        $sql = "SELECT * FROM `apo`.`events`";
                        $result = mysql_query($sql);
                            if($result){
                    Severity: Major
                    Found in attendance_admin.php - About 3 hrs to fix

                      Function backup_tables has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
                      Open

                      function backup_tables($tables = '*')
                      {
                        include('mysql_access.php');
                        //get all of the tables
                        if($tables == '*')
                      Severity: Minor
                      Found in backup.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 show_active has 87 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      function show_active() {
                        include('mysql_access.php');
                        //Generate a dropdown box
                        $sql = "SELECT id, lastname, firstname FROM contact_information UNION DISTINCT SELECT id, lastname, firstname FROM alumni UNION DISTINCT SELECT id, lastname, firstname FROM alumni_info ORDER BY lastname ASC;";
                        $result = $db->query($sql);
                      Severity: Major
                      Found in family_tree_add.php - About 3 hrs to fix

                        File event_signup.php has 310 lines of code (exceeds 250 allowed). Consider refactoring.
                        Open

                        <?php
                        require_once ('session.php');
                        require_once ('mysql_access.php');
                        ?>
                        <!doctype html>
                        Severity: Minor
                        Found in event_signup.php - About 3 hrs to fix

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

                          function attendance_check($user_id){
                              $sql = "SELECT occurrence.e_id AS e_id, occurrence.id AS id, occurrence.date AS date,
                                      events.name AS name, events.worth AS worth, occurrence.type AS type,
                                      recorded_attendance.attended AS attended
                                      FROM occurrence
                          Severity: Major
                          Found in attendance_check.php - About 3 hrs to fix

                            Function list_stats has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
                            Open

                            function list_stats($hours_id, $semester) {
                              include ('mysql_access.php');
                              include('requirements.php');
                              // Total Hours
                              $sql = "SELECT SUM(hours) AS `sum_hours` FROM `recorded_hours` WHERE `user_id` = '$hours_id' AND `semester` = '$semester' LIMIT 1";
                            Severity: Minor
                            Found in check_requirements.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