Showing 336 of 336 total issues

Similar blocks of code found in 2 locations. Consider refactoring.
Open

    eventBus.on('PLAYLIST_DELETE', async playlist => {
      if (await showConfirmDialog(`Delete the playlist "${playlist.name}"?`)) {
        await playlistStore.delete(playlist)
        toastSuccess(`Playlist "${playlist.name}" deleted.`)
        go('home')
Severity: Major
Found in resources/assets/js/components/utils/GlobalEventListeners.ts and 1 other location - About 2 hrs to fix
resources/assets/js/components/utils/GlobalEventListeners.ts on lines 23..35

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 75.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

new class extends UnitTestCase {
  protected test () {
    it('renders', () => {
      expect(this.render(Btn, {
        slots: {
Severity: Major
Found in resources/assets/js/components/ui/Btn.spec.ts and 1 other location - About 1 hr to fix
resources/assets/js/components/ui/AppleMusicButton.spec.ts on lines 5..15

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 74.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

new class extends UnitTestCase {
  protected test () {
    it('renders', () => {
      expect(this.render(AppleMusicButton, {
        props: {
Severity: Major
Found in resources/assets/js/components/ui/AppleMusicButton.spec.ts and 1 other location - About 1 hr to fix
resources/assets/js/components/ui/Btn.spec.ts on lines 5..15

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 74.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

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>('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., mid = 0., high = 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

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

        it('downloads all by artist', () => {
          const mock = this.mock(downloadService, 'trigger')
          downloadService.fromArtist(factory<Artist>('artist', { id: 42 }))
    
          expect(mock).toHaveBeenCalledWith('artist/42')
    Severity: Major
    Found in resources/assets/js/services/downloadService.spec.ts and 1 other location - About 1 hr to fix
    resources/assets/js/services/downloadService.spec.ts on lines 23..28

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 72.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

        it('downloads all in album', () => {
          const mock = this.mock(downloadService, 'trigger')
          downloadService.fromAlbum(factory<Album>('album', { id: 42 }))
    
          expect(mock).toHaveBeenCalledWith('album/42')
    Severity: Major
    Found in resources/assets/js/services/downloadService.spec.ts and 1 other location - About 1 hr to fix
    resources/assets/js/services/downloadService.spec.ts on lines 16..21

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 72.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Method handle has 46 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function handle(): int
        {
            $this->alert('KOEL INSTALLATION WIZARD');
            $this->info(
                'As a reminder, you can always install/upgrade manually following the guide at '
    Severity: Minor
    Found in app/Console/Commands/InitCommand.php - 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>('playlist', { name: 'Foo' }),
              factory<Playlist>('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>('artist', { id: 42 }))[0]
              const artistInfo = factory<ArtistInfo>('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

          Similar blocks of code found in 2 locations. Consider refactoring.
          Open

            it('invokes album screen', () => {
              cy.findByTestId('footer-middle-pane').within(() => cy.get('.album').click())
              cy.get('#albumWrapper').should('be.visible')
            })
          Severity: Major
          Found in cypress/integration/footer-pane.spec.ts and 1 other location - About 1 hr to fix
          cypress/integration/footer-pane.spec.ts on lines 23..26

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 69.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Similar blocks of code found in 2 locations. Consider refactoring.
          Open

            private async renderComponent (playlist: Playlist) {
              this.render(PlaylistContextMenu)
              eventBus.emit('PLAYLIST_CONTEXT_MENU_REQUESTED', { pageX: 420, pageY: 42 } as MouseEvent, playlist)
              await this.tick(2)
            }
          resources/assets/js/components/playlist/PlaylistFolderContextMenu.spec.ts on lines 12..16

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 69.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Similar blocks of code found in 2 locations. Consider refactoring.
          Open

            private async renderComponent (folder: PlaylistFolder) {
              this.render(PlaylistFolderContextMenu)
              eventBus.emit('PLAYLIST_FOLDER_CONTEXT_MENU_REQUESTED', { pageX: 420, pageY: 42 } as MouseEvent, folder)
              await this.tick(2)
            }
          resources/assets/js/components/playlist/PlaylistContextMenu.spec.ts on lines 12..16

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 69.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Similar blocks of code found in 2 locations. Consider refactoring.
          Open

            it('invokes artist screen', () => {
              cy.findByTestId('footer-middle-pane').within(() => cy.get('.artist').click())
              cy.get('#artistWrapper').should('be.visible')
            })
          Severity: Major
          Found in cypress/integration/footer-pane.spec.ts and 1 other location - About 1 hr to fix
          cypress/integration/footer-pane.spec.ts on lines 28..31

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 69.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          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'

                  Similar blocks of code found in 2 locations. Consider refactoring.
                  Open

                      it('gets the next song in queue', () => {
                        queueStore.state.songs[1].playback_state = 'Playing'
                        expect(queueStore.next).toEqual(queueStore.state.songs[2])
                      })
                  Severity: Major
                  Found in resources/assets/js/stores/queueStore.spec.ts and 1 other location - About 1 hr to fix
                  resources/assets/js/stores/queueStore.spec.ts on lines 93..96

                  Duplicated Code

                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                  Tuning

                  This issue has a mass of 67.

                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                  Refactorings

                  Further Reading

                  Similar blocks of code found in 2 locations. Consider refactoring.
                  Open

                      it('gets the previous song in queue', () => {
                        queueStore.state.songs[1].playback_state = 'Playing'
                        expect(queueStore.previous).toEqual(queueStore.state.songs[0])
                      })
                  Severity: Major
                  Found in resources/assets/js/stores/queueStore.spec.ts and 1 other location - About 1 hr to fix
                  resources/assets/js/stores/queueStore.spec.ts on lines 83..86

                  Duplicated Code

                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                  Tuning

                  This issue has a mass of 67.

                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                  Refactorings

                  Further Reading

                  Severity
                  Category
                  Status
                  Source
                  Language