Showing 134 of 387 total issues

Function showNotification has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  public showNotification (playable: Playable) {
    if (!isSong(playable) && !isEpisode(playable)) {
      throw new Error('Invalid playable type.')
    }

Severity: Minor
Found in resources/assets/js/services/playbackService.ts - About 35 mins 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 getAllFileEntries has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

async function getAllFileEntries (dataTransferItemList: DataTransferItemList) {
  const fileEntries: FileSystemEntry[] = []
  const queue: FileSystemEntry[] = []

  for (let i = 0, length = dataTransferItemList.length; i < length; i++) {
Severity: Minor
Found in resources/assets/js/utils/directoryReader.ts - About 35 mins 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 useUpload has a Cognitive Complexity of 7 (exceeds 5 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 35 mins 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

Avoid too many return statements within this method.
Open

        return $cloudStorage->copyToLocal($song);
Severity: Major
Found in app/Services/DownloadService.php - About 30 mins to fix

    Avoid too many return statements within this function.
    Open

          return <Song[]>[]
    Severity: Major
    Found in resources/assets/js/composables/useDragAndDrop.ts - About 30 mins to fix

      Avoid too many return statements within this method.
      Open

                      return null;
      Severity: Major
      Found in app/Services/DownloadService.php - About 30 mins to fix

        Avoid too many return statements within this function.
        Open

                  return folder ? await songStore.fetchForPlaylistFolder(folder) : <Song[]>[]
        Severity: Major
        Found in resources/assets/js/composables/useDragAndDrop.ts - About 30 mins to fix

          Avoid too many return statements within this function.
          Open

              return showGenericError()
          Severity: Major
          Found in resources/assets/js/composables/useErrorHandler.ts - About 30 mins to fix

            Avoid too many return statements within this function.
            Open

                return this.activateRoute(route, params)
            Severity: Major
            Found in resources/assets/js/router.ts - About 30 mins to fix

              Function usePolicies has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

              export const usePolicies = () => {
                const { currentUser, isAdmin } = useAuthorization()
                const { isPlus } = useKoelPlus()
              
                const currentUserCan = {
              Severity: Minor
              Found in resources/assets/js/composables/usePolicies.ts - About 25 mins 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 reportErroneousResult has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

                  private function reportErroneousResult(): void
                  {
                      $this->components->error('There are errors in your Koel setup. Koel will not work properly.');
              
                      if (File::isWritable(base_path('storage/logs/laravel.log'))) {
              Severity: Minor
              Found in app/Console/Commands/DoctorCommand.php - About 25 mins 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 updateFloatingUi has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

              export const updateFloatingUi = async (
                reference: HTMLElement,
                floating: HTMLElement,
                options: Partial<ComputePositionConfig>,
                arrow?: HTMLElement,
              Severity: Minor
              Found in resources/assets/js/utils/floatingUi.ts - About 25 mins 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 tryMatchRoute has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

                private tryMatchRoute () {
                  if (!this.cache.has(location.hash)) {
                    for (let i = 0; i < this.routes.length; i++) {
                      const route = this.routes[i]
                      const matches = location.hash.match(new RegExp(`^#!?${route.path}/?(?:\\?(.*))?$`))
              Severity: Minor
              Found in resources/assets/js/router.ts - About 25 mins 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 upload has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

                async upload (file: UploadFile) {
                  if (file.status === 'Uploading') {
                    return
                  }
              
              
              Severity: Minor
              Found in resources/assets/js/services/uploadService.ts - About 25 mins 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

              Severity
              Category
              Status
              Source
              Language