Showing 11,898 of 11,898 total issues
Function print_daily
has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring. Open
function print_daily($day) {
include('mysql_access.php');
$gen=$db->query("SELECT * FROM events_listing WHERE event_type='Regular' ORDER BY event_name");
- 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
Similar blocks of code found in 2 locations. Consider refactoring. Open
function add_permission($pageId, $execId) {
include('mysql_access.php');
$sql = "SELECT page FROM exec_permissions_pages WHERE entry_id=$pageId;";
$result = $db->query($sql);
$row = mysqli_fetch_array($result);
- 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 166.
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 remove_permission($pageId, $execId) {
include('mysql_access.php');
$sql = "SELECT page FROM exec_permissions_pages WHERE entry_id=$pageId;";
$result = $db->query($sql);
$row = mysqli_fetch_array($result);
- 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 166.
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
Method show_active
has 104 lines of code (exceeds 25 allowed). Consider refactoring. Open
function show_active() {
echo "<h1>Events you are leading:</h1>";
$user_id = $_SESSION['sessionID'];
include('mysql_access.php');
Function show_active
has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring. Open
function show_active() {
//dropdown list of events
?>
<h1> Attendance Check-In </h1>
<?php
- 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 show_public
has 100 lines of code (exceeds 25 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'>
File foundation.reveal.js
has 333 lines of code (exceeds 250 allowed). Consider refactoring. Open
;(function ($, window, document, undefined) {
'use strict';
Foundation.libs.reveal = {
name : 'reveal',
Method print_daily
has 98 lines of code (exceeds 25 allowed). Consider refactoring. Open
function print_daily($day) {
include('mysql_access.php');
$gen=$db->query("SELECT * FROM events_listing WHERE event_type='Regular' ORDER BY event_name");
Method list_stats
has 97 lines of code (exceeds 25 allowed). Consider refactoring. Open
function list_stats($hours_id, $semester) {
include ('mysql_access.php');
include('requirements.php');
// Total Hours
$sql = "SELECT SUM(hours) AS `sum_hours` FROM `recorded_hours` WHERE `user_id` = '$hours_id' AND `semester` = '$semester' LIMIT 1";
File updateinfo.php
has 324 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
require_once ('session.php');
require_once ('mysql_access.php');
?>
<!doctype html>
Method show_active
has 94 lines of code (exceeds 25 allowed). Consider refactoring. Open
function show_active() {
include('mysql_access.php');
$user_id = $_SESSION['sessionID'];
$aresponse=$db->query("SELECT status FROM contact_information WHERE id=$user_id");
$aresult=mysqli_fetch_array($aresponse);
Function display
has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring. Open
function display($event_type) {
include('mysql_access.php');
$user_id = $_SESSION['sessionID'];
$response=$db->query("SELECT MAX(event_id) FROM events_listing");
$result=mysqli_fetch_array($response);
- 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 processAttendance
has 92 lines of code (exceeds 25 allowed). Consider refactoring. Open
function processAttendance($d,$o){
include('mysql_access.php');
echo "<h1>Process Attendance</h1>";
echo "<form method=\"post\" action=\"$_SERVER[PHP_SELF]\">";
Method list_stats
has 91 lines of code (exceeds 25 allowed). Consider refactoring. Open
function list_stats($hours_id, $semester) {
include ('mysql_access.php');
global $total_query;
// Total Hours
$sql = "SELECT SUM(hours) AS `sum_hours` FROM `recorded_hours` WHERE `user_id` = '$hours_id' AND `semester` = '$semester' LIMIT 1";
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){
Function backup_tables
has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring. Open
function backup_tables($tables = '*')
{
include('mysql_access.php');
//get all of the tables
if($tables == '*')
- 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 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);
File event_signup.php
has 310 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
require_once ('session.php');
require_once ('mysql_access.php');
?>
<!doctype html>
Method attendance_check
has 86 lines of code (exceeds 25 allowed). Consider refactoring. Open
function attendance_check($user_id){
$sql = "SELECT occurrence.e_id AS e_id, occurrence.id AS id, occurrence.date AS date,
events.name AS name, events.worth AS worth, occurrence.type AS type,
recorded_attendance.attended AS attended
FROM occurrence
Function list_stats
has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring. Open
function list_stats($hours_id, $semester) {
include ('mysql_access.php');
include('requirements.php');
// Total Hours
$sql = "SELECT SUM(hours) AS `sum_hours` FROM `recorded_hours` WHERE `user_id` = '$hours_id' AND `semester` = '$semester' LIMIT 1";
- 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"