Showing 134 of 387 total issues

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

      Function usePlaylistManagement has a Cognitive Complexity of 20 (exceeds 5 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 2 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 67 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        protected test () {
          it('pauses playback', async () => {
            const pauseMock = this.mock(playbackService, 'pause')
      
            this.renderComponent(factory('episode', {
      Severity: Major
      Found in resources/assets/js/components/podcast/EpisodeItem.spec.ts - About 2 hrs to fix

        PlaybackService has 24 functions (exceeds 20 allowed). Consider refactoring.
        Open

        class PlaybackService {
          public player!: Plyr
          private repeatModes: RepeatMode[] = ['NO_REPEAT', 'REPEAT_ALL', 'REPEAT_ONE']
          private initialized = false
        
        
        Severity: Minor
        Found in resources/assets/js/services/playbackService.ts - About 2 hrs to fix

          File NoiseBlob.ts has 276 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          import * as THREE from 'three'
          import type { ThreeSharedRenderer } from './ThreeSharedRenderer'
          import type { ThreePBR } from './ThreePBR'
          import type { ThreePointLight } from './ThreePointLight'
          import type { AudioAnalyzer } from './AudioAnalyzer'
          Severity: Minor
          Found in resources/assets/js/visualizers/asteroid/scripts/NoiseBlob.ts - About 2 hrs to fix

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

            import { reactive } from 'vue'
            import { expect, it } from 'vitest'
            import isMobile from 'ismobilejs'
            import UnitTestCase from '@/__tests__/UnitTestCase'
            import factory from '@/__tests__/factory'
            Severity: Minor
            Found in resources/assets/js/stores/songStore.spec.ts - About 2 hrs to fix

              Function useDroppable has 64 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              export const useDroppable = (acceptedTypes: DraggableType[]) => {
                const acceptsDrop = (event: DragEvent) => {
                  const type = getDragType(event)
                  return Boolean(type && acceptedTypes.includes(type))
                }
              Severity: Major
              Found in resources/assets/js/composables/useDragAndDrop.ts - About 2 hrs to fix

                Function test has 62 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 2 hrs to fix

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

                    protected test () {
                      it.each([
                        [0, '00:00'],
                        [59, '00:59'],
                        [60, '01:00'],
                  Severity: Major
                  Found in resources/assets/js/utils/formatters.spec.ts - About 2 hrs to fix

                    Function checkServiceIntegrations has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
                    Open

                        private function checkServiceIntegrations(): void
                        {
                            if (!LastfmService::enabled()) {
                                $this->reportWarning('Last.fm integration', 'Not available');
                            } else {
                    Severity: Minor
                    Found in app/Console/Commands/DoctorCommand.php - About 2 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

                    queueStore has 22 functions (exceeds 20 allowed). Consider refactoring.
                    Open

                    export const queueStore = {
                      state: reactive<{ playables: Playable[] }>({
                        playables: [],
                      }),
                    
                    
                    Severity: Minor
                    Found in resources/assets/js/stores/queueStore.ts - About 2 hrs to fix

                      DoctorCommand has 22 functions (exceeds 20 allowed). Consider refactoring.
                      Open

                      class DoctorCommand extends Command
                      {
                          protected $signature = 'koel:doctor';
                          protected $description = 'Check Koel setup';
                      
                      
                      Severity: Minor
                      Found in app/Console/Commands/DoctorCommand.php - About 2 hrs to fix

                        SongRepository has 22 functions (exceeds 20 allowed). Consider refactoring.
                        Open

                        class SongRepository extends Repository
                        {
                            private const DEFAULT_QUEUE_LIMIT = 500;
                        
                            public function findOneByPath(string $path): ?Song
                        Severity: Minor
                        Found in app/Repositories/SongRepository.php - About 2 hrs to fix

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

                            protected test () {
                              const { get: lsGet, set: lsSet } = useLocalStorage(false)
                          
                              it('gets the token', () => {
                                lsSet('api-token', 'foo')
                          Severity: Major
                          Found in resources/assets/js/services/authService.spec.ts - About 2 hrs to fix

                            Function useFloatingUi has 58 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                            export const useFloatingUi = (
                              reference: HTMLElement | Ref<HTMLElement | undefined>,
                              floating: HTMLElement | Ref<HTMLElement | undefined>,
                              config: Partial<Config> = {},
                            ) => {
                            Severity: Major
                            Found in resources/assets/js/composables/useFloatingUi.ts - About 2 hrs to fix

                              Method __construct has 18 arguments (exceeds 4 allowed). Consider refactoring.
                              Open

                                      public float $volume,
                                      public string $repeatMode,
                                      public Equalizer $equalizer,
                                      public string $artistsViewMode,
                                      public string $albumsViewMode,
                              Severity: Major
                              Found in app/Values/UserPreferences.php - About 2 hrs to fix

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

                                  protected test () {
                                    it('renders for album', () => {
                                      expect(this.renderForAlbum().html()).toMatchSnapshot()
                                    })
                                
                                

                                  Method checkServiceIntegrations has 52 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                      private function checkServiceIntegrations(): void
                                      {
                                          if (!LastfmService::enabled()) {
                                              $this->reportWarning('Last.fm integration', 'Not available');
                                          } else {
                                  Severity: Major
                                  Found in app/Console/Commands/DoctorCommand.php - About 2 hrs to fix

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

                                      protected test () {
                                        it('has different behaviors for current user', () => {
                                          const user = factory('user')
                                          this.be(user).renderComponent(user)
                                    
                                    
                                    Severity: Major
                                    Found in resources/assets/js/components/user/UserCard.spec.ts - About 2 hrs to fix
                                      Severity
                                      Category
                                      Status
                                      Source
                                      Language