ampache/ampache

View on GitHub

Showing 1,929 of 25,614 total issues

Function handle has a Cognitive Complexity of 116 (exceeds 5 allowed). Consider refactoring.
Open

    public function handle(): void
    {
        $results = array();
        $action  = $this->requestParser->getFromRequest('action');
        $user    = Core::get_global('user');
Severity: Minor
Found in src/Application/Api/Ajax/Handler/IndexAjaxHandler.php - About 2 days 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 Subsonic_Xml_Data.php has 1176 lines of code (exceeds 500 allowed). Consider refactoring.
Open

<?php

declare(strict_types=0);

/**
Severity: Major
Found in src/Module/Api/Subsonic_Xml_Data.php - About 2 days to fix

    Function createPreferenceInput has a Cognitive Complexity of 112 (exceeds 5 allowed). Consider refactoring.
    Open

        public function createPreferenceInput(
            string $name,
            $value
        ): void {
            if (!Preference::has_access($name)) {
    Severity: Minor
    Found in src/Module/Util/Ui.php - About 2 days 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 Xml_Data.php has 1138 lines of code (exceeds 500 allowed). Consider refactoring.
    Open

    <?php
    
    declare(strict_types=0);
    
    /**
    Severity: Major
    Found in src/Module/Api/Xml_Data.php - About 2 days to fix

      Method getSql has 588 lines of code (exceeds 200 allowed). Consider refactoring.
      Open

          public function getSql(
              Search $search
          ): array {
              $search_user_id     = $search->search_user->id ?? -1;
              $sql_logic_operator = $search->logic_operator;
      Severity: Major
      Found in src/Module/Playlist/Search/SongSearch.php - About 2 days to fix

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

        },{}],7:[function(require,module,exports){
        (function (global){
        var AV = (typeof window !== "undefined" ? window['AV'] : typeof global !== "undefined" ? global['AV'] : null);
        
        const ENCODINGS = ['latin1', 'utf16-bom', 'utf16-be', 'utf8'];
        Severity: Minor
        Found in public/lib/modules/aurora.js/mp3.js - About 2 days 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

        Song has 104 functions (exceeds 20 allowed). Consider refactoring.
        Open

        class Song extends database_object implements
            Media,
            library_item,
            GarbageCollectibleInterface,
            CatalogItemInterface,
        Severity: Major
        Found in src/Repository/Model/Song.php - About 2 days to fix

          Function run has a Cognitive Complexity of 97 (exceeds 5 allowed). Consider refactoring.
          Open

              public function run(ServerRequestInterface $request, GuiGatekeeperInterface $gatekeeper): ?ResponseInterface
              {
                  // Avoid form login if still connected
                  if ($this->configContainer->get('use_auth') && !isset($_GET['force_display'])) {
                      $auth = false;
          Severity: Minor
          Found in src/Module/Application/Login/DefaultAction.php - About 1 day 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

          Subsonic_Api has 101 functions (exceeds 20 allowed). Consider refactoring.
          Open

          class Subsonic_Api
          {
              // List of internal functions that should be skipped when called from SubsonicApiApplication
              public const SYSTEM_LIST = [
                  '_albumList',
          Severity: Major
          Found in src/Module/Api/Subsonic_Api.php - About 1 day to fix

            Function 18 has 549 lines of code (exceeds 200 allowed). Consider refactoring.
            Open

            },{"../demuxer":14,"./m4a":18}],18:[function(require,module,exports){
            // Generated by CoffeeScript 1.12.7
            (function() {
              var Demuxer, M4ADemuxer,
                extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
            Severity: Major
            Found in public/lib/modules/aurora.js/aurora.js - About 1 day to fix

              Function 12 has a Cognitive Complexity of 91 (exceeds 5 allowed). Consider refactoring.
              Open

              },{}],12:[function(require,module,exports){
              /*
               * AAC.js - Advanced Audio Coding decoder in JavaScript
               * Created by Devon Govett
               * Copyright (c) 2012, Official.fm Labs
              Severity: Minor
              Found in public/lib/modules/aurora.js/aac.js - About 1 day 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 Preference.php has 1014 lines of code (exceeds 500 allowed). Consider refactoring.
              Open

              <?php
              
              declare(strict_types=0);
              
              /**
              Severity: Major
              Found in src/Repository/Model/Preference.php - About 1 day to fix

                Function 7 has 533 lines of code (exceeds 200 allowed). Consider refactoring.
                Open

                },{}],7:[function(require,module,exports){
                (function (global){
                var AV = (typeof window !== "undefined" ? window['AV'] : typeof global !== "undefined" ? global['AV'] : null);
                
                const ENCODINGS = ['latin1', 'utf16-bom', 'utf16-be', 'utf8'];
                Severity: Major
                Found in public/lib/modules/aurora.js/mp3.js - About 1 day to fix

                  Function 2 has a Cognitive Complexity of 88 (exceeds 5 allowed). Consider refactoring.
                  Open

                  },{"./tables":11}],2:[function(require,module,exports){
                  /*
                   * AAC.js - Advanced Audio Coding decoder in JavaScript
                   * Created by Devon Govett
                   * Copyright (c) 2012, Official.fm Labs
                  Severity: Minor
                  Found in public/lib/modules/aurora.js/aac.js - About 1 day 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 rhinoSlider has 519 lines of code (exceeds 200 allowed). Consider refactoring.
                  Open

                      var rhinoSlider = function (element, opts) {
                          var
                              settings = $.extend({}, $.fn.rhinoslider.defaults, opts),
                              $slider = $(element),
                              effects = $.fn.rhinoslider.effects,
                  Severity: Major
                  Found in public/lib/modules/rhinoslider/js/rhinoslider-1.05.js - About 1 day to fix

                    Subsonic_Xml_Data has 88 functions (exceeds 20 allowed). Consider refactoring.
                    Open

                    class Subsonic_Xml_Data
                    {
                        public const API_VERSION = "1.16.1";
                    
                        public const SSERROR_GENERIC               = 0;
                    Severity: Major
                    Found in src/Module/Api/Subsonic_Xml_Data.php - About 1 day to fix

                      Method createPreferenceInput has 505 lines of code (exceeds 200 allowed). Consider refactoring.
                      Open

                          public function createPreferenceInput(
                              string $name,
                              $value
                          ): void {
                              if (!Preference::has_access($name)) {
                      Severity: Major
                      Found in src/Module/Util/Ui.php - About 1 day to fix

                        Function 3 has a Cognitive Complexity of 82 (exceeds 5 allowed). Consider refactoring.
                        Open

                        },{}],3:[function(require,module,exports){
                        /*
                         * FLAC.js - Free Lossless Audio Codec decoder in JavaScript
                         * By Devon Govett and Jens Nockert of Official.fm Labs
                         *
                        Severity: Minor
                        Found in public/lib/modules/aurora.js/flac.js - About 1 day 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 Ui.php has 961 lines of code (exceeds 500 allowed). Consider refactoring.
                        Open

                        <?php
                        
                        declare(strict_types=0);
                        
                        /**
                        Severity: Major
                        Found in src/Module/Util/Ui.php - About 1 day to fix

                          File Art.php has 960 lines of code (exceeds 500 allowed). Consider refactoring.
                          Open

                          <?php
                          
                          declare(strict_types=0);
                          
                          /**
                          Severity: Major
                          Found in src/Repository/Model/Art.php - About 1 day to fix
                            Severity
                            Category
                            Status
                            Source
                            Language