Showing 42 of 1,422 total issues
File index.php
has 466 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
require_once 'phplib/CurlClient.php';
require_once 'phplib/Postmortem.php';
require_once 'phplib/Configuration.php';
Function save_event
has a Cognitive Complexity of 40 (exceeds 5 allowed). Consider refactoring. Open
static function save_event($postmortem, $conn = null) {
$values = array("title");
try {
if (isset($postmortem["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
File Postmortem.php
has 394 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
require_once('Persistence.php');
/**
File api.js
has 326 lines of code (exceeds 250 allowed). Consider refactoring. Open
/**
* simple helper function to add HTTP DELETE ajax calls to the jQuery object
*/
$.ajax_delete = function(url, callback) {
$.ajax({url: url, type: "DELETE", success: callback});
Method save_event
has 92 lines of code (exceeds 25 allowed). Consider refactoring. Open
static function save_event($postmortem, $conn = null) {
$values = array("title");
try {
if (isset($postmortem["id"])) {
File edit.php
has 313 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php if ($event['deleted']): ?>
<div class="row-fluid">
<div class="alert">
<strong>Heads up!</strong> This postmortem was deleted.
File Persistence.php
has 312 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
require_once "Configuration.php";
/**
Function get_array
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
static function get_array($columns, $where = array(), $table_name, $conn = null) {
if (!$where) {
$where = array();
}
- 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 get_channel_messages_for_datetime_range
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
function get_channel_messages_for_datetime_range($starttime, $endtime, $channel_id) {
$startTimeInUtcFormat = DateTimeUtil::convertDateTimeToUtcTimezoneTimestamp($starttime);
$endTimeInUtcFormat = DateTimeUtil::convertDateTimeToUtcTimezoneTimestamp($endtime);
- 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 showForumLink
has 54 lines of code (exceeds 25 allowed). Consider refactoring. Open
function showForumLink() {
var url = $("#forum_url");
var comment = $("#forum_comment");
var error = $("#forum_error");
if (typeof error !== 'undefined') {
Method get_array
has 52 lines of code (exceeds 25 allowed). Consider refactoring. Open
static function get_array($columns, $where = array(), $table_name, $conn = null) {
if (!$where) {
$where = array();
}
Method get_channel_messages_for_datetime_range
has 49 lines of code (exceeds 25 allowed). Consider refactoring. Open
function get_channel_messages_for_datetime_range($starttime, $endtime, $channel_id) {
$startTimeInUtcFormat = DateTimeUtil::convertDateTimeToUtcTimezoneTimestamp($starttime);
$endTimeInUtcFormat = DateTimeUtil::convertDateTimeToUtcTimezoneTimestamp($endtime);
Method range_query
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
static function range_query($columns, $table_name, $where = array(), $conn = null) {
$get_sql = 'SELECT ' . implode(',', $columns) . ' FROM ' . $table_name;
$placeholders = array();
$placeholder_values = array();
Method save_tags_for_event
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
static function save_tags_for_event($event_id, $tags, $conn = null) {
$conn = $conn ?: Persistence::get_database_object();
if (is_null($conn)) {
return array("status" => self::ERROR,
"error" => "Couldn't get connection object.");
Function confirm_delete
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
function confirm_delete(message, insert, context, onConfirm, onDisappear) {
var alert = $("<div></div>");
alert.addClass("alert");
alert.addClass("alert-warning");
Method delete_tag
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
static function delete_tag($tag_id, $event_id = null, $conn = null) {
$conn = $conn ?: Persistence::get_database_object();
if (is_null($conn)) {
return array("status" => self::ERROR,
"error" => "Couldn't get connection object.");
Method undelete_tag
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
static function undelete_tag($tag_id, $event_id = null, $conn = null) {
$conn = $conn ?: Persistence::get_database_object();
if (is_null($conn)) {
return array("status" => self::ERROR,
"error" => "Couldn't get connection object.");
Function make_editable
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
function make_editable() {
$.getJSON("/events/"+ get_current_event_id() +"/lock", function(data) {
var edit_div = $("<div></div>");
if(data.status === EDIT_UNLOCKED) {
Method add_history
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
static function add_history($event, $admin, $action, $conn = null) {
// validate action
if (!in_array($action, array(self::ACTION_ADD, self::ACTION_EDIT))) {
return array(
"status" => self::ERROR,
Function showFacilitator
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
function showFacilitator()
{
if(cal.facilitatorFeature) {
$('#facilitator-link').on('click', function() {
$.get('/calendar/facilitators/request/' + get_current_event_id()).fail(