Showing 336 of 336 total issues

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

    it('goes to artist details screen', async () => {
      const goMock = this.mock(this.router, 'go')
      await this.renderComponent(factory<Song>('song'))

      await this.user.click(screen.getByText('Go to Artist'))
Severity: Major
Found in resources/assets/js/components/song/SongContextMenu.spec.ts and 1 other location - About 3 hrs to fix
resources/assets/js/components/song/SongContextMenu.spec.ts on lines 64..71

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

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

  async paginate (page: number) {
    const resource = await http.get<PaginatorResource>(`albums?page=${page}`)
    this.state.albums = unionBy(this.state.albums, this.syncWithVault(resource.data), 'id')

    return resource.links.next ? ++resource.meta.current_page : null
Severity: Major
Found in resources/assets/js/stores/albumStore.ts and 1 other location - About 3 hrs to fix
resources/assets/js/stores/artistStore.ts on lines 72..77

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

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('goes to album details screen', async () => {
      const goMock = this.mock(this.router, 'go')
      await this.renderComponent(factory<Song>('song'))

      await this.user.click(screen.getByText('Go to Album'))
Severity: Major
Found in resources/assets/js/components/song/SongContextMenu.spec.ts and 1 other location - About 3 hrs to fix
resources/assets/js/components/song/SongContextMenu.spec.ts on lines 73..80

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

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('shows instruction for Last.fm integration to admins', () => {
    cy.$login({ useLastfm: false })
    cy.findByTestId('view-profile-link').click()
    cy.findByTestId('lastfm-integrated').should('not.exist')
    cy.findByTestId('lastfm-not-integrated').scrollIntoView().should('be.visible')
Severity: Major
Found in cypress/integration/profile.spec.ts and 1 other location - About 3 hrs to fix
cypress/integration/profile.spec.ts on lines 34..40

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

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('shows instruction for Last.fm integration to normal users', () => {
    cy.$loginAsNonAdmin({ useLastfm: false })
    cy.findByTestId('view-profile-link').click()
    cy.findByTestId('lastfm-integrated').should('not.exist')
    cy.findByTestId('lastfm-not-integrated').scrollIntoView().should('be.visible')
Severity: Major
Found in cypress/integration/profile.spec.ts and 1 other location - About 3 hrs to fix
cypress/integration/profile.spec.ts on lines 26..32

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

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

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

                it('plays all songs in an album', () => {
                  cy.$mockPlayback()
              
                  cy.get('#albumsWrapper').within(() => {
                    cy.get('[data-testid=album-card]:first-child .control-play')
              Severity: Major
              Found in cypress/integration/albums.spec.ts and 1 other location - About 3 hrs to fix
              cypress/integration/artists.spec.ts on lines 26..37

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

              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('plays all songs by an artist', () => {
                  cy.$mockPlayback()
              
                  cy.get('#artistsWrapper').within(() => {
                    cy.get('[data-testid=artist-card]:first-child .control-play')
              Severity: Major
              Found in cypress/integration/artists.spec.ts and 1 other location - About 3 hrs to fix
              cypress/integration/albums.spec.ts on lines 26..37

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

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

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

                    it('renames', async () => {
                      const folder = factory<PlaylistFolder>('playlist-folder')
                      await this.renderComponent(folder)
                      const emitMock = this.mock(eventBus, 'emit')
                
                
                resources/assets/js/components/playlist/PlaylistContextMenu.spec.ts on lines 19..27
                resources/assets/js/components/playlist/PlaylistContextMenu.spec.ts on lines 39..47
                resources/assets/js/components/playlist/PlaylistFolderContextMenu.spec.ts on lines 29..37

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

                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 4 locations. Consider refactoring.
                Open

                    it('deletes a playlist', async () => {
                      const playlist = factory<Playlist>('playlist')
                      await this.renderComponent(playlist)
                      const emitMock = this.mock(eventBus, 'emit')
                
                
                resources/assets/js/components/playlist/PlaylistContextMenu.spec.ts on lines 19..27
                resources/assets/js/components/playlist/PlaylistFolderContextMenu.spec.ts on lines 19..27
                resources/assets/js/components/playlist/PlaylistFolderContextMenu.spec.ts on lines 29..37

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

                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 4 locations. Consider refactoring.
                Open

                    it('edits a standard playlist', async () => {
                      const playlist = factory<Playlist>('playlist')
                      await this.renderComponent(playlist)
                      const emitMock = this.mock(eventBus, 'emit')
                
                
                resources/assets/js/components/playlist/PlaylistContextMenu.spec.ts on lines 39..47
                resources/assets/js/components/playlist/PlaylistFolderContextMenu.spec.ts on lines 19..27
                resources/assets/js/components/playlist/PlaylistFolderContextMenu.spec.ts on lines 29..37

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

                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 4 locations. Consider refactoring.
                Open

                    it('deletes', async () => {
                      const folder = factory<PlaylistFolder>('playlist-folder')
                      await this.renderComponent(folder)
                      const emitMock = this.mock(eventBus, 'emit')
                
                
                resources/assets/js/components/playlist/PlaylistContextMenu.spec.ts on lines 19..27
                resources/assets/js/components/playlist/PlaylistContextMenu.spec.ts on lines 39..47
                resources/assets/js/components/playlist/PlaylistFolderContextMenu.spec.ts on lines 19..27

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

                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 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
                  Severity
                  Category
                  Status
                  Source
                  Language