Showing 134 of 387 total issues

Function test has 275 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 257 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      protected test () {
        it('plays', async () => {
          const playMock = this.mock(playbackService, 'play')
          const song = factory('song', { playback_state: 'Stopped' })
          await this.renderComponent(song)
    Severity: Major
    Found in resources/assets/js/components/song/PlayableContextMenu.spec.ts - About 1 day to fix

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

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

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

        export const useSongList = (
          playables: Ref<Playable[]>,
          context: PlayableListContext = {},
          config: Partial<PlayableListConfig> = {
            filterable: true,
        Severity: Minor
        Found in resources/assets/js/composables/useSongList.ts - About 5 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 110 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

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

          Function test has 103 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 4 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

            File playbackService.ts has 324 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'
            import { commonStore } from '@/stores/commonStore'
            Severity: Minor
            Found in resources/assets/js/services/playbackService.ts - About 3 hrs to fix

              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 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

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

                    protected test () {
                      it('edits a single song', async () => {
                        const result: SongUpdateResult = {
                          albums: [],
                          artists: [],
                  Severity: Major
                  Found in resources/assets/js/components/song/EditSongForm.spec.ts - About 3 hrs to fix

                    Function initShader has 89 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

                      File playbackService.spec.ts has 315 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/helpers'
                      Severity: Minor
                      Found in resources/assets/js/services/playbackService.spec.ts - About 3 hrs to fix

                        Function init has 87 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 test has 86 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                            protected test () {
                              it('returns all queued songs', () => expect(queueStore.all).toEqual(playables))
                          
                              it('returns the first queued song', () => expect(queueStore.first).toEqual(playables[0]))
                          
                          
                          Severity: Major
                          Found in resources/assets/js/stores/queueStore.spec.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'))
                            
                            
                            Severity: Major
                            Found in resources/assets/js/components/ui/FooterPlayButton.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('playlist-folder')
                                    await this.renderComponent(folder)
                                    const emitMock = this.mock(eventBus, 'emit')

                                Function listenToMediaEvents has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
                                Open

                                  private listenToMediaEvents (media: HTMLMediaElement) {
                                    media.addEventListener('error', () => this.playNext(), true)
                                
                                    media.addEventListener('ended', () => {
                                      if (
                                Severity: Minor
                                Found in resources/assets/js/services/playbackService.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

                                songStore has 26 functions (exceeds 20 allowed). Consider refactoring.
                                Open

                                export const songStore = {
                                  vault: new Map<Playable['id'], Playable>(),
                                
                                  state: reactive<{ songs: Playable[] }>({
                                    songs: [],
                                Severity: Minor
                                Found in resources/assets/js/stores/songStore.ts - About 3 hrs to fix

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

                                  import { expect, it } from 'vitest'
                                  import UnitTestCase from '@/__tests__/UnitTestCase'
                                  import factory from '@/__tests__/factory'
                                  import { arrayify } from '@/utils/helpers'
                                  import { eventBus } from '@/utils/eventBus'
                                  Severity: Minor
                                  Found in resources/assets/js/components/song/PlayableContextMenu.spec.ts - About 3 hrs to fix
                                    Severity
                                    Category
                                    Status
                                    Source
                                    Language