APO-Epsilon/apo-website

View on GitHub

Showing 11,898 of 11,898 total issues

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

function display_exec_members() {
    $count = 0;
    include('mysql_access.php');
    $response=$db->query("SELECT * FROM contact_information WHERE status = 'Elected' OR status = 'Appointed' ORDER BY lastname");
    echo '<table>';
Severity: Major
Found in membership.php and 6 other locations - About 2 hrs to fix
membership.php on lines 137..148
membership.php on lines 149..160
membership.php on lines 161..172
membership.php on lines 185..196
membership.php on lines 197..208
membership.php on lines 209..220

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

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 7 locations. Consider refactoring.
Open

function display_inactive_members() {
    $count = 0;
    include('mysql_access.php');
    $response=$db->query("SELECT * FROM contact_information WHERE status = 'inactive' ORDER BY lastname");
    echo '<table>';
Severity: Major
Found in membership.php and 6 other locations - About 2 hrs to fix
membership.php on lines 137..148
membership.php on lines 149..160
membership.php on lines 161..172
membership.php on lines 173..184
membership.php on lines 197..208
membership.php on lines 209..220

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

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 7 locations. Consider refactoring.
Open

function display_alumni_members() {
    $count = 0;
    include('mysql_access.php');
    $response=$db->query("SELECT * FROM contact_information WHERE status = 'Alumni' ORDER BY lastname");
    echo '<table>';
Severity: Major
Found in membership.php and 6 other locations - About 2 hrs to fix
membership.php on lines 137..148
membership.php on lines 161..172
membership.php on lines 173..184
membership.php on lines 185..196
membership.php on lines 197..208
membership.php on lines 209..220

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

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

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

    function removeEventForm(){
      include('mysql_access.php');
      echo "<h2>Remove an Event</h2>";
      echo "<form method=\"post\" action=\"$_SERVER[PHP_SELF]\">";
      echo "<select name=\"event\">";
    Severity: Major
    Found in service_admin_forms.php and 1 other location - About 2 hrs to fix
    service_admin_forms.php on lines 37..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 128.

    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 editEventForm(){
      include('mysql_access.php');
      echo "<h2>Edit an Event</h2>";
      echo "<form method=\"post\" action=\"$_SERVER[PHP_SELF]\">";
      echo "<select name=\"event\">";
    Severity: Major
    Found in service_admin_forms.php and 1 other location - About 2 hrs to fix
    service_admin_forms.php on lines 14..36

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

    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

    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

                  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

                      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

                        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
                              Severity
                              Category
                              Status
                              Source
                              Language