app/Console/Commands/DoctorCommand.php

Summary

Maintainability
C
1 day
Test Coverage

File DoctorCommand.php has 322 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

namespace App\Console\Commands;

use App\Enums\SongStorageType;
Severity: Minor
Found in app/Console/Commands/DoctorCommand.php - About 3 hrs to fix

    Function checkServiceIntegrations has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
    Open

        private function checkServiceIntegrations(): void
        {
            if (!LastfmService::enabled()) {
                $this->reportWarning('Last.fm integration', 'Not available');
            } else {
    Severity: Minor
    Found in app/Console/Commands/DoctorCommand.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

    DoctorCommand has 22 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class DoctorCommand extends Command
    {
        protected $signature = 'koel:doctor';
        protected $description = 'Check Koel setup';
    
    
    Severity: Minor
    Found in app/Console/Commands/DoctorCommand.php - About 2 hrs to fix

      Method checkServiceIntegrations has 52 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          private function checkServiceIntegrations(): void
          {
              if (!LastfmService::enabled()) {
                  $this->reportWarning('Last.fm integration', 'Not available');
              } else {
      Severity: Major
      Found in app/Console/Commands/DoctorCommand.php - About 2 hrs to fix

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

            public function handle(): int
            {
                if (PHP_OS_FAMILY === 'Windows' || PHP_OS_FAMILY === 'Unknown') {
                    $this->components->error('This command is only available on Linux systems.');
        
        
        Severity: Minor
        Found in app/Console/Commands/DoctorCommand.php - About 1 hr to fix

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

              private function reportErroneousResult(): void
              {
                  $this->components->error('There are errors in your Koel setup. Koel will not work properly.');
          
                  if (File::isWritable(base_path('storage/logs/laravel.log'))) {
          Severity: Minor
          Found in app/Console/Commands/DoctorCommand.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

          There are no issues that match your filters.

          Category
          Status