APO-Epsilon/apo-website

View on GitHub
family_tree_add.php

Summary

Maintainability
A
3 hrs
Test Coverage

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

    The function show_active() has 103 lines of code. Current threshold is set to 100. Avoid really long methods.
    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: Minor
    Found in family_tree_add.php by phpmd

    Avoid using undefined variables such as '$db' which will lead to PHP notices.
    Open

      $result = $db->query($sql);
    Severity: Minor
    Found in family_tree_add.php by phpmd

    UndefinedVariable

    Since: 2.8.0

    Detects when a variable is used that has not been defined before.

    Example

    class Foo
    {
        private function bar()
        {
            // $message is undefined
            echo $message;
        }
    }

    Source https://phpmd.org/rules/cleancode.html#undefinedvariable

    Avoid unused local variables such as '$db'.
    Open

      $result = $db->query($sql);
    Severity: Minor
    Found in family_tree_add.php by phpmd

    UnusedLocalVariable

    Since: 0.2

    Detects when a local variable is declared and/or assigned, but not used.

    Example

    class Foo {
        public function doSomething()
        {
            $i = 5; // Unused
        }
    }

    Source https://phpmd.org/rules/unusedcode.html#unusedlocalvariable

    A file should declare new symbols (classes, functions, constants, etc.) and cause no other side effects, or it should execute logic with side effects, but should not do both. The first symbol is defined on line 22 and the first side effect is on line 2.
    Open

    <?php
    Severity: Minor
    Found in family_tree_add.php by phpcodesniffer

    TRUE, FALSE and NULL must be lowercase; expected "false" but found "False"
    Open

    $public_page = False;
    Severity: Minor
    Found in family_tree_add.php by phpcodesniffer

    TRUE, FALSE and NULL must be lowercase; expected "false" but found "False"
    Open

    $exec_page = False;
    Severity: Minor
    Found in family_tree_add.php by phpcodesniffer

    TRUE, FALSE and NULL must be lowercase; expected "true" but found "True"
    Open

    $active_page = True;
    Severity: Minor
    Found in family_tree_add.php by phpcodesniffer

    Line exceeds 120 characters; contains 211 characters
    Open

      $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;";
    Severity: Minor
    Found in family_tree_add.php by phpcodesniffer

    Line exceeds 120 characters; contains 126 characters
    Open

      <!-- This script requires jQuery. It is currently included on every page, but make sure to include it should that change -->
    Severity: Minor
    Found in family_tree_add.php by phpcodesniffer

    Line indented incorrectly; expected at least 8 spaces, found 4
    Open

        $dropdown_options .= "<option value=\"{$row['id']}\">{$row['lastname']}, {$row['firstname']}</option>";
    Severity: Minor
    Found in family_tree_add.php by phpcodesniffer

    Line indented incorrectly; expected 4 spaces, found 2
    Open

      }
    Severity: Minor
    Found in family_tree_add.php by phpcodesniffer

    Line indented incorrectly; expected at least 4 spaces, found 2
    Open

      $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;";
    Severity: Minor
    Found in family_tree_add.php by phpcodesniffer

    Line indented incorrectly; expected at least 4 spaces, found 2
    Open

      $dropdown_options = "<option value=\"\"></option>";
    Severity: Minor
    Found in family_tree_add.php by phpcodesniffer

    Line indented incorrectly; expected 4 spaces, found 2
    Open

      while ($row = mysqli_fetch_array($result)) {
    Severity: Minor
    Found in family_tree_add.php by phpcodesniffer

    Opening brace should be on a new line
    Open

    function show_active() {
    Severity: Minor
    Found in family_tree_add.php by phpcodesniffer

    Line indented incorrectly; expected at least 4 spaces, found 2
    Open

      include('mysql_access.php');
    Severity: Minor
    Found in family_tree_add.php by phpcodesniffer

    Line indented incorrectly; expected 4 spaces, found 2
    Open

      ?>
    Severity: Minor
    Found in family_tree_add.php by phpcodesniffer

    Line indented incorrectly; expected 16 spaces, found 13
    Open

                 <?php echo $dropdown_options ?>
    Severity: Minor
    Found in family_tree_add.php by phpcodesniffer

    Line indented incorrectly; expected at least 4 spaces, found 2
    Open

      $result = $db->query($sql);
    Severity: Minor
    Found in family_tree_add.php by phpcodesniffer

    Space before opening parenthesis of function call prohibited
    Open

    require_once ('session.php');
    Severity: Minor
    Found in family_tree_add.php by phpcodesniffer

    The variable $dropdown_options is not named in camelCase.
    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: Minor
    Found in family_tree_add.php by phpmd

    CamelCaseVariableName

    Since: 0.2

    It is considered best practice to use the camelCase notation to name variables.

    Example

    class ClassName {
        public function doSomething() {
            $data_module = new DataModule();
        }
    }

    Source

    The variable $dropdown_options is not named in camelCase.
    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: Minor
    Found in family_tree_add.php by phpmd

    CamelCaseVariableName

    Since: 0.2

    It is considered best practice to use the camelCase notation to name variables.

    Example

    class ClassName {
        public function doSomething() {
            $data_module = new DataModule();
        }
    }

    Source

    The variable $dropdown_options is not named in camelCase.
    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: Minor
    Found in family_tree_add.php by phpmd

    CamelCaseVariableName

    Since: 0.2

    It is considered best practice to use the camelCase notation to name variables.

    Example

    class ClassName {
        public function doSomething() {
            $data_module = new DataModule();
        }
    }

    Source

    The variable $dropdown_options is not named in camelCase.
    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: Minor
    Found in family_tree_add.php by phpmd

    CamelCaseVariableName

    Since: 0.2

    It is considered best practice to use the camelCase notation to name variables.

    Example

    class ClassName {
        public function doSomething() {
            $data_module = new DataModule();
        }
    }

    Source

    There are no issues that match your filters.

    Category
    Status