Showing 120 of 336 total issues

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

  protected test () {
    it('only initializes once', () => {
      const spy = vi.spyOn(plyr, 'setup')

      playbackService.init(document.querySelector('.plyr')!)
Severity: Major
Found in resources/assets/js/services/playbackService.spec.ts - About 1 day to fix

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

      protected test () {
        it('gets a song by ID', () => {
          const song = reactive(factory<Song>('song', { id: 'foo' }))
          songStore.vault.set('foo', reactive(song))
          songStore.vault.set('bar', reactive(factory<Song>('song', { id: 'bar' })))
    Severity: Major
    Found in resources/assets/js/stores/songStore.spec.ts - About 1 day to fix

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

        protected test () {
          it('queues and plays', async () => {
            const queueMock = this.mock(queueStore, 'queueIfNotQueued')
            const playMock = this.mock(playbackService, 'play')
            const song = factory<Song>('song', { playback_state: 'Stopped' })
      Severity: Major
      Found in resources/assets/js/components/song/SongContextMenu.spec.ts - About 7 hrs to fix

        Function useDroppable has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
        Open

        export const useDroppable = (acceptedTypes: DraggableType[]) => {
          const acceptsDrop = (event: DragEvent) => {
            const type = getDragType(event)
            return Boolean(type && acceptedTypes.includes(type))
          }
        Severity: Minor
        Found in resources/assets/js/composables/useDragAndDrop.ts - About 3 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

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

          protected test () {
            it('initializes with current user', () => {
              expect(userStore.current).toEqual(currentUser)
              expect(userStore.vault.size).toBe(1)
            })
        Severity: Major
        Found in resources/assets/js/stores/userStore.spec.ts - About 3 hrs to fix

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

          export const init = (container: HTMLElement) => {
            const uniforms = {
              u_time: {
                type: 'f',
                value: 2.0
          Severity: Major
          Found in resources/assets/js/visualizers/plane-mesh/index.ts - About 3 hrs to fix

            File playbackService.spec.ts has 314 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            import { nextTick, reactive } from 'vue'
            import plyr from 'plyr'
            import lodash from 'lodash'
            import { expect, it, vi } from 'vitest'
            import { noop } from '@/utils'
            Severity: Minor
            Found in resources/assets/js/services/playbackService.spec.ts - About 3 hrs to fix

              Function initShader has 88 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                initShader () {
                  const screenRes = 'vec2( ' + this.w.toFixed(1) + ', ' + this.h.toFixed(1) + ')'
              
                  const load = (_vert, _frag) => new THREE.ShaderMaterial({
                    defines: {
              Severity: Major
              Found in resources/assets/js/visualizers/asteroid/scripts/NoiseBlob.ts - About 3 hrs to fix

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

                  protected test () {
                    it('toggles the playback of current song', async () => {
                      const toggleMock = this.mock(playbackService, 'toggle')
                      this.renderComponent(factory<Song>('song'))
                
                
                Severity: Major
                Found in resources/assets/js/components/ui/FooterPlayButton.spec.ts - About 3 hrs to fix

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

                    protected test () {
                      it('returns all queued songs', () => expect(queueStore.all).toEqual(songs))
                  
                      it('returns the first queued song', () => expect(queueStore.first).toEqual(songs[0]))
                  
                  
                  Severity: Major
                  Found in resources/assets/js/stores/queueStore.spec.ts - About 3 hrs to fix

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

                    export const init = async (container: HTMLElement) => {
                      const gl = document.createElement('canvas').getContext('webgl')!
                      const postctx = container.appendChild(document.createElement('canvas')).getContext('2d')!
                      const postprocess = postctx.canvas
                      const canvas = gl.canvas
                    Severity: Major
                    Found in resources/assets/js/visualizers/fluid-cube/index.ts - About 3 hrs to fix

                      Function useSongList has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
                      Open

                      export const useSongList = (
                        songs: Ref<Song[]>,
                        config: Partial<SongListConfig> = { sortable: true, reorderable: true }
                      ) => {
                        const filterKeywords = ref('')
                      Severity: Minor
                      Found in resources/assets/js/composables/useSongList.ts - About 3 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

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

                        protected test () {
                          it('serializes playlist for storage', () => {
                            expect(playlistStore.serializeSmartPlaylistRulesForStorage(ruleGroups)).toEqual(serializedRuleGroups)
                          })
                      
                      
                      Severity: Major
                      Found in resources/assets/js/stores/playlistStore.spec.ts - About 3 hrs to fix

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

                          protected test () {
                            it('edits a standard playlist', async () => {
                              const playlist = factory<Playlist>('playlist')
                              await this.renderComponent(playlist)
                              const emitMock = this.mock(eventBus, 'emit')
                        Severity: Major
                        Found in resources/assets/js/components/playlist/PlaylistContextMenu.spec.ts - About 3 hrs to fix

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

                            protected test () {
                              it('renames', async () => {
                                const folder = factory<PlaylistFolder>('playlist-folder')
                                await this.renderComponent(folder)
                                const emitMock = this.mock(eventBus, 'emit')

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

                              protected test () {
                                it('edits a single song', async () => {
                                  const updateMock = this.mock(songStore, 'update')
                                  const emitMock = this.mock(eventBus, 'emit')
                                  const alertMock = this.mock(MessageToasterStub.value, 'success')
                            Severity: Major
                            Found in resources/assets/js/components/song/EditSongForm.spec.ts - About 2 hrs to fix

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

                                protected test () {
                                  it('gets an artist by ID', () => {
                                    const artist = factory<Artist>('artist')
                                    artistStore.vault.set(artist.id, artist)
                                    expect(artistStore.byId(artist.id)).toEqual(artist)
                              Severity: Major
                              Found in resources/assets/js/stores/artistStore.spec.ts - About 2 hrs to fix

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

                                  protected test () {
                                    it('gets an album by ID', () => {
                                      const album = factory<Album>('album')
                                      albumStore.vault.set(album.id, album)
                                      expect(albumStore.byId(album.id)).toEqual(album)
                                Severity: Major
                                Found in resources/assets/js/stores/albumStore.spec.ts - About 2 hrs to fix

                                  File playbackService.ts has 284 lines of code (exceeds 250 allowed). Consider refactoring.
                                  Open

                                  import isMobile from 'ismobilejs'
                                  import plyr from 'plyr'
                                  import { watch } from 'vue'
                                  import { shuffle, throttle } from 'lodash'
                                  
                                  
                                  Severity: Minor
                                  Found in resources/assets/js/services/playbackService.ts - About 2 hrs to fix

                                    File InitCommand.php has 282 lines of code (exceeds 250 allowed). Consider refactoring.
                                    Open

                                    <?php
                                    
                                    namespace App\Console\Commands;
                                    
                                    use App\Console\Commands\Traits\AskForPassword;
                                    Severity: Minor
                                    Found in app/Console/Commands/InitCommand.php - About 2 hrs to fix
                                      Severity
                                      Category
                                      Status
                                      Source
                                      Language