Showing 11,898 of 11,898 total issues
Similar blocks of code found in 6 locations. Consider refactoring. Open
if($start > 12){
$startstr = substr($start, 0,2);
$startstr -= 12;
$start = $startstr.substr($start,2,-3)."pm";
}else{
- 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 95.
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 6 locations. Consider refactoring. Open
if($end > 12){
$endstr = substr($end, 0,2);
$endstr -= 12;
$end = $endstr.substr($end,2,-3)."pm";
}else{
- 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 95.
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 6 locations. Consider refactoring. Open
if($end > 12){
$endstr = substr($end, 0,2);
$endstr -= 12;
$end = $endstr.substr($end,2,-3)."pm";
}else{
- 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 95.
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
Consider simplifying this complex logical expression. Open
if ($sessionID == 426 || $sessionID == 443 || $sessionID == 739 || $sessionID == 668 || $sessionID == 851 || $sessionID == 1012 ) { //list users ids for webmaster committee here to allow access - current: 426-Justin 443-Kevin 739-Austin 668-Carnahan
if (isset($_POST['action'])){
process_form();
}
vars_form();
Consider simplifying this complex logical expression. Open
if ($firstname == NULL || $lastname == NULL || $username == NULL || $password == NULL || $email == NULL || $regpass == NULL )
{
echo '<div class="entry"><strong>All of the required fields were not filled out. Please try again.</strong></div>';
} else if ($regpass == $current_reg_pass) {
$insert = "INSERT INTO `contact_information` (firstname,
Classes should not have a constructor method with the same name as the class Open
function PasswordHash($iteration_count_log2, $portable_hashes)
{
$this->itoa64 = './0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz';
if ($iteration_count_log2 < 4 || $iteration_count_log2 > 31)
- Read upRead up
- Exclude checks
ConstructorWithNameAsEnclosingClass
Since: 0.2
A constructor method should not have the same name as the enclosing class, consider to use the PHP 5 __construct method.
Example
class MyClass {
// this is bad because it is PHP 4 style
public function MyClass() {}
// this is good because it is a PHP 5 constructor
public function __construct() {}
}
Source https://phpmd.org/rules/naming.html#constructorwithnameasenclosingclass
Function init
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
init : function (scope, libraries, method, options, response) {
Method submitModifyEvent
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
function submitModifyEvent($start,$end,$max,$length,$detail_id){
Function process_form
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
function process_form() {
include ('mysql_access.php');
$id = $_SESSION['sessionID'];
$event = $_POST['event'];
$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 show_active
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
function show_active() {
if (isset($_SESSION['sessionIDOriginal'])) {
$sessionID = $_SESSION['sessionIDOriginal'];
} else {
$sessionID = $_SESSION['sessionID'];
- 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 removeSubmoduleFiles
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
function removeSubmoduleFiles($submoduleArray) {
//Indicate here any special files we don't want deleted in any repo
$specialFiles = array(".gitignore", ".git");
foreach ($submoduleArray as $submoduleKey => $submoduleValue) {
- 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 show_active
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
function show_active() {
$id = $_SESSION['sessionID'];
include('retrieve_user.php');
$position = id_to_position($id);
- 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 show_public
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
function show_public() {
include('mysql_access.php');
//generate dot for viz.js
?>
<script type='text/vnd.graphviz' id='family_tree_script'>
- 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
Spaces must be used for alignment; tabs are not allowed Open
//dropdown list of events
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
include('retrieve_user.php');
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
$user_id = $_SESSION['sessionID'];
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
</table>
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
if(isset($_POST['instance']))
- Exclude checks
TRUE, FALSE and NULL must be lowercase; expected "true" but found "True" Open
$active_page = True;
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
if($instance == "none")
- Exclude checks