MikeNGarrett/Play-Later

View on GitHub

Showing 19 of 129 total issues

File all.php has 384 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php
// This is /music-bin/
if( !defined('CHECK') )
    header( 'Location: '.APPURL.'music-bin/' );

Severity: Minor
Found in all.php - About 5 hrs to fix

    File home.php has 335 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    <?php
    if( !defined('CHECK') )
        header( 'Location: '.APPURL );
    
    error_reporting(E_ALL);
    Severity: Minor
    Found in home.php - About 4 hrs to fix

      Function is_serialized has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
      Open

      function is_serialized( $data, $strict = true ) {
          // if it isn't a string, it isn't serialized.
          if ( ! is_string( $data ) ) {
              return false;
          }
      Severity: Minor
      Found in config.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

      Method create_database has 51 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          private function create_database() {
              try
              {
                  $this->exec('
                      CREATE TABLE IF NOT EXISTS albums (
      Severity: Major
      Found in config.php - About 2 hrs to fix

        Method is_serialized has 48 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        function is_serialized( $data, $strict = true ) {
            // if it isn't a string, it isn't serialized.
            if ( ! is_string( $data ) ) {
                return false;
            }
        Severity: Minor
        Found in config.php - About 1 hr to fix

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

                  play_later: function () {
                      var working = false;
                      $('.play-later').click(function(event) {
                          event.preventDefault();
                          if( working ) {
          Severity: Minor
          Found in js/site.js - About 1 hr to fix

            Avoid deeply nested control flow statements.
            Open

                            if( !is_array( $last_tags ) ) {
                                $last_tags = array();
                            }
            Severity: Major
            Found in cron/last-fm-update.php - About 45 mins to fix

              Avoid deeply nested control flow statements.
              Open

                              if( !is_array( $genres ) ) {
                                  $genres = array();
                              }
              Severity: Major
              Found in cron/last-fm-update.php - About 45 mins to fix

                Avoid too many return statements within this method.
                Open

                            return false;
                Severity: Major
                Found in config.php - About 30 mins to fix

                  Avoid too many return statements within this method.
                  Open

                              return (bool) preg_match( "/^{$token}:[0-9.E-]+;$end/", $data );
                  Severity: Major
                  Found in config.php - About 30 mins to fix

                    Avoid too many return statements within this method.
                    Open

                                return (bool) preg_match( "/^{$token}:[0-9]+:/s", $data );
                    Severity: Major
                    Found in config.php - About 30 mins to fix

                      Avoid too many return statements within this method.
                      Open

                                  return false;
                      Severity: Major
                      Found in config.php - About 30 mins to fix

                        Avoid too many return statements within this method.
                        Open

                                            return false;
                        Severity: Major
                        Found in config.php - About 30 mins to fix

                          Avoid too many return statements within this method.
                          Open

                                          return false;
                          Severity: Major
                          Found in config.php - About 30 mins to fix

                            Avoid too many return statements within this method.
                            Open

                                return false;
                            Severity: Major
                            Found in config.php - About 30 mins to fix

                              Avoid too many return statements within this method.
                              Open

                                          return false;
                              Severity: Major
                              Found in config.php - About 30 mins to fix

                                Avoid too many return statements within this method.
                                Open

                                            return false;
                                Severity: Major
                                Found in config.php - About 30 mins to fix

                                  Function get_playlist has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                  Open

                                  function get_playlist( $me, $api, $offset = 0 ) {
                                      $new_all_user_playlists = array();
                                      $all_user_playlists_playlists = $api->getUserPlaylists( $me->id, array( 'offset' => $offset ) );
                                      $total = $all_user_playlists_playlists->total;
                                      $total_pages = $total / 20;
                                  Severity: Minor
                                  Found in all.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 get_playlist has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                  Open

                                  function get_playlist( $me, $api, $offset = 0 ) {
                                      $new_all_user_playlists = array();
                                      $all_user_playlists_playlists = $api->getUserPlaylists( $me->id, array( 'offset' => $offset ) );
                                      $total = $all_user_playlists_playlists->total;
                                      $total_pages = $total / 20;
                                  Severity: Minor
                                  Found in home.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