Chocobozzz/PeerTube

View on GitHub

Showing 1,292 of 3,313 total issues

File users-command.ts has 309 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import { omit, pick } from '@peertube/peertube-core-utils'
import {
  HttpStatusCode,
  MyUser,
  ResultList,
Severity: Minor
Found in packages/server-commands/src/users/users-command.ts - About 3 hrs to fix

    Function buildYoutubeDLImport has 84 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    async function buildYoutubeDLImport (options: {
      targetUrl: string
      channel: MChannelAccountDefault
      user: MUser
      channelSync?: MChannelSync
    Severity: Major
    Found in server/core/lib/video-pre-import.ts - About 3 hrs to fix

      Notifier has 28 functions (exceeds 20 allowed). Consider refactoring.
      Open

      class Notifier {
      
        private readonly notificationModels = {
          newVideoOrLive: [ NewVideoOrLiveForSubscribers ],
          publicationAfterTranscoding: [ OwnedPublicationAfterTranscoding ],
      Severity: Minor
      Found in server/core/lib/notifier/notifier.ts - About 3 hrs to fix

        VideoListComponent has 28 functions (exceeds 20 allowed). Consider refactoring.
        Open

        @Component({
          selector: 'my-video-list',
          templateUrl: './video-list.component.html',
          styleUrls: [ './video-list.component.scss' ],
          standalone: true,
        Severity: Minor
        Found in client/src/app/+admin/overview/videos/video-list.component.ts - About 3 hrs to fix

          SearchComponent has 28 functions (exceeds 20 allowed). Consider refactoring.
          Open

          @Component({
            selector: 'my-search',
            styleUrls: [ './search.component.scss' ],
            templateUrl: './search.component.html',
            standalone: true,
          Severity: Minor
          Found in client/src/app/+search/search.component.ts - About 3 hrs to fix

            File video-file.ts has 305 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            import {
              FFmpegContainer,
              ffprobePromise,
              getVideoStreamDimensionsInfo,
              getVideoStreamFPS,
            Severity: Minor
            Found in server/core/lib/video-file.ts - About 3 hrs to fix

              Function registerOpentelemetryTracing has 82 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              async function registerOpentelemetryTracing () {
                if (CONFIG.OPEN_TELEMETRY.TRACING.ENABLED !== true) {
                  tracer = new TrackerMock()
              
                  return
              Severity: Major
              Found in server/core/lib/opentelemetry/tracing.ts - About 3 hrs to fix

                Function buildWhere has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
                Open

                  private buildWhere () {
                    let where: string[] = []
                
                    if (this.options.videoId) {
                      this.replacements.videoId = this.options.videoId

                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 getRemoteObjectOrDie has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
                Open

                function getRemoteObjectOrDie (
                  options: CommonProgramOptions,
                  settings: Settings,
                  netrc: Netrc
                ): { url: string, username: string, password: string } {
                Severity: Minor
                Found in apps/peertube-cli/src/shared/cli.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

                File video-playlist.service.ts has 302 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                import debug from 'debug'
                import { merge, Observable, of, ReplaySubject, Subject } from 'rxjs'
                import { catchError, filter, map, share, switchMap, tap } from 'rxjs/operators'
                import { HttpClient, HttpContext, HttpParams } from '@angular/common/http'
                import { Injectable } from '@angular/core'
                Severity: Minor
                Found in client/src/app/shared/shared-video-playlist/video-playlist.service.ts - About 3 hrs to fix

                  Function buildExporters has 81 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    private buildExporters (exportModel: MUserExport, user: MUserDefault) {
                      const options = {
                        user,
                        activityPubFilenames: {
                          dislikes: 'dislikes.json',
                  Severity: Major
                  Found in server/core/lib/user-import-export/user-exporter.ts - About 3 hrs to fix

                    Function processFile has 81 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    async function processFile (downloader: () => Promise<string>, videoImport: MVideoImportDefault, options: ProcessFileOptions) {
                      let tmpVideoPath: string
                      let videoFile: MVideoFile
                    
                      try {
                    Severity: Major
                    Found in server/core/lib/job-queue/handlers/video-import.ts - About 3 hrs to fix

                      Function importObject has 81 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                        protected async importObject (videoImportData: SanitizedObject) {
                          const videoFilePath = !videoImportData.isLive
                            ? this.getSafeArchivePathOrThrow(videoImportData.archiveFiles.videoFile)
                            : null
                      
                      
                      Severity: Major
                      Found in server/core/lib/user-import-export/importers/videos-importer.ts - About 3 hrs to fix

                        File video-upload.component.ts has 301 lines of code (exceeds 250 allowed). Consider refactoring.
                        Open

                        import { NgIf } from '@angular/common'
                        import { HttpErrorResponse } from '@angular/common/http'
                        import { AfterViewInit, Component, ElementRef, EventEmitter, OnDestroy, OnInit, Output, ViewChild } from '@angular/core'
                        import { FormsModule, ReactiveFormsModule } from '@angular/forms'
                        import { ActivatedRoute, Router } from '@angular/router'

                          Function handleSession has 80 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                            private async handleSession (options: {
                              sessionId: string
                              inputLocalUrl: string
                              inputPublicUrl: string
                              streamKey: string
                          Severity: Major
                          Found in server/core/lib/live/live-manager.ts - About 3 hrs to fix

                            File benchmark.ts has 299 lines of code (exceeds 250 allowed). Consider refactoring.
                            Open

                            import { Video, VideoPrivacy } from '@peertube/peertube-models'
                            import {
                              createSingleServer,
                              doubleFollow,
                              killallServers,
                            Severity: Minor
                            Found in scripts/benchmark.ts - About 3 hrs to fix

                              PeerTubePlayer has 27 functions (exceeds 20 allowed). Consider refactoring.
                              Open

                              export class PeerTubePlayer {
                              
                                private readonly eventRegistrar: EventRegistrar = new EventRegistrar()
                                private channel: Channel.MessagingChannel
                                private readyPromise: Promise<void>
                              Severity: Minor
                              Found in client/src/standalone/embed-player-api/player.ts - About 3 hrs to fix

                                Function buildInstanceModerationActions has 79 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                  private buildInstanceModerationActions () {
                                    if (!this.authService.isLoggedIn()) return []
                                
                                    const authUser = this.authService.getUser()
                                
                                

                                  Function getJoins has 78 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                    private getJoins () {
                                      return `
                                      LEFT JOIN (
                                        "video" AS "Video"
                                        INNER JOIN "videoChannel" AS "Video->VideoChannel" ON "Video"."channelId" = "Video->VideoChannel"."id"
                                  Severity: Major
                                  Found in server/core/models/user/sql/user-notitication-list-query-builder.ts - About 3 hrs to fix

                                    Function oembedValidator has 78 lines of code (exceeds 25 allowed). Consider refactoring.
                                    Open

                                      async (req: express.Request, res: express.Response, next: express.NextFunction) => {
                                        if (areValidationErrors(req, res)) return
                                    
                                        if (req.query.format !== undefined && req.query.format !== 'json') {
                                          return res.fail({
                                    Severity: Major
                                    Found in server/core/middlewares/validators/oembed.ts - About 3 hrs to fix
                                      Severity
                                      Category
                                      Status
                                      Source
                                      Language