Showing 120 of 336 total issues

Function useDraggable has 42 lines of code (exceeds 25 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 1 hr to fix

    Method __construct has 13 arguments (exceeds 4 allowed). Consider refactoring.
    Open

            public ?string $title,
            public ?string $albumName,
            public ?string $artistName,
            public ?string $albumArtistName,
            public ?int $track,
    Severity: Major
    Found in app/Values/SongScanInformation.php - About 1 hr to fix

      Function useUpload has 40 lines of code (exceeds 25 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 1 hr to fix

        Function test has 40 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          protected test () {
            it('renders without a current song', () => expect(this.renderComponent()[0].html()).toMatchSnapshot())
        
            it('sets the active tab to the preference', async () => {
              preferenceStore.activeExtraPanelTab = 'YouTube'

          Function constructor has 39 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            constructor (container: HTMLElement, fov = 36) {
              this.container = container
              this.fov = fov
          
              this.camera = new THREE.PerspectiveCamera(
          Severity: Minor
          Found in resources/assets/js/visualizers/waveform/lib/SceneInit.ts - About 1 hr to fix

            Function test has 39 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              protected test () {
                it('initializes the store', async () => {
                  const songSyncMock = this.mock(songStore, 'syncWithVault')
                  const albumSyncMock = this.mock(albumStore, 'syncWithVault')
                  const artistSyncMock = this.mock(artistStore, 'syncWithVault')
            Severity: Minor
            Found in resources/assets/js/stores/overviewStore.spec.ts - About 1 hr to fix

              Function init has 39 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              export const init = (container: HTMLElement) => {
                const sceneInit = new SceneInit(container)
              
                const analyser = audioService.analyzer
                analyser.fftSize = 512
              Severity: Minor
              Found in resources/assets/js/visualizers/waveform/index.ts - About 1 hr to fix

                Function listenToMediaEvents has 37 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  private listenToMediaEvents (media: HTMLMediaElement) {
                    media.addEventListener('error', () => this.playNext(), true)
                
                    media.addEventListener('ended', () => {
                      if (commonStore.state.use_last_fm && userStore.current.preferences!.lastfm_session_key) {
                Severity: Minor
                Found in resources/assets/js/services/playbackService.ts - About 1 hr to fix

                  Method setUpDatabase has 37 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      private function setUpDatabase(): void
                      {
                          $config = [
                              'DB_HOST' => '',
                              'DB_PORT' => '',
                  Severity: Minor
                  Found in app/Console/Commands/InitCommand.php - About 1 hr to fix

                    Function startDragging has 37 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      const startDragging = (event: DragEvent, dragged: Draggable) => {
                        if (!event.dataTransfer) {
                          return
                        }
                    
                    
                    Severity: Minor
                    Found in resources/assets/js/composables/useDragAndDrop.ts - About 1 hr to fix

                      Function test has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                        protected test () {
                          it('fetches the recently played songs', async () => {
                            const songs = factory<Song>('song', 3)
                            const getMock = this.mock(http, 'get').mockResolvedValue(songs)
                            const syncMock = this.mock(songStore, 'syncWithVault', songs)
                      Severity: Minor
                      Found in resources/assets/js/stores/recentlyPlayedStore.spec.ts - About 1 hr to fix

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

                            private function maybeSetUpDatabase(): void
                            {
                                $attempt = 0;
                        
                                while (true) {
                        Severity: Minor
                        Found in app/Console/Commands/InitCommand.php - About 1 hr 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

                        Method fromRule has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            public static function fromRule(Rule $rule): self
                            {
                                $operator = $rule->operator;
                                $value = $rule->value;
                        
                        
                        Severity: Minor
                        Found in app/Values/SmartPlaylistSqlElements.php - About 1 hr to fix

                          Function test has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                            protected test () {
                              it('creates playlist with no songs', async () => {
                                const folder = factory<PlaylistFolder>('playlist-folder')
                                const storeMock = this.mock(playlistStore, 'store').mockResolvedValue(factory<Playlist>('playlist'))
                          
                          
                          Severity: Minor
                          Found in resources/assets/js/components/playlist/CreatePlaylistForm.spec.ts - About 1 hr to fix

                            Method fromGetId3Info has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                public static function fromGetId3Info(array $info, string $path): self
                                {
                                    // We prefer ID3v2 tags over ID3v1 tags.
                                    $tags = array_merge(
                                        Arr::get($info, 'tags.id3v1', []),
                            Severity: Minor
                            Found in app/Values/SongScanInformation.php - About 1 hr to fix

                              Function test has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                protected test () {
                                  it.each([[0], [1]])('shuffles all if %s songs are selected', async (selectedCount: number) => {
                                    const { emitted } = this.renderComponent(selectedCount)
                              
                                    await this.user.click(screen.getByTitle('Shuffle all songs'))
                              Severity: Minor
                              Found in resources/assets/js/components/song/SongListControls.spec.ts - About 1 hr to fix

                                Function setup has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                  const setup = () => {
                                    const referenceElement = extractRef(reference)
                                    const floatingElement = extractRef(floating)
                                
                                    floatingElement.style.display = 'none'
                                Severity: Minor
                                Found in resources/assets/js/composables/useFloatingUi.ts - About 1 hr to fix

                                  Function test has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                    protected test () {
                                      it.each<[MediaInfoDisplayMode]>([['aside'], ['full']])('renders in %s mode', async (mode) => {
                                        await this.renderComponent(mode)
                                  
                                        screen.getByTestId('album-info-tracks')
                                  Severity: Minor
                                  Found in resources/assets/js/components/album/AlbumInfo.spec.ts - About 1 hr to fix

                                    Function test has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                                    Open

                                      protected test () {
                                        it('performs an excerpt search', async () => {
                                          const result: ExcerptSearchResult = {
                                            songs: factory<Song>('song', 3),
                                            albums: factory<Album>('album', 3),
                                    Severity: Minor
                                    Found in resources/assets/js/stores/searchStore.spec.ts - About 1 hr to fix

                                      Function test has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                                      Open

                                        protected test () {
                                          it.each<[string, keyof Events, User | Song[] | Playlist | PlaylistFolder | undefined]>([
                                            ['add-user-form', 'MODAL_SHOW_ADD_USER_FORM', undefined],
                                            ['invite-user-form', 'MODAL_SHOW_INVITE_USER_FORM', undefined],
                                            ['edit-user-form', 'MODAL_SHOW_EDIT_USER_FORM', factory<User>('user')],
                                      Severity: Minor
                                      Found in resources/assets/js/components/layout/ModalWrapper.spec.ts - About 1 hr to fix
                                        Severity
                                        Category
                                        Status
                                        Source
                                        Language