ampache/ampache

View on GitHub

Showing 1,980 of 25,735 total issues

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

    public static function get_recently_played($user_id, $count_type = 'stream', $object_type = null, $user_only = false): array
    {
        $personal_info_recent = 91;
        $personal_info_time   = 92;
        $personal_info_agent  = 93;
Severity: Minor
Found in src/Module/Statistics/Stats.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 connect has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    private static function connect()
    {
        if (!$url = AmpConfig::get('ldap_url')) {
            throw new LdapException('Required configuration value missing: ldap_url');
        }
Severity: Minor
Found in src/Module/Authentication/Ldap/Ldap.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 updateUi has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    protected function updateUi($prefix, $count, $song = null, $ignoreTicker = false): void
    {
        if (!defined('SSE_OUTPUT') && !defined('API')) {
            return;
        }
Severity: Minor
Found in src/Module/Beets/Catalog.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_object_count has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public static function get_object_count($object_type, $object_id, $threshold = null, $count_type = 'stream'): int
    {
        if ($threshold === null || $threshold === '') {
            $threshold = 0;
        }
Severity: Minor
Found in src/Module/Statistics/Stats.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 cleanup has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function cleanup(bool $dryRun = true): array
    {
        /* Get a list of filenames */
        $sql        = "SELECT `id`, `file` FROM `song` WHERE `enabled` = 0";
        $db_results = Dba::read($sql);
Severity: Minor
Found in src/Module/Song/SongFilesystemCleanup.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 licenses has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public static function licenses($licenses): string
    {
        if ((count($licenses) > self::$limit || self::$offset > 0) && self::$limit) {
            $licenses = array_splice($licenses, self::$offset, self::$limit);
        }
Severity: Minor
Found in src/Module/Api/Xml4_Data.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_object_total has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public static function get_object_total($object_type, $object_id, $threshold = null, $count_type = 'stream'): int
    {
        if ($threshold === null || $threshold === '') {
            $threshold = 0;
        }
Severity: Minor
Found in src/Module/Statistics/Stats.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 load has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function load(string $xml): Generator
    {
        $dom = new DOMDocument();
        @$dom->loadXML($xml);

Severity: Minor
Found in src/Module/Podcast/Exchange/PodcastOpmlLoader.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 auth has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function auth(string $username, string $password): array
    {
        $authenticator = AmpConfig::get('external_authenticator');
        if (!$authenticator) {
            return array(
Severity: Minor
Found in src/Module/Authentication/Authenticator/ExternalAuthenticator.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 run has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function run(ServerRequestInterface $request, GuiGatekeeperInterface $gatekeeper): ?ResponseInterface
    {
        if ($this->configContainer->isFeatureEnabled(ConfigurationKeyEnum::PODCAST) === false) {
            return null;
        }
Severity: Minor
Found in src/Module/Application/Podcast/ImportPodcastsAction.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 run has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function run(ServerRequestInterface $request, GuiGatekeeperInterface $gatekeeper): ?ResponseInterface
    {
        $configfile = __DIR__ . '/../../../../config/ampache.cfg.php';
        if (!file_exists($configfile)) {
            return $this->responseFactory
Severity: Minor
Found in src/Module/Application/Test/ShowAction.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 collectGarbage has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function collectGarbage(): void
    {
        $types = array(
            'album',
            'album_disk',
Severity: Minor
Found in src/Module/Art/ArtCleanup.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 run has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function run(ServerRequestInterface $request, GuiGatekeeperInterface $gatekeeper): ?ResponseInterface
    {
        $this->ui->showHeader();

        set_time_limit(600);
Severity: Minor
Found in src/Module/Application/Album/ShowMissingAction.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 run has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function run(ServerRequestInterface $request, GuiGatekeeperInterface $gatekeeper): ?ResponseInterface
    {
        if (!$this->configContainer->isFeatureEnabled(ConfigurationKeyEnum::SHARE)) {
            throw new AccessDeniedException('Access Denied: sharing features are not enabled.');
        }
Severity: Minor
Found in src/Module/Application/Share/ExternalShareAction.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 run has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function run(ServerRequestInterface $request, GuiGatekeeperInterface $gatekeeper): ?ResponseInterface
    {
        if ($gatekeeper->mayAccess(AccessLevelEnum::TYPE_INTERFACE, AccessLevelEnum::LEVEL_USER) === false) {
            throw new AccessDeniedException();
        }
Severity: Minor
Found in src/Module/Application/Search/SaveAsPlaylistAction.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 arrayToJSON has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    private function arrayToJSON($array): string
    {
        if (function_exists('json_encode') && is_string(json_encode($array))) {
            return json_encode($array) ?: '';
        }
Severity: Minor
Found in src/Module/Application/SearchData/ShowAction.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 run has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function run(
        ServerRequestInterface $request,
        array $action_list,
        string $default_action
    ): void {
Severity: Minor
Found in src/Module/Application/ApplicationRunner.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 run has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function run(ServerRequestInterface $request, GuiGatekeeperInterface $gatekeeper): ?ResponseInterface
    {
        if ($gatekeeper->mayAccess(AccessLevelEnum::TYPE_INTERFACE, AccessLevelEnum::LEVEL_USER) === false) {
            throw new AccessDeniedException();
        }
Severity: Minor
Found in src/Module/Application/SmartPlaylist/CreatePlaylistAction.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 install_rewrite_rules has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function install_rewrite_rules($file, $web_path, $download): bool
    {
        $final = $this->install_check_rewrite_rules($file, $web_path, true);
        if (!$download) {
            if (!file_put_contents($file, $final)) {
Severity: Minor
Found in src/Module/System/InstallationHelper.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_stream_types_for_type has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public static function get_stream_types_for_type(string $type, ?string $player = 'webplayer'): array
    {
        $types     = array();
        $transcode = AmpConfig::get('transcode_' . $type);
        if ($player !== '') {
Severity: Minor
Found in src/Module/Playback/Stream.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