Showing 120 of 336 total issues

Method __invoke has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

        UploadService $uploadService,
        AlbumRepository $albumRepository,
        SongRepository $songRepository,
        UploadRequest $request,
        Authenticatable $user
Severity: Minor
Found in app/Http/Controllers/API/UploadController.php - About 35 mins to fix

    Method writeAlbumCover has 5 arguments (exceeds 4 allowed). Consider refactoring.
    Open

            Album $album,
            string $source,
            string $extension = 'png',
            ?string $destination = '',
            bool $cleanUp = true
    Severity: Minor
    Found in app/Services/MediaMetadataService.php - About 35 mins to fix

      Method createPlaylist has 5 arguments (exceeds 4 allowed). Consider refactoring.
      Open

              string $name,
              User $user,
              ?Folder $folder = null,
              array $songs = [],
              ?SmartPlaylistRuleGroupCollection $ruleGroups = null
      Severity: Minor
      Found in app/Services/PlaylistService.php - About 35 mins to fix

        Method handle has 5 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            public function handle($request, Closure $next, $maxAttempts = 600, $decayMinutes = 1, $prefix = ''): Response
        Severity: Minor
        Found in app/Http/Middleware/ThrottleRequests.php - About 35 mins to fix

          Method getByGenre has 5 arguments (exceeds 4 allowed). Consider refactoring.
          Open

                  string $genre,
                  string $sortColumn,
                  string $sortDirection,
                  ?User $scopedUser = null,
                  int $perPage = 50
          Severity: Minor
          Found in app/Repositories/SongRepository.php - About 35 mins to fix

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

                private function maybeSetMediaPath(): void
                {
                    if (Setting::get('media_path')) {
                        return;
                    }
            Severity: Minor
            Found in app/Console/Commands/InitCommand.php - About 35 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 buildUrl has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

                public function buildUrl(string $uri, bool $appendKey = true): string
                {
                    if (!starts_with($uri, ['http://', 'https://'])) {
                        if ($uri[0] !== '/') {
                            $uri = "/$uri";
            Severity: Minor
            Found in app/Services/ApiClients/ApiClient.php - About 35 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 tryMatchRoute has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

              private tryMatchRoute () {
                if (!this.cache.has(location.hash)) {
                  for (let i = 0; i < this.routes.length; i++) {
                    const route = this.routes[i]
                    const matches = location.hash.match(new RegExp(`^#!?${route.path}/?(?:\\?(.*))?$`))
            Severity: Minor
            Found in resources/assets/js/router.ts - About 35 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 useInfiniteScroll has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

            export const useInfiniteScroll = (loadMore: Closure) => {
              const scroller = ref<HTMLElement>()
            
              const scrolling = (event: UIEvent) => {
                const target = event.target as HTMLElement
            Severity: Minor
            Found in resources/assets/js/composables/useInfiniteScroll.ts - About 35 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 useDraggable has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

            export const useDraggable = (type: DraggableType) => {
              const startDragging = (event: DragEvent, dragged: Draggable) => {
                if (!event.dataTransfer) {
                  return
                }
            Severity: Minor
            Found in resources/assets/js/composables/useDragAndDrop.ts - About 35 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 getAllFileEntries has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

            async function getAllFileEntries (dataTransferItemList: DataTransferItemList) {
              const fileEntries: FileSystemEntry[] = []
              const queue: FileSystemEntry[] = []
            
              for (let i = 0, length = dataTransferItemList.length; i < length; i++) {
            Severity: Minor
            Found in resources/assets/js/utils/directoryReader.ts - About 35 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 useUpload has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

            export const useUpload = () => {
              const { isAdmin } = useAuthorization()
              const { toastSuccess, toastWarning } = useMessageToaster()
              const { go, isCurrentScreen } = useRouter()
            
            
            Severity: Minor
            Found in resources/assets/js/composables/useUpload.ts - About 35 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

            Avoid too many return statements within this function.
            Open

                  return <Song[]>[]
            Severity: Major
            Found in resources/assets/js/composables/useDragAndDrop.ts - About 30 mins to fix

              Avoid too many return statements within this function.
              Open

                  return this.activateRoute(route, params)
              Severity: Major
              Found in resources/assets/js/router.ts - About 30 mins to fix

                Avoid too many return statements within this method.
                Open

                                return $this->fromPlaylist($downloadable);
                Severity: Major
                Found in app/Services/DownloadService.php - About 30 mins to fix

                  Avoid too many return statements within this function.
                  Open

                            return folder ? await songStore.fetchForPlaylistFolder(folder) : <Song[]>[]
                  Severity: Major
                  Found in resources/assets/js/composables/useDragAndDrop.ts - About 30 mins to fix

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

                        public function sync(array $ignores = [], bool $force = false): SyncResultCollection
                        {
                            /** @var string $mediaPath */
                            $mediaPath = $this->settingRepository->getByKey('media_path');
                    
                    
                    Severity: Minor
                    Found in app/Services/MediaSyncService.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 updateFloatingUi has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                    Open

                    export const updateFloatingUi = async (
                      reference: HTMLElement,
                      floating: HTMLElement,
                      options: Partial<ComputePositionConfig>,
                      arrow?: HTMLElement
                    Severity: Minor
                    Found in resources/assets/js/utils/floatingUi.ts - 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 sync has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                    Open

                        public function sync(array $ignores = [], bool $force = false): SyncResult
                        {
                            if (!$this->isFileNewOrChanged() && !$force) {
                                return SyncResult::skipped($this->filePath);
                            }
                    Severity: Minor
                    Found in app/Services/FileSynchronizer.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 getMediaPath has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                    Open

                        private function getMediaPath(): string
                        {
                            $path = Setting::get('media_path');
                    
                            if ($path) {
                    Severity: Minor
                    Found in app/Console/Commands/SyncCommand.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