Showing 42 of 1,422 total issues

Function renderImage has 30 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function renderImage() {
    var img = $("#image_url");
    var img_url = img.attr("value");
    if (img_url !== '') {
      store_image_for_event(get_current_event_id(), img_url, function(data) {
Severity: Minor
Found in htdocs/assets/js/images.js - About 1 hr to fix

    Method perform has 29 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        static function perform($terms){
            
            $terms = Search::split_terms($terms);
            $terms_db = Search::db_escape_terms($terms);
            $terms_rx = Search::rx_escape_terms($terms);
    Severity: Minor
    Found in features/search/lib.php - About 1 hr to fix

      Function make_summary_editable has 28 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function make_summary_editable(text) {
          var $summary = $("#summary");
      
          if (typeof text !== "string") {
              text = '';
      Severity: Minor
      Found in features/summary/assets/js/summary.js - About 1 hr to fix

        Function update_gcal_for_event has 27 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        function update_gcal_for_event() {
          var url = "/events/" + get_current_event_id();
          var gcal = $("#gcal").val();
          // some basic client side validation
        
        
        Severity: Minor
        Found in htdocs/assets/js/api.js - About 1 hr to fix

          Function createEvent has 27 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          function createEvent()
          {
              var event = generateEvent();
          
              var is_confirmed = confirm("About to create an event and invite all postmortem email subscribers. Proceed?");
          Severity: Minor
          Found in features/calendar/assets/js/calendar.js - About 1 hr to fix

            Function addTicket has 26 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            function addTicket() {
                var jira_input = $("#jira_key_input");
                var jira_keys = (jira_input.attr("value"));
                if (jira_keys !== "") {
                    store_ticket_for_event(get_current_event_id(), jira_keys, function(data) {
            Severity: Minor
            Found in htdocs/assets/js/jira.js - About 1 hr to fix

              Method get has 26 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  function get($url, array $params = null, $user_pass = null, $proxy = null,
                               $timeout = 10) {
                      $query_string = empty($params)
                          ? ''
                          : '?' . http_build_query($params);
              Severity: Minor
              Found in phplib/CurlClient.php - About 1 hr to fix

                Function save_tags_for_event has a Cognitive Complexity of 9 (exceeds 5 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 55 mins 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 unpackTicketInfo has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function unpackTicketInfo($ticket_info, $fields) {
                        $ticket = array();
                        foreach($fields as $k => $v) {
                            # set a default value
                            $ticket[$k] = "";
                Severity: Minor
                Found in features/jira/lib.php - About 55 mins 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 store_array has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                Open

                    static function store_array($table_name, $assoc_column, $values, $postmortem_id, $conn) {
                        try {
                            foreach ($values as $value) {
                                $select_sql = 'SELECT postmortem_id, id, deleted ' .
                                              ' FROM ' . $table_name .
                Severity: Minor
                Found in phplib/Persistence.php - About 45 mins 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

                Method store_array has 5 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                    static function store_array($table_name, $assoc_column, $values, $postmortem_id, $conn) {
                Severity: Minor
                Found in phplib/Persistence.php - About 35 mins to fix

                  Method get has 5 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                      function get($url, array $params = null, $user_pass = null, $proxy = null,
                                   $timeout = 10) {
                  Severity: Minor
                  Found in phplib/CurlClient.php - About 35 mins to fix

                    Function confirm_delete has 5 arguments (exceeds 4 allowed). Consider refactoring.
                    Open

                    function confirm_delete(message, insert, context, onConfirm, onDisappear) {
                    Severity: Minor
                    Found in htdocs/assets/js/api.js - About 35 mins to fix

                      Function get_channel_data has 5 arguments (exceeds 4 allowed). Consider refactoring.
                      Open

                      function get_channel_data(url, params, channels, success_callback, error_callback) {
                      Severity: Minor
                      Found in htdocs/assets/js/irc.js - About 35 mins to fix

                        Function get_slack_channels_list has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                        Open

                            function get_slack_channels_list() {
                                if (function_exists("morgue_get_slack_channels_list")) {
                                    return morgue_get_slack_channels_list();
                                } else {
                                    $queryParam = array(
                        Severity: Minor
                        Found in features/slack/lib.php - About 35 mins 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_configuration has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                        Open

                            static function get_configuration($name = null) {
                                $enviroment = getenv('MORGUE_ENVIRONMENT') ?: 'development';
                                $configfile = dirname(__FILE__).'/../config/'.$enviroment.'.json';
                                $config = json_decode(file_get_contents($configfile), true);
                                if (is_null($name)) {
                        Severity: Minor
                        Found in phplib/Configuration.php - About 35 mins 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 delete_tag has a Cognitive Complexity of 7 (exceeds 5 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 35 mins 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 undelete_tag has a Cognitive Complexity of 7 (exceeds 5 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 35 mins 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 merge_jira_tickets has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                        Open

                            static function merge_jira_tickets($tickets, $curl = null) {
                                if (empty($tickets)) {
                                    return array();
                                }
                        
                        
                        Severity: Minor
                        Found in features/jira/lib.php - About 25 mins 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 save_slack_channels_for_event has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                        Open

                            static function save_slack_channels_for_event($event_id, $channel_id, $channel_name, $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 features/slack/lib.php - About 25 mins 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

                        Severity
                        Category
                        Status
                        Source
                        Language