Showing 134 of 387 total issues

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

  protected test () {
    it('does not show a badge when current user is not the collaborator', async () => {
      const currentUser = factory('user')
      this.be(currentUser).renderComponent({
        collaborator: factory('playlist-collaborator', { id: currentUser.id + 1 }),

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

      protected test () {
        it('toggles one song', async () => {
          const addMock = this.mock(favoriteStore, 'add')
          const removeMock = this.mock(favoriteStore, 'remove')
          const postMock = this.mock(http, 'post')
    Severity: Minor
    Found in resources/assets/js/stores/favoriteStore.spec.ts - About 2 hrs to fix

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

        protected test () {
          it('renders', async () => expect((await this.renderComponent()).html()).toMatchSnapshot())
      
          it('plays all', async () => {
            const songs = factory('song', 10)
      Severity: Minor
      Found in resources/assets/js/components/album/AlbumContextMenu.spec.ts - About 2 hrs to fix

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

          protected test () {
            it('initializes the store', () => {
              const applyMock = this.mock(themeStore, 'applyThemeFromPreference')
        
              themeStore.init()
        Severity: Minor
        Found in resources/assets/js/stores/themeStore.spec.ts - About 2 hrs to fix

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

            protected test () {
              it('renders', async () => expect((await this.renderComponent()).html()).toMatchSnapshot())
          
              it('plays all', async () => {
                const songs = factory('song', 10)
          Severity: Minor
          Found in resources/assets/js/components/artist/ArtistContextMenu.spec.ts - About 1 hr to fix

            Function update has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
            Open

              update () {
                this.analyzer.getByteFrequencyData(this.audioBuffer)
                let bass = 0.0; let mid = 0.0; let high = 0.0
            
                if (this.audioBuffer[0] === 0) {
            Severity: Minor
            Found in resources/assets/js/visualizers/asteroid/scripts/AudioAnalyzer.ts - 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

            Function useErrorHandler has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
            Open

            export const useErrorHandler = (driver: ErrorMessageDriver = 'toast') => {
              const { toastError } = useMessageToaster()
              const { showErrorDialog } = useDialogBox()
            
              const showError = (message: string) => driver === 'toast' ? toastError(message) : showErrorDialog(message)
            Severity: Minor
            Found in resources/assets/js/composables/useErrorHandler.ts - 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

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

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

                protected test () {
                  it('renders', () => {
                    playlistStore.state.playlists = [
                      factory('playlist', { name: 'Foo' }),
                      factory('playlist', { name: 'Bar' }),
              Severity: Minor
              Found in resources/assets/js/components/song/AddToMenu.spec.ts - About 1 hr to fix

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

                  protected test () {
                    it('fetches the artist info', async () => {
                      const artist = artistStore.syncWithVault(factory('artist', { id: 42 }))[0]
                      const artistInfo = factory('artist-info')
                      const getMock = this.mock(http, 'get').mockResolvedValue(artistInfo)
                Severity: Minor
                Found in resources/assets/js/services/mediaInfoService.spec.ts - About 1 hr to fix

                  Function useDraggable has 44 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

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

                      protected test () {
                        it.each<[string, keyof Events, User | Playable[] | 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')],
                    Severity: Minor
                    Found in resources/assets/js/components/layout/ModalWrapper.spec.ts - About 1 hr to fix

                      Function useUpload has 41 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      export const useUpload = () => {
                        const { toastSuccess, toastWarning } = useMessageToaster()
                        const { go, isCurrentScreen } = useRouter()
                      
                        const { currentUserCan } = usePolicies()
                      Severity: Minor
                      Found in resources/assets/js/composables/useUpload.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 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.active_extra_panel_tab = 'YouTube'

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

                            export const usePlaylistManagement = () => {
                              const { handleHttpError } = useErrorHandler('dialog')
                              const { toastSuccess } = useMessageToaster()
                            
                              const inflect = (playables: Playable[]) => {
                            Severity: Minor
                            Found in resources/assets/js/composables/usePlaylistManagement.ts - About 1 hr to fix

                              Function startDragging has 39 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 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
                                      Severity
                                      Category
                                      Status
                                      Source
                                      Language