display_create_form accesses the super-global variable $_SERVER. Open
function display_create_form($active_semester){
echo
<<<END
<form method="post" action="$_SERVER[PHP_SELF]" id="create">
- Read upRead up
- Exclude checks
Superglobals
Since: 0.2
Accessing a super-global variable directly is considered a bad practice. These variables should be encapsulated in objects that are provided by a framework, for instance.
Example
class Foo {
public function bar() {
$name = $_POST['foo'];
}
}
Source
process_new accesses the super-global variable $_POST. Open
function process_new()
{
$name = $_POST['name'];
$worth = $_POST['worth'];
$current_semester = $_POST['semester'];
- Read upRead up
- Exclude checks
Superglobals
Since: 0.2
Accessing a super-global variable directly is considered a bad practice. These variables should be encapsulated in objects that are provided by a framework, for instance.
Example
class Foo {
public function bar() {
$name = $_POST['foo'];
}
}
Source
process_new accesses the super-global variable $_POST. Open
function process_new()
{
$name = $_POST['name'];
$worth = $_POST['worth'];
$current_semester = $_POST['semester'];
- Read upRead up
- Exclude checks
Superglobals
Since: 0.2
Accessing a super-global variable directly is considered a bad practice. These variables should be encapsulated in objects that are provided by a framework, for instance.
Example
class Foo {
public function bar() {
$name = $_POST['foo'];
}
}
Source
process_new accesses the super-global variable $_POST. Open
function process_new()
{
$name = $_POST['name'];
$worth = $_POST['worth'];
$current_semester = $_POST['semester'];
- Read upRead up
- Exclude checks
Superglobals
Since: 0.2
Accessing a super-global variable directly is considered a bad practice. These variables should be encapsulated in objects that are provided by a framework, for instance.
Example
class Foo {
public function bar() {
$name = $_POST['foo'];
}
}
Source
check_attendance accesses the super-global variable $_SERVER. Open
function check_attendance(){
echo
<<<END
<form method="post" action="$_SERVER[PHP_SELF]" id="show">
- Read upRead up
- Exclude checks
Superglobals
Since: 0.2
Accessing a super-global variable directly is considered a bad practice. These variables should be encapsulated in objects that are provided by a framework, for instance.
Example
class Foo {
public function bar() {
$name = $_POST['foo'];
}
}
Source
process_add accesses the super-global variable $_POST. Open
function process_add(){//A.K.A. FUNCTION BITCH()
$name = $_POST['name'];
$day = $_POST['day'];
$year = $_POST['year'];
$month = $_POST['month'];
- Read upRead up
- Exclude checks
Superglobals
Since: 0.2
Accessing a super-global variable directly is considered a bad practice. These variables should be encapsulated in objects that are provided by a framework, for instance.
Example
class Foo {
public function bar() {
$name = $_POST['foo'];
}
}
Source
process_log accesses the super-global variable $_POST. Open
function process_log(){
$attended = $_POST['attended'];//array passed to here
$id = $_POST['event'];//WORKS
$size = count($attended);//count elements
for($i=0;$i<$size;$i++){//do something for each, index begins at 0.
- Read upRead up
- Exclude checks
Superglobals
Since: 0.2
Accessing a super-global variable directly is considered a bad practice. These variables should be encapsulated in objects that are provided by a framework, for instance.
Example
class Foo {
public function bar() {
$name = $_POST['foo'];
}
}
Source
process_add accesses the super-global variable $_POST. Open
function process_add(){//A.K.A. FUNCTION BITCH()
$name = $_POST['name'];
$day = $_POST['day'];
$year = $_POST['year'];
$month = $_POST['month'];
- Read upRead up
- Exclude checks
Superglobals
Since: 0.2
Accessing a super-global variable directly is considered a bad practice. These variables should be encapsulated in objects that are provided by a framework, for instance.
Example
class Foo {
public function bar() {
$name = $_POST['foo'];
}
}
Source
process_add accesses the super-global variable $_POST. Open
function process_add(){//A.K.A. FUNCTION BITCH()
$name = $_POST['name'];
$day = $_POST['day'];
$year = $_POST['year'];
$month = $_POST['month'];
- Read upRead up
- Exclude checks
Superglobals
Since: 0.2
Accessing a super-global variable directly is considered a bad practice. These variables should be encapsulated in objects that are provided by a framework, for instance.
Example
class Foo {
public function bar() {
$name = $_POST['foo'];
}
}
Source
display_log_form accesses the super-global variable $_SERVER. Open
function display_log_form(){
$id = $_POST['event'];//WORKS
$sql = "SELECT events.name AS name, occurrence.date AS date, occurrence.id AS id
FROM events
- Read upRead up
- Exclude checks
Superglobals
Since: 0.2
Accessing a super-global variable directly is considered a bad practice. These variables should be encapsulated in objects that are provided by a framework, for instance.
Example
class Foo {
public function bar() {
$name = $_POST['foo'];
}
}
Source
process_add accesses the super-global variable $_POST. Open
function process_add(){//A.K.A. FUNCTION BITCH()
$name = $_POST['name'];
$day = $_POST['day'];
$year = $_POST['year'];
$month = $_POST['month'];
- Read upRead up
- Exclude checks
Superglobals
Since: 0.2
Accessing a super-global variable directly is considered a bad practice. These variables should be encapsulated in objects that are provided by a framework, for instance.
Example
class Foo {
public function bar() {
$name = $_POST['foo'];
}
}
Source
display_add_form accesses the super-global variable $_SERVER. Open
function display_add_form($active_semester){
$sql = "SELECT * FROM `apo`.`events`";
$result = mysql_query($sql);
if($result){
- Read upRead up
- Exclude checks
Superglobals
Since: 0.2
Accessing a super-global variable directly is considered a bad practice. These variables should be encapsulated in objects that are provided by a framework, for instance.
Example
class Foo {
public function bar() {
$name = $_POST['foo'];
}
}
Source
process_add accesses the super-global variable $_POST. Open
function process_add(){//A.K.A. FUNCTION BITCH()
$name = $_POST['name'];
$day = $_POST['day'];
$year = $_POST['year'];
$month = $_POST['month'];
- Read upRead up
- Exclude checks
Superglobals
Since: 0.2
Accessing a super-global variable directly is considered a bad practice. These variables should be encapsulated in objects that are provided by a framework, for instance.
Example
class Foo {
public function bar() {
$name = $_POST['foo'];
}
}
Source
display_log_form accesses the super-global variable $_POST. Open
function display_log_form(){
$id = $_POST['event'];//WORKS
$sql = "SELECT events.name AS name, occurrence.date AS date, occurrence.id AS id
FROM events
- Read upRead up
- Exclude checks
Superglobals
Since: 0.2
Accessing a super-global variable directly is considered a bad practice. These variables should be encapsulated in objects that are provided by a framework, for instance.
Example
class Foo {
public function bar() {
$name = $_POST['foo'];
}
}
Source
display_log_form_init accesses the super-global variable $_SERVER. Open
function display_log_form_init(){
//begin form
echo
<<<END
<form method="post" action="$_SERVER[PHP_SELF]" id="show">
- Read upRead up
- Exclude checks
Superglobals
Since: 0.2
Accessing a super-global variable directly is considered a bad practice. These variables should be encapsulated in objects that are provided by a framework, for instance.
Example
class Foo {
public function bar() {
$name = $_POST['foo'];
}
}
Source
show_attendance accesses the super-global variable $_POST. 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
- Read upRead up
- Exclude checks
Superglobals
Since: 0.2
Accessing a super-global variable directly is considered a bad practice. These variables should be encapsulated in objects that are provided by a framework, for instance.
Example
class Foo {
public function bar() {
$name = $_POST['foo'];
}
}
Source
process_log accesses the super-global variable $_POST. Open
function process_log(){
$attended = $_POST['attended'];//array passed to here
$id = $_POST['event'];//WORKS
$size = count($attended);//count elements
for($i=0;$i<$size;$i++){//do something for each, index begins at 0.
- Read upRead up
- Exclude checks
Superglobals
Since: 0.2
Accessing a super-global variable directly is considered a bad practice. These variables should be encapsulated in objects that are provided by a framework, for instance.
Example
class Foo {
public function bar() {
$name = $_POST['foo'];
}
}
Source
File attendance_admin.php
has 926 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
require_once ('session.php');
require_once ('mysql_access.php');
?>
<!doctype html>
Method display_log_form
has 294 lines of code (exceeds 25 allowed). Consider refactoring. Open
function display_log_form(){
$id = $_POST['event'];//WORKS
$sql = "SELECT events.name AS name, occurrence.date AS date, occurrence.id AS id
FROM events
Method process_add
has 288 lines of code (exceeds 25 allowed). Consider refactoring. Open
function process_add(){//A.K.A. FUNCTION BITCH()
$name = $_POST['name'];
$day = $_POST['day'];
$year = $_POST['year'];
$month = $_POST['month'];
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){
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();
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
Function process_add
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
function process_add(){//A.K.A. FUNCTION BITCH()
$name = $_POST['name'];
$day = $_POST['day'];
$year = $_POST['year'];
$month = $_POST['month'];
- Read upRead up
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 display_log_form
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
function display_log_form(){
$id = $_POST['event'];//WORKS
$sql = "SELECT events.name AS name, occurrence.date AS date, occurrence.id AS id
FROM events
- Read upRead up
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_attendance
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
function check_attendance(){
echo
<<<END
<form method="post" action="$_SERVER[PHP_SELF]" id="show">
Method display_create_form
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
function display_create_form($active_semester){
echo
<<<END
<form method="post" action="$_SERVER[PHP_SELF]" id="create">
Method display_log_form_init
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
function display_log_form_init(){
//begin form
echo
<<<END
<form method="post" action="$_SERVER[PHP_SELF]" id="show">
The function process_add() has 311 lines of code. Current threshold is set to 100. Avoid really long methods. Open
function process_add(){//A.K.A. FUNCTION BITCH()
$name = $_POST['name'];
$day = $_POST['day'];
$year = $_POST['year'];
$month = $_POST['month'];
- Exclude checks
The function display_log_form() has 318 lines of code. Current threshold is set to 100. Avoid really long methods. Open
function display_log_form(){
$id = $_POST['event'];//WORKS
$sql = "SELECT events.name AS name, occurrence.date AS date, occurrence.id AS id
FROM events
- Exclude checks
The function process_add() has an NPath complexity of 1536. The configured NPath complexity threshold is 200. Open
function process_add(){//A.K.A. FUNCTION BITCH()
$name = $_POST['name'];
$day = $_POST['day'];
$year = $_POST['year'];
$month = $_POST['month'];
- Read upRead up
- Exclude checks
NPathComplexity
Since: 0.1
The NPath complexity of a method is the number of acyclic execution paths through that method. A threshold of 200 is generally considered the point where measures should be taken to reduce complexity.
Example
class Foo {
function bar() {
// lots of complicated code
}
}
Source https://phpmd.org/rules/codesize.html#npathcomplexity
The function process_add() has a Cyclomatic Complexity of 18. The configured cyclomatic complexity threshold is 10. Open
function process_add(){//A.K.A. FUNCTION BITCH()
$name = $_POST['name'];
$day = $_POST['day'];
$year = $_POST['year'];
$month = $_POST['month'];
- Read upRead up
- Exclude checks
CyclomaticComplexity
Since: 0.1
Complexity is determined by the number of decision points in a method plus one for the method entry. The decision points are 'if', 'while', 'for', and 'case labels'. Generally, 1-4 is low complexity, 5-7 indicates moderate complexity, 8-10 is high complexity, and 11+ is very high complexity.
Example
// Cyclomatic Complexity = 11
class Foo {
1 public function example() {
2 if ($a == $b) {
3 if ($a1 == $b1) {
fiddle();
4 } elseif ($a2 == $b2) {
fiddle();
} else {
fiddle();
}
5 } elseif ($c == $d) {
6 while ($c == $d) {
fiddle();
}
7 } elseif ($e == $f) {
8 for ($n = 0; $n < $h; $n++) {
fiddle();
}
} else {
switch ($z) {
9 case 1:
fiddle();
break;
10 case 2:
fiddle();
break;
11 case 3:
fiddle();
break;
default:
fiddle();
break;
}
}
}
}
Source https://phpmd.org/rules/codesize.html#cyclomaticcomplexity
The method process_new uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
}else{
echo("The event has been added.");
}
- Read upRead up
- Exclude checks
ElseExpression
Since: 1.4.0
An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.
Example
class Foo
{
public function bar($flag)
{
if ($flag) {
// one branch
} else {
// another branch
}
}
}
Source https://phpmd.org/rules/cleancode.html#elseexpression
The method process_log uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
}else{
echo(mysql_error());
}
- Read upRead up
- Exclude checks
ElseExpression
Since: 1.4.0
An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.
Example
class Foo
{
public function bar($flag)
{
if ($flag) {
// one branch
} else {
// another branch
}
}
}
Source https://phpmd.org/rules/cleancode.html#elseexpression
The method process_add uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
}else{
die("error".mysql_error());
}
- Read upRead up
- Exclude checks
ElseExpression
Since: 1.4.0
An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.
Example
class Foo
{
public function bar($flag)
{
if ($flag) {
// one branch
} else {
// another branch
}
}
}
Source https://phpmd.org/rules/cleancode.html#elseexpression
The method display_add_form uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
}else{echo("bad sql".mysql_error());}
- Read upRead up
- Exclude checks
ElseExpression
Since: 1.4.0
An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.
Example
class Foo
{
public function bar($flag)
{
if ($flag) {
// one branch
} else {
// another branch
}
}
}
Source https://phpmd.org/rules/cleancode.html#elseexpression
The method display_log_form uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
}else{
$ids[$i] = $row['id'];
}
- Read upRead up
- Exclude checks
ElseExpression
Since: 1.4.0
An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.
Example
class Foo
{
public function bar($flag)
{
if ($flag) {
// one branch
} else {
// another branch
}
}
}
Source https://phpmd.org/rules/cleancode.html#elseexpression
Avoid unused local variables such as '$current_semester'. Open
$current_semester = $_POST['semester'];
- Read upRead up
- Exclude checks
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
Avoid unused local variables such as '$index'. Open
foreach($ids as $index => $value){
- Read upRead up
- Exclude checks
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
Avoid unused local variables such as '$index'. Open
foreach($ids as $index => $value){
- Read upRead up
- Exclude checks
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
Avoid unused parameters such as '$active_semester'. Open
function display_add_form($active_semester){
- Read upRead up
- Exclude checks
UnusedFormalParameter
Since: 0.2
Avoid passing parameters to methods or constructors and then not using those parameters.
Example
class Foo
{
private function bar($howdy)
{
// $howdy is not used
}
}
Source https://phpmd.org/rules/unusedcode.html#unusedformalparameter
The function process_add() contains an exit expression. Open
die("error".mysql_error());
- Read upRead up
- Exclude checks
ExitExpression
Since: 0.2
An exit-expression within regular code is untestable and therefore it should be avoided. Consider to move the exit-expression into some kind of startup script where an error/exception code is returned to the calling environment.
Example
class Foo {
public function bar($param) {
if ($param === 42) {
exit(23);
}
}
}
Source https://phpmd.org/rules/design.html#exitexpression
The function process_add() contains an exit expression. Open
die("you didn't fill the form out correctly, please start over");
- Read upRead up
- Exclude checks
ExitExpression
Since: 0.2
An exit-expression within regular code is untestable and therefore it should be avoided. Consider to move the exit-expression into some kind of startup script where an error/exception code is returned to the calling environment.
Example
class Foo {
public function bar($param) {
if ($param === 42) {
exit(23);
}
}
}
Source https://phpmd.org/rules/design.html#exitexpression
Avoid unused local variables such as '$index'. Open
foreach($ids as $index => $value){
- Read upRead up
- Exclude checks
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
Similar blocks of code found in 2 locations. Consider refactoring. Open
function display_log_form_init(){
//begin form
echo
<<<END
<form method="post" action="$_SERVER[PHP_SELF]" id="show">
- Read upRead up
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 101.
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
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 2 locations. Consider refactoring. Open
function check_attendance(){
echo
<<<END
<form method="post" action="$_SERVER[PHP_SELF]" id="show">
- Read upRead up
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 101.
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
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 2 locations. Consider refactoring. Open
if($type == 'Pledge'){
$WHERE = "status = 'Pledge'";
}elseif($type == 'Active'){
$WHERE = "status != 'Alumni' AND status != 'Inactive' AND status != 'Advisor' AND status != 'Pledge'";
}elseif($type == 'Exec'){
- Read upRead up
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 91.
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
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
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 27 and the first side effect is on line 2. Open
<?php
- Exclude checks
The parameter $active_semester is not named in camelCase. Open
function display_create_form($active_semester){
echo
<<<END
<form method="post" action="$_SERVER[PHP_SELF]" id="create">
- Read upRead up
- Exclude checks
CamelCaseParameterName
Since: 0.2
It is considered best practice to use the camelCase notation to name parameters.
Example
class ClassName {
public function doSomething($user_name) {
}
}
Source
Avoid variables with short names like $id. Configured minimum length is 3. Open
$id = $row['id'];
- Read upRead up
- Exclude checks
ShortVariable
Since: 0.2
Detects when a field, local, or parameter has a very short name.
Example
class Something {
private $q = 15; // VIOLATION - Field
public static function main( array $as ) { // VIOLATION - Formal
$r = 20 + $this->q; // VIOLATION - Local
for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
$r += $this->q;
}
}
}
Source https://phpmd.org/rules/naming.html#shortvariable
Avoid variables with short names like $id. Configured minimum length is 3. Open
$id = $_POST['event'];//WORKS
- Read upRead up
- Exclude checks
ShortVariable
Since: 0.2
Detects when a field, local, or parameter has a very short name.
Example
class Something {
private $q = 15; // VIOLATION - Field
public static function main( array $as ) { // VIOLATION - Formal
$r = 20 + $this->q; // VIOLATION - Local
for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
$r += $this->q;
}
}
}
Source https://phpmd.org/rules/naming.html#shortvariable
Avoid variables with short names like $id. Configured minimum length is 3. Open
$id = $_POST['event'];//WORKS
- Read upRead up
- Exclude checks
ShortVariable
Since: 0.2
Detects when a field, local, or parameter has a very short name.
Example
class Something {
private $q = 15; // VIOLATION - Field
public static function main( array $as ) { // VIOLATION - Formal
$r = 20 + $this->q; // VIOLATION - Local
for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
$r += $this->q;
}
}
}
Source https://phpmd.org/rules/naming.html#shortvariable
The parameter $active_semester is not named in camelCase. Open
function display_add_form($active_semester){
$sql = "SELECT * FROM `apo`.`events`";
$result = mysql_query($sql);
if($result){
- Read upRead up
- Exclude checks
CamelCaseParameterName
Since: 0.2
It is considered best practice to use the camelCase notation to name parameters.
Example
class ClassName {
public function doSomething($user_name) {
}
}
Source
Avoid variables with short names like $id. Configured minimum length is 3. Open
$id = $row['id'];
- Read upRead up
- Exclude checks
ShortVariable
Since: 0.2
Detects when a field, local, or parameter has a very short name.
Example
class Something {
private $q = 15; // VIOLATION - Field
public static function main( array $as ) { // VIOLATION - Formal
$r = 20 + $this->q; // VIOLATION - Local
for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
$r += $this->q;
}
}
}
Source https://phpmd.org/rules/naming.html#shortvariable
Avoid variables with short names like $id. Configured minimum length is 3. Open
$id = $_POST['event'];//WORKS
- Read upRead up
- Exclude checks
ShortVariable
Since: 0.2
Detects when a field, local, or parameter has a very short name.
Example
class Something {
private $q = 15; // VIOLATION - Field
public static function main( array $as ) { // VIOLATION - Formal
$r = 20 + $this->q; // VIOLATION - Local
for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
$r += $this->q;
}
}
}
Source https://phpmd.org/rules/naming.html#shortvariable
Avoid variables with short names like $id. Configured minimum length is 3. Open
$id = $row['id'];
- Read upRead up
- Exclude checks
ShortVariable
Since: 0.2
Detects when a field, local, or parameter has a very short name.
Example
class Something {
private $q = 15; // VIOLATION - Field
public static function main( array $as ) { // VIOLATION - Formal
$r = 20 + $this->q; // VIOLATION - Local
for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
$r += $this->q;
}
}
}
Source https://phpmd.org/rules/naming.html#shortvariable
Blank line found at start of control structure Open
}else{
- Exclude checks
Blank line found at start of control structure Open
if($result){
- Exclude checks
Line exceeds 120 characters; contains 122 characters Open
echo("<input type=\"checkbox\" name=\"attended[]\" value=\"$value\" checked>{$lastname}, $firstname<br>");
- Exclude checks
Expected 1 space after WHILE keyword; 0 found Open
while($row = mysql_fetch_array($result)){
- Exclude checks
Space before opening parenthesis of function call prohibited Open
require_once ('mysql_access.php');
- Exclude checks
Line indented incorrectly; expected 4 spaces, found 12 Open
while($row = mysql_fetch_array($result)){
- Exclude checks
Line indented incorrectly; expected 4 spaces, found 12 Open
if(!$result)
- Exclude checks
Expected 1 space after closing brace; 0 found Open
}elseif($type == 'All'){
- Exclude checks
Expected 1 space after WHILE keyword; 0 found Open
while($row = mysql_fetch_array($result)){
- Exclude checks
Expected 1 space after closing parenthesis; found 0 Open
foreach($ids as $index => $value){
- Exclude checks
Expected 1 space after IF keyword; 0 found Open
if(($name == 'NULL')||($day == 'NULL')||($month == 'NULL')||($year == 'NULL')||($type == 'NULL')){
- Exclude checks
Line indented incorrectly; expected 8 spaces, found 12 Open
if($type == 'Exec'){
- Exclude checks
Space before opening parenthesis of function call prohibited Open
require_once ('session.php');
- Exclude checks
Line indented incorrectly; expected at least 4 spaces, found 0 Open
<<<END
- Exclude checks
Expected 1 space after IF keyword; 0 found Open
if($type == 'Pledge'){
- Exclude checks
Expected 1 space after IF keyword; 0 found Open
if($result){
- Exclude checks
Line indented incorrectly; expected 4 spaces, found 8 Open
}
- Exclude checks
Line indented incorrectly; expected 8 spaces, found 12 Open
}else{
- Exclude checks
Expected 1 space after closing brace; 0 found Open
}elseif($type == 'Broho'){
- Exclude checks
Expected 1 space after WHILE keyword; 0 found Open
while($row = mysql_fetch_array($result)){
- Exclude checks
Expected 1 space after ELSEIF keyword; 0 found Open
}elseif($type == 'Broho'){
- Exclude checks
Line indented incorrectly; expected 4 spaces, found 8 Open
}
- Exclude checks
Expected 1 space after second semicolon of FOR loop; 0 found Open
for ($i=0;$i<$num_rows;$i++){
- Exclude checks
Expected 1 space after closing brace; 0 found Open
}elseif($type == 'Trial'){
- Exclude checks
Line indented incorrectly; expected 8 spaces, found 16 Open
while($row = mysql_fetch_array($result)){
- Exclude checks
Line indented incorrectly; expected at least 4 spaces, found 0 Open
$position = $_SESSION['sessionposition'];
- Exclude checks
Line indented incorrectly; expected 4 spaces, found 8 Open
foreach($ids as $index => $value){
- Exclude checks
Line indented incorrectly; expected 4 spaces, found 8 Open
while($row = mysql_fetch_array($result)){
- Exclude checks
Newline required after opening brace Open
if($position != "Webmaster" && $position != "President"){echo("You do not have permission to view this page.");
- Exclude checks
Line indented incorrectly; expected at least 4 spaces, found 0 Open
echo
- Exclude checks
Expected 1 space after closing parenthesis; found 0 Open
for ($i=0;$i<$num_rows;$i++){
- Exclude checks
Line indented incorrectly; expected 4 spaces, found 0 Open
if (isset($dev) && ($dev == 1)){
- Exclude checks
Expected 1 space after closing parenthesis; found 0 Open
while($row = mysql_fetch_array($result)){
- Exclude checks
Line indented incorrectly; expected at least 4 spaces, found 0 Open
echo
- Exclude checks
Expected 1 space after closing brace; 0 found Open
}elseif (isset($_POST['show']) && ('show_add' == $_POST['show'])) {
- Exclude checks
Line indented incorrectly; expected at least 8 spaces, found 4 Open
display_log_form();
- Exclude checks
Line indented incorrectly; expected at least 4 spaces, found 0 Open
echo
- Exclude checks
Line indented incorrectly; expected 4 spaces, found 8 Open
}
- Exclude checks
Line indented incorrectly; expected 8 spaces, found 12 Open
}
- Exclude checks
Line indented incorrectly; expected 12 spaces, found 16 Open
}
- Exclude checks
Line indented incorrectly; expected 4 spaces, found 0 Open
}
- Exclude checks
Line indented incorrectly; expected at least 4 spaces, found 0 Open
<<<END
- Exclude checks
Line indented incorrectly; expected 4 spaces, found 8 Open
foreach($ids as $index => $value){
- Exclude checks
Expected 1 space after closing parenthesis; found 0 Open
while($row = mysql_fetch_array($result)){
- Exclude checks
Line indented incorrectly; expected 4 spaces, found 8 Open
}
- Exclude checks
Line indented incorrectly; expected 4 spaces, found 0 Open
elseif (isset($_POST['new']) && ('process' == $_POST['new'])) {
- Exclude checks
Line indented incorrectly; expected at least 8 spaces, found 4 Open
display_create_form($current_semester);
- Exclude checks
Expected 1 space after ELSE keyword; 0 found Open
}else{
- Exclude checks
Newline required after opening brace Open
if(isset($_SESSION['sessionposition']) != 1){echo("You do not have permission to view this page.");
- Exclude checks
Line indented incorrectly; expected 4 spaces, found 0 Open
}else{
- Exclude checks
Expected 1 space after closing brace; newline found Open
}
- Exclude checks
Line indented incorrectly; expected 4 spaces, found 0 Open
}elseif (isset($_POST['show']) && ('show_create' == $_POST['show'])) {
- Exclude checks
Expected 1 space after closing brace; 0 found Open
}elseif (isset($_POST['show']) && ('show_log' == $_POST['show'])) {
- Exclude checks
Expected 1 space after closing brace; 0 found Open
}elseif (isset($_POST['show']) && ('process_init' == $_POST['show'])) {
- Exclude checks
Expected 1 space after closing brace; 0 found Open
}else{
- Exclude checks
Expected 1 space after closing parenthesis; found 17 Open
if(!$result)
- Exclude checks
Line indented incorrectly; expected 4 spaces, found 16 Open
}
- Exclude checks
Closing brace indented incorrectly; expected 8 spaces, found 0 Open
}else{echo("bad sql".mysql_error());}
- Exclude checks
Line indented incorrectly; expected 4 spaces, found 8 Open
if($result){
- Exclude checks
Expected 1 space after closing parenthesis; found 0 Open
if($result){
- Exclude checks
Expected 1 space after ELSEIF keyword; 0 found Open
}elseif($type == 'Committee'){
- Exclude checks
Expected 1 space after ELSEIF keyword; 0 found Open
}elseif($type == 'Trial'){
- Exclude checks
Line indented incorrectly; expected 4 spaces, found 8 Open
}
- Exclude checks
Closing brace indented incorrectly; expected 8 spaces, found 4 Open
}
- Exclude checks
Line indented incorrectly; expected 12 spaces, found 16 Open
if($status == 'Elected' || $status == 'Appointed'){
- Exclude checks
Line indented incorrectly; expected at least 4 spaces, found 0 Open
<<<END
- Exclude checks
Expected 1 space after first semicolon of FOR loop; 0 found Open
for($i=0;$i<$size;$i++){//do something for each, index begins at 0.
- Exclude checks
Line indented incorrectly; expected 4 spaces, found 8 Open
while($row = mysql_fetch_array($result)){
- Exclude checks
Line indented incorrectly; expected at least 4 spaces, found 0 Open
echo
- Exclude checks
Expected 1 space after second semicolon of FOR loop; 0 found Open
for($i=0;$i<$size;$i++){//do something for each, index begins at 0.
- Exclude checks
Line indented incorrectly; expected 4 spaces, found 8 Open
for ($i=0;$i<$num_rows;$i++){
- Exclude checks
Opening brace should be on a new line Open
function show_attendance(){
- Exclude checks
Line indented incorrectly; expected at least 8 spaces, found 4 Open
display_add_form($current_semester);
- Exclude checks
Expected 1 space after closing parenthesis; found 0 Open
for ($i=0;$i<$num_rows;$i++){
- Exclude checks
Line indented incorrectly; expected 4 spaces, found 0 Open
}elseif (isset($_POST['log']) && ('process' == $_POST['log'])) {
- Exclude checks
Expected 1 space after IF keyword; 0 found Open
if($position != "Webmaster" && $position != "President"){echo("You do not have permission to view this page.");
- Exclude checks
Line indented incorrectly; expected 4 spaces, found 0 Open
}else{
- Exclude checks
Line indented incorrectly; expected at least 8 spaces, found 0 Open
<<<END
- Exclude checks
Line indented incorrectly; expected 4 spaces, found 8 Open
while ($row = mysql_fetch_assoc($result)) {
- Exclude checks
Expected 1 space after first semicolon of FOR loop; 0 found Open
for ($i=0;$i<$num_rows;$i++){
- Exclude checks
Expected 1 space after closing parenthesis; found 0 Open
if($type == 'Exec'){
- Exclude checks
Expected 1 space after closing parenthesis; found 0 Open
if($result){
- Exclude checks
Closing brace indented incorrectly; expected 8 spaces, found 4 Open
}
- Exclude checks
Line indented incorrectly; expected 4 spaces, found 8 Open
}
- Exclude checks
Expected 1 space after closing parenthesis; found 0 Open
foreach($ids as $index => $value){
- Exclude checks
Expected 1 space after closing brace; 0 found Open
}else{
- Exclude checks
Line indented incorrectly; expected 4 spaces, found 0 Open
if($position != "Webmaster" && $position != "President"){echo("You do not have permission to view this page.");
- Exclude checks
Expected 1 space after closing brace; 0 found Open
}elseif (isset($_POST['check']) && ('process' == $_POST['check'])) {
- Exclude checks
Line indented incorrectly; expected 4 spaces, found 12 Open
}
- Exclude checks
Line indented incorrectly; expected 0 spaces, found 24 Open
}
- Exclude checks
Expected 1 space after closing parenthesis; found 0 Open
}elseif($type == 'Active'){
- Exclude checks
Expected 1 space after closing brace; 0 found Open
}elseif($type == 'Exec'){
- Exclude checks
Expected 1 space after closing parenthesis; found 0 Open
}elseif($type == 'Committee'){
- Exclude checks
Line indented incorrectly; expected 4 spaces, found 8 Open
}
- Exclude checks
Expected 1 space after WHILE keyword; 0 found Open
while($row = mysql_fetch_array($result)){
- Exclude checks
Expected 1 space after IF keyword; 0 found Open
if($type == 'Exec'){
- Exclude checks
Line indented incorrectly; expected at least 4 spaces, found 0 Open
echo
- Exclude checks
Line indented incorrectly; expected at least 4 spaces, found 0 Open
<<<END
- Exclude checks
Expected 1 space after closing brace; 0 found Open
}elseif (isset($_POST['show']) && ('show_create' == $_POST['show'])) {
- Exclude checks
Line indented incorrectly; expected 4 spaces, found 0 Open
}elseif (isset($_POST['check']) && ('process' == $_POST['check'])) {
- Exclude checks
Expected 1 space after closing brace; 0 found Open
}else{
- Exclude checks
Expected 1 space after closing brace; 0 found Open
}else{
- Exclude checks
Expected 1 space after closing brace; 0 found Open
}elseif($type == 'Committee'){
- Exclude checks
Expected 1 space after ELSE keyword; 0 found Open
}else{
- Exclude checks
Expected 1 space after closing brace; 0 found Open
}else{
- Exclude checks
Expected 1 space after closing parenthesis; found 0 Open
while($row = mysql_fetch_array($result)){
- Exclude checks
Expected 1 space after closing brace; 0 found Open
}else{
- Exclude checks
Expected 1 space after ELSE keyword; 0 found Open
}else{
- Exclude checks
Line indented incorrectly; expected 4 spaces, found 0 Open
}elseif (isset($_POST['add']) && ('process' == $_POST['add'])) {
- Exclude checks
Line indented incorrectly; expected at least 8 spaces, found 4 Open
process_log();
- Exclude checks
Line indented incorrectly; expected 4 spaces, found 0 Open
}elseif (isset($_POST['show']) && ('process_init' == $_POST['show'])) {
- Exclude checks
Expected 1 space after closing brace; 0 found Open
}elseif (isset($_POST['show']) && ('check' == $_POST['show'])) {
- Exclude checks
Opening brace should be on a new line Open
function display_add_form($active_semester){
- Exclude checks
No space found after comma in function call Open
$date = date("Y-m-d", mktime(0,0,0,$month,$day,$year));
- Exclude checks
Expected 1 space after closing parenthesis; found 0 Open
if($result){
- Exclude checks
Expected 1 space after IF keyword; 0 found Open
if($result){
- Exclude checks
Expected 1 space after closing brace; 0 found Open
}elseif($type == 'Active'){
- Exclude checks
Expected 1 space after closing parenthesis; found 0 Open
}elseif($type == 'Broho'){
- Exclude checks
Line indented incorrectly; expected 8 spaces, found 16 Open
while($row = mysql_fetch_array($result)){
- Exclude checks
Closing brace indented incorrectly; expected 12 spaces, found 16 Open
}else{
- Exclude checks
Line indented incorrectly; expected 8 spaces, found 12 Open
}else{
- Exclude checks
Line indented incorrectly; expected 8 spaces, found 12 Open
if($result){
- Exclude checks
Line indented incorrectly; expected at least 4 spaces, found 0 Open
echo
- Exclude checks
Line indented incorrectly; expected 8 spaces, found 12 Open
}
- Exclude checks
Expected 1 space after FOREACH keyword; 0 found Open
foreach($ids as $index => $value){
- Exclude checks
Expected 1 space after first semicolon of FOR loop; 0 found Open
for ($i=0;$i<$num_rows;$i++){
- Exclude checks
Expected 1 space after closing brace; 0 found Open
}else{echo("bad sql".mysql_error());}
- Exclude checks
Expected 1 space after IF keyword; 0 found Open
if(isset($_SESSION['sessionposition']) != 1){echo("You do not have permission to view this page.");
- Exclude checks
Expected 1 space after closing parenthesis; found 0 Open
if($position != "Webmaster" && $position != "President"){echo("You do not have permission to view this page.");
- Exclude checks
Expected 1 space after ELSE keyword; 0 found Open
}else{echo("bad sql".mysql_error());}
- Exclude checks
Expected 1 space after ELSE keyword; 0 found Open
}else{
- Exclude checks
Line indented incorrectly; expected 4 spaces, found 0 Open
}elseif (isset($_POST['show']) && ('show_add' == $_POST['show'])) {
- Exclude checks
Line indented incorrectly; expected at least 8 spaces, found 4 Open
check_attendance();
- Exclude checks
Opening brace must be the last content on the line Open
function process_add(){//A.K.A. FUNCTION BITCH()
- Exclude checks
No space found after comma in function call Open
$date = date("Y-m-d", mktime(0,0,0,$month,$day,$year));
- Exclude checks
Line indented incorrectly; expected at least 8 spaces, found 4 Open
show_attendance();
- Exclude checks
Expected 1 space after ELSE keyword; 0 found Open
}else{
- Exclude checks
Expected 1 space after closing parenthesis; found 0 Open
}elseif($type == 'Trial'){
- Exclude checks
Expected 1 space after closing parenthesis; found 0 Open
while($row = mysql_fetch_array($result)){
- Exclude checks
Expected 1 space after closing parenthesis; found 0 Open
while($row = mysql_fetch_array($result)){
- Exclude checks
Expected 1 space after closing parenthesis; found 0 Open
if($status == 'Elected' || $status == 'Appointed'){
- Exclude checks
Line indented incorrectly; expected 8 spaces, found 16 Open
}
- Exclude checks
Line indented incorrectly; expected at least 8 spaces, found 4 Open
process_add();
- Exclude checks
Line indented incorrectly; expected 4 spaces, found 0 Open
}elseif (isset($_POST['show']) && ('show_log' == $_POST['show'])) {
- Exclude checks
Expected 1 space after closing parenthesis; found 0 Open
while($row = mysql_fetch_array($result)){
- Exclude checks
Line indented incorrectly; expected 4 spaces, found 0 Open
}else{echo("bad sql".mysql_error());}
- Exclude checks
Newline required after opening brace Open
}else{echo("bad sql".mysql_error());}
- Exclude checks
Expected 1 space after closing parenthesis; found 0 Open
}elseif($type == 'Exec'){
- Exclude checks
Expected 1 space after ELSEIF keyword; 0 found Open
}elseif($type == 'All'){
- Exclude checks
Expected 1 space after FOR keyword; 0 found Open
for($i=0;$i<$size;$i++){//do something for each, index begins at 0.
- Exclude checks
Expected 1 space after ELSE keyword; 0 found Open
}else{
- Exclude checks
Line indented incorrectly; expected at least 4 spaces, found 0 Open
<<<END
- Exclude checks
Expected 1 space after closing parenthesis; found 0 Open
while($row = mysql_fetch_array($result)){
- Exclude checks
Expected 1 space after closing parenthesis; found 0 Open
if(isset($_SESSION['sessionposition']) != 1){echo("You do not have permission to view this page.");
- Exclude checks
Line indented incorrectly; expected 4 spaces, found 16 Open
}else{
- Exclude checks
Expected 1 space after IF keyword; 0 found Open
if($result){
- Exclude checks
Line indented incorrectly; expected 0 spaces, found 24 Open
while($row = mysql_fetch_array($result)){
- Exclude checks
Opening brace should be on a new line Open
function process_add(){//A.K.A. FUNCTION BITCH()
- Exclude checks
Expected 1 space after closing parenthesis; found 0 Open
}elseif($type == 'All'){
- Exclude checks
Expected 1 space after FOREACH keyword; 0 found Open
foreach($ids as $index => $value){
- Exclude checks
Opening brace should be on a new line Open
function display_log_form_init(){
- Exclude checks
Line indented incorrectly; expected 4 spaces, found 8 Open
for ($i=0;$i<$num_rows;$i++){
- Exclude checks
Expected 1 space after closing parenthesis; found 0 Open
foreach($ids as $index => $value){
- Exclude checks
Expected 1 space after WHILE keyword; 0 found Open
while($row = mysql_fetch_array($result)){
- Exclude checks
Opening brace should be on a new line Open
function check_attendance(){
- Exclude checks
Line indented incorrectly; expected 4 spaces, found 8 Open
while($row = mysql_fetch_array($result)){
- Exclude checks
Expected 1 space after ELSE keyword; 0 found Open
}else{
- Exclude checks
Line indented incorrectly; expected at least 4 spaces, found 0 Open
echo
- Exclude checks
Expected 1 space after closing parenthesis; found 0 Open
if (isset($dev) && ($dev == 1)){
- Exclude checks
Line indented incorrectly; expected at least 4 spaces, found 0 Open
<<<END
- Exclude checks
No space found after comma in function call Open
$date = date("Y-m-d", mktime(0,0,0,$month,$day,$year));
- Exclude checks
Line indented incorrectly; expected 4 spaces, found 8 Open
while ($row = mysql_fetch_assoc($result)) {
- Exclude checks
Line indented incorrectly; expected 4 spaces, found 8 Open
}
- Exclude checks
Expected 1 space after ELSEIF keyword; 0 found Open
}elseif($type == 'Active'){
- Exclude checks
Expected 1 space after second semicolon of FOR loop; 0 found Open
for ($i=0;$i<$num_rows;$i++){
- Exclude checks
Line indented incorrectly; expected 4 spaces, found 8 Open
}
- Exclude checks
Expected 1 space after FOREACH keyword; 0 found Open
foreach($ids as $index => $value){
- Exclude checks
Expected 1 space after closing parenthesis; found 0 Open
while($row = mysql_fetch_array($result)){
- Exclude checks
Opening brace should be on a new line Open
function process_log(){
- Exclude checks
Expected 1 space after closing parenthesis; found 0 Open
for($i=0;$i<$size;$i++){//do something for each, index begins at 0.
- Exclude checks
Line indented incorrectly; expected 4 spaces, found 8 Open
while($row = mysql_fetch_array($result)){
- Exclude checks
Line indented incorrectly; expected 4 spaces, found 8 Open
if($result){
- Exclude checks
Closing brace must be on a line by itself Open
}else{echo("bad sql".mysql_error());}
- Exclude checks
Expected 1 space after WHILE keyword; 0 found Open
while($row = mysql_fetch_array($result)){
- Exclude checks
Line indented incorrectly; expected 4 spaces, found 8 Open
for ($i=0;$i<$num_rows;$i++){
- Exclude checks
Expected 1 space after WHILE keyword; 0 found Open
while($row = mysql_fetch_array($result)){
- Exclude checks
Expected 1 space after first semicolon of FOR loop; 0 found Open
for ($i=0;$i<$num_rows;$i++){
- Exclude checks
Line indented incorrectly; expected at least 8 spaces, found 4 Open
echo("This page is under development right now, call me if you absolutely need to record attendance.");
- Exclude checks
Line indented incorrectly; expected at least 4 spaces, found 0 Open
<<<END
- Exclude checks
Opening brace should be on a new line Open
function display_log_form(){
- Exclude checks
Line indented incorrectly; expected 4 spaces, found 0 Open
}
- Exclude checks
Expected 1 space after IF keyword; 0 found Open
if($status == 'Elected' || $status == 'Appointed'){
- Exclude checks
Line indented incorrectly; expected at least 8 spaces, found 3 Open
process_new();
- Exclude checks
Line indented incorrectly; expected 4 spaces, found 8 Open
foreach($ids as $index => $value){
- Exclude checks
Line indented incorrectly; expected at least 8 spaces, found 4 Open
display_log_form_init();
- Exclude checks
Expected 1 space after second semicolon of FOR loop; 0 found Open
for ($i=0;$i<$num_rows;$i++){
- Exclude checks
Expected 1 space after closing brace; 0 found Open
}elseif (isset($_POST['add']) && ('process' == $_POST['add'])) {
- Exclude checks
Expected 1 space after closing brace; 0 found Open
}elseif (isset($_POST['log']) && ('process' == $_POST['log'])) {
- Exclude checks
Expected 1 space after IF keyword; 0 found Open
if(!$result)
- Exclude checks
Line indented incorrectly; expected 4 spaces, found 0 Open
}elseif (isset($_POST['show']) && ('check' == $_POST['show'])) {
- Exclude checks
Opening brace should be on a new line Open
function display_create_form($active_semester){
- Exclude checks
Line indented incorrectly; expected at least 8 spaces, found 0 Open
echo
- Exclude checks
Line indented incorrectly; expected at least 4 spaces, found 0 Open
<<<END
- Exclude checks
Expected 1 space after closing parenthesis; found 0 Open
if(($name == 'NULL')||($day == 'NULL')||($month == 'NULL')||($year == 'NULL')||($type == 'NULL')){
- Exclude checks
No space found after comma in function call Open
$date = date("Y-m-d", mktime(0,0,0,$month,$day,$year));
- Exclude checks
No space found after comma in function call Open
$date = date("Y-m-d", mktime(0,0,0,$month,$day,$year));
- Exclude checks
Line indented incorrectly; expected 4 spaces, found 8 Open
}else{
- Exclude checks
Line indented incorrectly; expected 4 spaces, found 8 Open
}
- Exclude checks
Expected 1 space after closing parenthesis; found 0 Open
if($type == 'Pledge'){
- Exclude checks
Expected 1 space after ELSEIF keyword; 0 found Open
}elseif($type == 'Exec'){
- Exclude checks
Expected 1 space after closing parenthesis; found 0 Open
for ($i=0;$i<$num_rows;$i++){
- Exclude checks
Expected 1 space after WHILE keyword; 0 found Open
while($row = mysql_fetch_array($result)){
- Exclude checks
Line indented incorrectly; expected at least 4 spaces, found 0 Open
echo
- Exclude checks
Line indented incorrectly; expected at least 4 spaces, found 0 Open
<<<END
- Exclude checks
Expected 1 space after closing brace; 0 found Open
}else{
- Exclude checks
Line indented incorrectly; expected 8 spaces, found 16 Open
}
- Exclude checks
Line indented incorrectly; expected 4 spaces, found 8 Open
}
- Exclude checks
Line indented incorrectly; expected 4 spaces, found 0 Open
}
- Exclude checks
The variable $current_semester is not named in camelCase. Open
function process_new()
{
$name = $_POST['name'];
$worth = $_POST['worth'];
$current_semester = $_POST['semester'];
- Read upRead up
- Exclude checks
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 $WHERE is not named in camelCase. Open
function process_add(){//A.K.A. FUNCTION BITCH()
$name = $_POST['name'];
$day = $_POST['day'];
$year = $_POST['year'];
$month = $_POST['month'];
- Read upRead up
- Exclude checks
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 $WHERE is not named in camelCase. Open
function process_add(){//A.K.A. FUNCTION BITCH()
$name = $_POST['name'];
$day = $_POST['day'];
$year = $_POST['year'];
$month = $_POST['month'];
- Read upRead up
- Exclude checks
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 $WHERE is not named in camelCase. Open
function process_add(){//A.K.A. FUNCTION BITCH()
$name = $_POST['name'];
$day = $_POST['day'];
$year = $_POST['year'];
$month = $_POST['month'];
- Read upRead up
- Exclude checks
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 $num_rows is not named in camelCase. Open
function process_add(){//A.K.A. FUNCTION BITCH()
$name = $_POST['name'];
$day = $_POST['day'];
$year = $_POST['year'];
$month = $_POST['month'];
- Read upRead up
- Exclude checks
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 $WHERE is not named in camelCase. Open
function process_add(){//A.K.A. FUNCTION BITCH()
$name = $_POST['name'];
$day = $_POST['day'];
$year = $_POST['year'];
$month = $_POST['month'];
- Read upRead up
- Exclude checks
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 $e_id is not named in camelCase. Open
function process_add(){//A.K.A. FUNCTION BITCH()
$name = $_POST['name'];
$day = $_POST['day'];
$year = $_POST['year'];
$month = $_POST['month'];
- Read upRead up
- Exclude checks
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 $num_rows is not named in camelCase. Open
function display_create_form($active_semester){
echo
<<<END
<form method="post" action="$_SERVER[PHP_SELF]" id="create">
- Read upRead up
- Exclude checks
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 $WHERE is not named in camelCase. Open
function process_add(){//A.K.A. FUNCTION BITCH()
$name = $_POST['name'];
$day = $_POST['day'];
$year = $_POST['year'];
$month = $_POST['month'];
- Read upRead up
- Exclude checks
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 $num_rows is not named in camelCase. Open
function display_create_form($active_semester){
echo
<<<END
<form method="post" action="$_SERVER[PHP_SELF]" id="create">
- Read upRead up
- Exclude checks
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 $num_rows is not named in camelCase. Open
function process_add(){//A.K.A. FUNCTION BITCH()
$name = $_POST['name'];
$day = $_POST['day'];
$year = $_POST['year'];
$month = $_POST['month'];
- Read upRead up
- Exclude checks
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 $active_semester is not named in camelCase. Open
function display_create_form($active_semester){
echo
<<<END
<form method="post" action="$_SERVER[PHP_SELF]" id="create">
- Read upRead up
- Exclude checks
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 $WHERE_ALL is not named in camelCase. Open
function process_add(){//A.K.A. FUNCTION BITCH()
$name = $_POST['name'];
$day = $_POST['day'];
$year = $_POST['year'];
$month = $_POST['month'];
- Read upRead up
- Exclude checks
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 $WHERE_ALL is not named in camelCase. Open
function process_add(){//A.K.A. FUNCTION BITCH()
$name = $_POST['name'];
$day = $_POST['day'];
$year = $_POST['year'];
$month = $_POST['month'];
- Read upRead up
- Exclude checks
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 $num_rows is not named in camelCase. 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
- Read upRead up
- Exclude checks
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 $WHERE is not named in camelCase. Open
function process_add(){//A.K.A. FUNCTION BITCH()
$name = $_POST['name'];
$day = $_POST['day'];
$year = $_POST['year'];
$month = $_POST['month'];
- Read upRead up
- Exclude checks
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 $WHERE is not named in camelCase. Open
function process_add(){//A.K.A. FUNCTION BITCH()
$name = $_POST['name'];
$day = $_POST['day'];
$year = $_POST['year'];
$month = $_POST['month'];
- Read upRead up
- Exclude checks
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 $num_rows is not named in camelCase. 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
- Read upRead up
- Exclude checks
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 $e_id is not named in camelCase. Open
function process_add(){//A.K.A. FUNCTION BITCH()
$name = $_POST['name'];
$day = $_POST['day'];
$year = $_POST['year'];
$month = $_POST['month'];
- Read upRead up
- Exclude checks
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 $WHERE is not named in camelCase. Open
function process_add(){//A.K.A. FUNCTION BITCH()
$name = $_POST['name'];
$day = $_POST['day'];
$year = $_POST['year'];
$month = $_POST['month'];
- Read upRead up
- Exclude checks
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 $num_rows is not named in camelCase. Open
function display_log_form(){
$id = $_POST['event'];//WORKS
$sql = "SELECT events.name AS name, occurrence.date AS date, occurrence.id AS id
FROM events
- Read upRead up
- Exclude checks
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 $num_rows is not named in camelCase. Open
function display_log_form(){
$id = $_POST['event'];//WORKS
$sql = "SELECT events.name AS name, occurrence.date AS date, occurrence.id AS id
FROM events
- Read upRead up
- Exclude checks
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();
}
}