Chocobozzz/PeerTube

View on GitHub

Showing 1,292 of 3,313 total issues

Function onVideoStudioEnded has 37 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export async function onVideoStudioEnded (options: {
  editionResultPath: string
  tasks: VideoStudioTaskPayload[]
  video: MVideoFullLight
}) {
Severity: Minor
Found in server/core/lib/video-studio.ts - About 1 hr to fix

    Function processFollow has 37 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    async function processFollow (byActor: MActorSignature, activityId: string, targetActorURL: string) {
      const { actorFollow, created, targetActor } = await sequelizeTypescript.transaction(async t => {
        const targetActor = await ActorModel.loadByUrlAndPopulateAccountAndChannel(targetActorURL, t)
    
        if (!targetActor) throw new Error('Unknown actor')
    Severity: Minor
    Found in server/core/lib/activitypub/process/process-follow.ts - About 1 hr to fix

      Function buildTasks has 37 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        private buildTasks () {
          const tasks: VideoStudioTask[] = []
          const value = this.form.value
      
          const cut = value['cut']
      Severity: Minor
      Found in client/src/app/+video-studio/edit/video-studio-edit.component.ts - About 1 hr to fix

        Function buildMenu has 37 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          private buildMenu () {
            this.menuEntries = [
              {
                label: $localize`Channels`,
                routerLink: '/my-library/video-channels'
        Severity: Minor
        Found in client/src/app/+my-library/my-library.component.ts - About 1 hr to fix

          Function addWatermark has 37 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            async addWatermark (options: BaseStudioOptions & {
              watermarkPath: string
          
              videoFilters: {
                watermarkSizeRatio: number
          Severity: Minor
          Found in packages/ffmpeg/src/ffmpeg-edition.ts - About 1 hr to fix

            Function buildVideoAttributesFromCommander has 37 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            async function buildVideoAttributesFromCommander (server: PeerTubeServer, options: UploadOptions) {
              const defaultBooleanAttributes = {
                nsfw: false,
                downloadEnabled: true,
                waitTranscoding: true
            Severity: Minor
            Found in apps/peertube-cli/src/peertube-upload.ts - About 1 hr to fix

              Function onData has 37 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                    readable.on('data', async function onData (chunk) {
                      try {
                        readable.pause()
              
                        const byterangeStart = start + chunk.length - 1
              Severity: Minor
              Found in packages/server-commands/src/shared/abstract-command.ts - About 1 hr to fix

                Function generateVideoPodcastFeed has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                async function generateVideoPodcastFeed (req: express.Request, res: express.Response) {
                  const videoChannel = res.locals.videoChannel
                
                  const { name, userName, description, imageUrl, accountImageUrl, email, link, accountLink } = await buildFeedMetadata({ videoChannel })
                
                
                Severity: Minor
                Found in server/core/controllers/feeds/video-podcast-feeds.ts - About 1 hr to fix

                  Function onAfterMuxingCleanup has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    private async onAfterMuxingCleanup (options: {
                      videoUUID: string
                      liveSession?: MVideoLiveSession
                      cleanupNow?: boolean // Default false
                    }) {
                  Severity: Minor
                  Found in server/core/lib/live/live-manager.ts - About 1 hr to fix

                    Function getRedisClientOptions has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      static getRedisClientOptions (name?: string, options: RedisOptions = {}, logOptions = false): RedisOptions {
                        const connectionName = [ 'PeerTube', name ].join('')
                        const connectTimeout = 20000 // Could be slow since node use sync call to compile PeerTube
                    
                        if (CONFIG.REDIS.SENTINEL.ENABLED) {
                    Severity: Minor
                    Found in server/core/lib/redis.ts - About 1 hr to fix

                      Function userRateVideo has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      export async function userRateVideo (options: {
                        rateType: UserVideoRateType
                        account: MAccountUrl & MAccountId
                        video: MVideoFullLight
                      }) {
                      Severity: Minor
                      Found in server/core/lib/rate.ts - About 1 hr to fix

                        Function updateVideoFile has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                          updateVideoFile (options: {
                            videoFile: VideoFile
                            isUserResolutionChange: boolean
                          }) {
                            this.currentVideoFile = options.videoFile
                        Severity: Minor
                        Found in client/src/assets/player/shared/web-video/web-video-plugin.ts - About 1 hr to fix

                          Function loadMoreVideoChannels has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                            private loadMoreVideoChannels () {
                              if (this.pagesDone.has(this.pagination.currentPage)) return
                              this.pagesDone.add(this.pagination.currentPage)
                          
                              return this.authService.userInformationLoaded

                            Function constructor has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                              constructor (
                                private authHttp: HttpClient,
                                private restExtractor: RestExtractor
                              ) {
                                this.videoQuotaOptions = [
                            Severity: Minor
                            Found in client/src/app/+admin/config/shared/config.service.ts - About 1 hr to fix

                              Function updatePluginFields has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                private async updatePluginFields () {
                                  this.pluginFields = this.pluginService.getRegisteredVideoFormFields(this.type)
                              
                                  if (this.pluginFields.length === 0) return
                              
                              
                              Severity: Minor
                              Found in client/src/app/+videos/+video-edit/shared/video-edit.component.ts - About 1 hr to fix

                                Function parseQueryStringFilter has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                  parseQueryStringFilter <T extends QueryStringFilterPrefixes> (q: string, prefixes: T): ParseQueryStringFiltersResult<keyof T> {
                                    if (!q) return {}
                                
                                    const tokens = this.tokenizeString(q)
                                
                                
                                Severity: Minor
                                Found in client/src/app/core/rest/rest.service.ts - About 1 hr to fix

                                  Function buildAdditionalAttributes has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                                  Open

                                  function buildAdditionalAttributes (video: MVideoFormattable, options: VideoFormattingJSONOptions) {
                                    const add = options.additionalAttributes
                                  
                                    const result: Partial<VideoAdditionalAttributes> = {}
                                  
                                  
                                  Severity: Minor
                                  Found in server/core/models/video/formatter/video-api-format.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

                                  Function checkMissedConfig has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                                  Open

                                  function checkMissedConfig () {
                                    const required = [ 'listen.port', 'listen.hostname',
                                      'webserver.https', 'webserver.hostname', 'webserver.port',
                                      'secrets.peertube',
                                      'trust_proxy',
                                  Severity: Minor
                                  Found in server/core/initializers/checker-before-init.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

                                  Function generateOutput has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                                  Open

                                  async function generateOutput (options: {
                                    startDateQuery: string
                                    endDateQuery?: string
                                  
                                    level: ServerLogLevel
                                  Severity: Minor
                                  Found in server/core/controllers/api/server/logs.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

                                  Function buildFeedMetadata has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                                  Open

                                  export async function buildFeedMetadata (options: {
                                    videoChannel?: MChannelBannerAccountDefault
                                    account?: MAccountDefault
                                    video?: MVideoFullLight
                                  }) {
                                  Severity: Minor
                                  Found in server/core/controllers/feeds/shared/common-feed-utils.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

                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language