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';
Severity: Minor
Found in htdocs/index.php - About 7 hrs to fix

    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"])) {
    Severity: Minor
    Found in phplib/Persistence.php - About 6 hrs to fix

    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');
    
    /**
    Severity: Minor
    Found in phplib/Postmortem.php - About 5 hrs to fix

      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});
      Severity: Minor
      Found in htdocs/assets/js/api.js - About 3 hrs to fix

        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"])) {
        Severity: Major
        Found in phplib/Persistence.php - About 3 hrs to fix

          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.
          Severity: Minor
          Found in views/content/edit.php - About 3 hrs to fix

            File Persistence.php has 312 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            <?php
            
            require_once "Configuration.php";
            
            /**
            Severity: Minor
            Found in phplib/Persistence.php - About 3 hrs to fix

              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();
                      }
              
              
              Severity: Minor
              Found in phplib/Persistence.php - About 2 hrs to fix

              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);
              
              
              Severity: Minor
              Found in features/slack/lib.php - About 2 hrs to fix

              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') {
              Severity: Major
              Found in htdocs/assets/js/forums.js - About 2 hrs to fix

                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();
                        }
                
                
                Severity: Major
                Found in phplib/Persistence.php - About 2 hrs to fix

                  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);
                  
                  
                  Severity: Minor
                  Found in features/slack/lib.php - About 1 hr to fix

                    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();
                    Severity: Minor
                    Found in phplib/Persistence.php - About 1 hr to fix

                      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.");
                      Severity: Minor
                      Found in phplib/Postmortem.php - About 1 hr to fix

                        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");
                        Severity: Minor
                        Found in htdocs/assets/js/api.js - About 1 hr to fix

                          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.");
                          Severity: Minor
                          Found in phplib/Postmortem.php - About 1 hr to fix

                            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.");
                            Severity: Minor
                            Found in phplib/Postmortem.php - About 1 hr to fix

                              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) {
                              Severity: Minor
                              Found in htdocs/assets/js/edit.js - About 1 hr to fix

                                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,
                                Severity: Minor
                                Found in phplib/Postmortem.php - About 1 hr to fix

                                  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(
                                  Severity: Minor
                                  Found in features/calendar/assets/js/calendar.js - About 1 hr to fix
                                    Severity
                                    Category
                                    Status
                                    Source
                                    Language