APO-Epsilon/apo-website

View on GitHub

Showing 167 of 11,898 total issues

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

function initializeNewWeekForm(){
  include('mysql_access.php');
  $dateMap1 = array(0,6,5,4,3,2,1);
  $currentDOW1 = date('w');//returns integer of DOW
  $z1 = $dateMap1[$currentDOW1];//go through map
Severity: Minor
Found in service_admin_week_setup.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

Method check_hours has 68 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function check_hours() {
  include ('mysql_access.php');
  //$sql = "SELECT id FROM contact_information WHERE status = 'Active' OR status = 'Pledge' OR status = 'Elected' OR status = 'Appointed'";
  //$users = $db->query($sql);
Severity: Major
Found in check_all_hours.php - About 2 hrs to fix

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

    function show_active() {
        //dropdown list of events
        ?>
        <h1> Attendance Check-In </h1>
            <?php
    Severity: Major
    Found in rec_sec_attendance_tool.php - About 2 hrs to fix

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

      function show_page() {
        include('mysql_access.php');
        global $current_semester;
      
        if (isset($_POST['update'])) {
      Severity: Minor
      Found in updateinfo.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

      File register.php has 266 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 r8conf2016/register.php - About 2 hrs to fix

        Consider simplifying this complex logical expression.
        Open

            if ($fname == NULL || $lname == NULL || $email == NULL || $tel1 == NULL || $tel2 == NULL || $tel3 == NULL || $password == NULL || $shirt == NULL || $housing == NULL || $chapter1 == NULL || $payment == NULL)
            {
              echo '<div class="entry"><strong>All of the required fields were not filled out.  Please try again.</strong></div>';
            } else {
                $insert = "INSERT INTO `conf_contact_information` (firstname, lastname, email, tel1, tel2, tel3, password, shirt, allergytext, housing, chapter1, chapter2, chapter3, guests, payment, reg_date, reg_time) VALUES('$fname','$lname', '$email', '$tel1', '$tel2', '$tel3', '$password', '$shirt', '$allergytext', '$housing', '$chapter1', '$chapter2', '$chapter3', '$guests', '$payment', '$reg_date', '$reg_time')";
        Severity: Critical
        Found in r8conf2016/register_process.php - About 2 hrs to fix

          Consider simplifying this complex logical expression.
          Open

          if (isset($dev) && ($dev == 1)){
              echo("This page is under development right now, call me if you absolutely need to record attendance.");
          }
          elseif (isset($_POST['new']) && ('process' == $_POST['new'])) {
             process_new();
          Severity: Critical
          Found in attendance_admin.php - About 2 hrs to fix

            Consider simplifying this complex logical expression.
            Open

              else if ($description == 'Ray Miller' ||$description == 'Twin Pines' ||$description == 'Humane Society' ||$description == 'Adair Co. Library' ||$description == 'Recycling Center' ||$description == 'Bought Hours' ||$description == 'Camp' ||$description == 'Bake sale' ||$description == 'Large Service Project' ||$description == 'Other Service Project' ||$description == 'Non-APO Hours') {
                $result = "<div class='entry'>The description cannot be the same as the event. Please enter a valid description so that exec can verify that you did the service hours. <br/></div>";
              }
              else {
                $insert = "insert into apo.recorded_hours (user_id, event, month, day, year, date, description, hours, servicetype, fundraising, semester) values('$id', '$event', '$month','$day', '$year', '$date', '$description', '$hours', '$servicetype', '$fundraising', '$semester');";
            Severity: Critical
            Found in check_hours.php - About 2 hrs to fix

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

              function check_hours() {
                include ('mysql_access.php');
                //$sql = "SELECT id FROM contact_information WHERE status = 'Active' OR status = 'Pledge' OR status = 'Elected' OR status = 'Appointed'";
                //$users = $db->query($sql);
              
              Severity: Minor
              Found in check_all_hours.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

              Method process_login has 56 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              function process_login(){
                require_once ('mysql_access.php');
                $username = addslashes($_POST["username"]);
                $password = addslashes($_POST["password"]);
                $hasher = new PasswordHash(8, true);
              Severity: Major
              Found in login_process.php - About 2 hrs to fix

                Method display has 55 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                function display($group) {
                    if($group == 'All (sorted)') 
                    {
                        echo '<h2>Active Members</h2>';
                        display_active_members();
                Severity: Major
                Found in membership.php - About 2 hrs to fix

                  Method vars_form has 54 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  function vars_form() {
                    include ('mysql_access.php');
                  ?>
                    <div class="small-12 columns">
                      <h1>Change Session Vars</h1>
                  Severity: Major
                  Found in change_session_vars.php - About 2 hrs to fix

                    Function events has 53 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        events : function (scope) {
                          var self = this,
                              S = self.S;
                    
                          S(this.scope)
                    Severity: Major
                    Found in r8conf2016/js/foundation/foundation.reveal.js - About 2 hrs to fix

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

                      function show_active() {
                          //Code based on example at https://vikasmahajan.wordpress.com/2010/07/07/inserting-and-displaying-images-in-mysql-using-php/
                          include('../mysql_access.php');
                          $user_id = $_SESSION['sessionID'];
                          $maxsize = 3000000;
                      Severity: Major
                      Found in includes/upload_photo_process.php - About 2 hrs to fix

                        Function show has 52 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            show : function (el, css) {
                              // is modal
                              if (css) {
                                var settings = el.data(this.attr_name(true) + '-init');
                                if (el.parent('body').length === 0) {
                        Severity: Major
                        Found in r8conf2016/js/foundation/foundation.reveal.js - About 2 hrs to fix

                          Method displayActive has 52 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                          function displayActive($i){
                            include('mysql_access.php');
                          
                            $message = array("Past: ","Present: ","Cancelled: ");
                            //echo $i;
                          Severity: Major
                          Found in service_leader_functions.php - About 2 hrs to fix

                            File service_leader_functions.php has 253 lines of code (exceeds 250 allowed). Consider refactoring.
                            Open

                            <?php
                            
                            function refresh(){
                              echo("<meta http-equiv=\"REFRESH\" content=\"0;url=service_leader_dashboard.php\">");
                            }
                            Severity: Minor
                            Found in service_leader_functions.php - About 2 hrs to fix

                              Function open has 51 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                  open : function (target, ajax_settings) {
                                    var self = this;
                                    if (target) {
                                      if (typeof target.selector !== 'undefined') {
                                        var modal = self.S('#' + target.data(self.data_attr('reveal-id')));
                              Severity: Major
                              Found in r8conf2016/js/foundation/foundation.reveal.js - About 2 hrs to fix

                                Method recorded_hours has 50 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                function recorded_hours(){
                                  include('mysql_access.php');
                                  global $current_semester;
                                  //this is shit code. could be written in OOP.
                                  // not shit code INVENTIVE code.
                                Severity: Minor
                                Found in service_hours_logger.php - About 2 hrs to fix

                                  Method show_attendance has 48 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                  function show_attendance(){
                                      //this will gather the event name and date from the submitted id.
                                      //condense to function
                                      $id = $_POST['event'];//WORKS
                                      $sql = "SELECT events.name AS name, occurrence.date AS date, occurrence.id AS id
                                  Severity: Minor
                                  Found in attendance_admin.php - About 1 hr to fix
                                    Severity
                                    Category
                                    Status
                                    Source
                                    Language