ampache/ampache

View on GitHub

Showing 1,990 of 25,678 total issues

Avoid too many return statements within this method.
Open

    return true;
Severity: Major
Found in src/Config/functions.php - About 30 mins to fix

    Avoid too many return statements within this method.
    Open

                        return;
    Severity: Major
    Found in src/Application/Api/Ajax/Handler/LocalPlayAjaxHandler.php - About 30 mins to fix

      Avoid too many return statements within this method.
      Open

              return false;
      Severity: Major
      Found in src/Config/functions.php - About 30 mins to fix

        Avoid too many return statements within this method.
        Open

                            return;
        Severity: Major
        Found in src/Application/Api/Ajax/Handler/TagAjaxHandler.php - About 30 mins to fix

          Avoid too many return statements within this method.
          Open

                              return;
          Severity: Major
          Found in src/Application/Api/Ajax/Handler/LocalPlayAjaxHandler.php - About 30 mins to fix

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

            THREE.BloomPass = function ( strength, kernelSize, sigma, resolution ) {
            
                strength = ( typeof strength !== "undefined" ) ? strength : 1;
                kernelSize = ( typeof kernelSize !== "undefined" ) ? kernelSize : 25;
                sigma = ( typeof sigma !== "undefined" ) ? sigma : 4.0;
            Severity: Minor
            Found in public/lib/modules/UberViz/BloomPass.js - 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 UberVizMain has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

            var UberVizMain = (function() {
            
                var stats;
                var windowHalfX;
                var windowHalfY;
            Severity: Minor
            Found in public/lib/modules/UberViz/Main.js - 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 displayNotification has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

            function displayNotification(message, timeout) {
                if (notificationTimeout !== null || !message) {
                    clearNotification();
                }
            
            
            Severity: Minor
            Found in public/lib/javascript/base.js - 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 15 has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

            },{}],15:[function(require,module,exports){
            /**
             * Makes a multidimensional array
             */
            exports.makeArray = function(lengths, Type) {
            Severity: Minor
            Found in public/lib/modules/aurora.js/mp3.js - 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 easeInOutElastic has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

                easeInOutElastic(x, t, b, c, d) {
                    var s=1.70158;var p=0;var a=c;
                    if (t===0) {return b;}  if ((t/=d/2)===2) {return b+c;}  if (!p) {p=d*(.3*1.5);}
                    if (a < Math.abs(c)) { a=c; var s=p/4; }
                    else { var s = p/(2*Math.PI) * Math.asin (c/a); }
            Severity: Minor
            Found in public/lib/modules/rhinoslider/js/easing.js - 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_artist_info has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

                public static function get_artist_info($artist_id): array
                {
                    $artist = new Artist($artist_id);
                    $query  = ($artist->mbid)
                        ? 'mbid=' . rawurlencode($artist->mbid)
            Severity: Minor
            Found in src/Module/Util/Recommendation.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 find_template has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

                public static function find_template($template, bool $extern = false): string
                {
                    $path      = AmpConfig::get('theme_path') . '/templates/' . $template;
                    $realpath  = __DIR__ . '/../../../public/' . $path;
                    $extension = strtolower(pathinfo($path, PATHINFO_EXTENSION));
            Severity: Minor
            Found in src/Module/Util/Ui.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 show_footer has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

                public static function show_footer(): void
                {
                    if (!defined("TABLE_RENDERED")) {
                        show_table_render();
                    }
            Severity: Minor
            Found in src/Module/Util/Ui.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 prepare_metadata_for_writing has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

                public function prepare_metadata_for_writing($frames): array
                {
                    $ndata = array();
                    foreach ($frames as $key => $text) {
                        switch ($key) {
            Severity: Minor
            Found in src/Module/Util/VaInfo.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 setupCurl has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

                private function setupCurl(): Curl
                {
                    $proxyHost = $this->config->get(ConfigurationKeyEnum::PROXY_HOST);
                    $proxyPort = $this->config->get(ConfigurationKeyEnum::PROXY_PORT);
                    $proxyUser = $this->config->get(ConfigurationKeyEnum::PROXY_USER);
            Severity: Minor
            Found in src/Module/Util/WebFetcher/WebFetcher.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_user_sql_where has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

                protected function get_user_sql_where(
                    $user_id = 0,
                    $object_type = null,
                    $object_id = 0,
                    $start_date = null,
            Severity: Minor
            Found in src/Module/Util/Graph.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 clean_file has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

                public function clean_file($file, $media_type = 'song'): bool
                {
                    $file_info = Core::get_filesize(Core::conv_lc_file($file));
                    if ($file_info < 1) {
                        $object_id = Catalog::get_id_from_file($file, $media_type);
            Severity: Minor
            Found in src/Module/Catalog/Catalog_local.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_users has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

                public static function get_users($filter): array
                {
                    switch ($filter) {
                        case 'users':
                            $sql = "SELECT * FROM `user` WHERE `access`='25' AND `email` IS NOT NULL";
            Severity: Minor
            Found in src/Module/Util/Mailer.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 cdata has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

                public function cdata($parser, $cdata)
                {
                    $tag    = $this->_currentTag;
                    $subtag = $this->_subTag;
                    $source = $this->_sourceTag;
            Severity: Minor
            Found in src/Module/Util/AmazonSearch.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 getDisabledMetadataFields has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

                public function getDisabledMetadataFields(): array
                {
                    if ($this->disabledMetadataFields === null) {
                        $disabledFieldNames = [];
            
            
            Severity: Minor
            Found in src/Module/Metadata/MetadataManager.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