Chocobozzz/PeerTube

View on GitHub

Showing 1,230 of 3,155 total issues

File job-queue.ts has 451 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import {
  FlowJob,
  FlowProducer,
  Job,
  JobsOptions,
Severity: Minor
Found in server/core/lib/job-queue/job-queue.ts - About 6 hrs to fix

    VideosIdListQueryBuilder has 48 functions (exceeds 20 allowed). Consider refactoring.
    Open

    export class VideosIdListQueryBuilder extends AbstractRunQuery {
      protected replacements: any = {}
    
      private attributes: string[]
      private joins: string[] = []
    Severity: Minor
    Found in server/core/models/video/sql/video/videos-id-list-query-builder.ts - About 6 hrs to fix

      File client.ts has 442 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      import {
        HttpStatusCode,
        VideoChaptersObject,
        VideoCommentObject,
        VideoPlaylistPrivacy,
      Severity: Minor
      Found in server/core/controllers/activitypub/client.ts - About 6 hrs to fix

        File peertube-plugin.ts has 437 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        import { timeToInt } from '@peertube/peertube-core-utils'
        import { VideoView, VideoViewEvent } from '@peertube/peertube-models'
        import { logger } from '@root-helpers/logger'
        import { isIOS, isMobile, isSafari } from '@root-helpers/web-browser'
        import debug from 'debug'
        Severity: Minor
        Found in client/src/assets/player/shared/peertube/peertube-plugin.ts - About 6 hrs to fix

          Function exports has 159 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          module.exports = function () {
            const configuration = {
              entry: {
                'video-embed': './src/standalone/videos/embed.ts',
                'player': './src/standalone/embed-player-api/player.ts',
          Severity: Major
          Found in client/webpack/webpack.video-embed.js - About 6 hrs to fix

            File abuse-list-table.component.ts has 423 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            import * as debug from 'debug'
            import { SortMeta, SharedModule } from 'primeng/api'
            import { Component, Input, OnInit, ViewChild } from '@angular/core'
            import { ActivatedRoute, Router } from '@angular/router'
            import { ConfirmService, MarkdownService, Notifier, RestPagination, RestTable } from '@app/core'
            Severity: Minor
            Found in client/src/app/shared/shared-abuse-list/abuse-list-table.component.ts - About 6 hrs to fix

              File edit-custom-config.component.ts has 422 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              import omit from 'lodash-es/omit'
              import { forkJoin } from 'rxjs'
              import { SelectOptionsItem } from 'src/types/select-options-item.model'
              import { Component, OnInit } from '@angular/core'
              import { ActivatedRoute, Router } from '@angular/router'

                File account.ts has 418 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                import { Account, AccountSummary } from '@peertube/peertube-models'
                import { ModelCache } from '@server/models/shared/model-cache.js'
                import { FindOptions, IncludeOptions, Includeable, Op, Transaction, WhereOptions } from 'sequelize'
                import {
                  AllowNull,
                Severity: Minor
                Found in server/core/models/account/account.ts - About 6 hrs to fix

                  File config.ts has 418 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  import express from 'express'
                  import { remove, writeJSON } from 'fs-extra/esm'
                  import snakeCase from 'lodash-es/snakeCase.js'
                  import validator from 'validator'
                  import { ServerConfigManager } from '@server/lib/server-config-manager.js'
                  Severity: Minor
                  Found in server/core/controllers/api/config.ts - About 6 hrs to fix

                    Function sanitizeAndCheckVideoTorrentObject has a Cognitive Complexity of 39 (exceeds 5 allowed). Consider refactoring.
                    Open

                    export function sanitizeAndCheckVideoTorrentObject (video: VideoObject) {
                      if (!video || video.type !== 'Video') return false
                    
                      const fail = (field: string) => {
                        logger.debug(`Video field is not valid to PeerTube: ${field}`, { video })
                    Severity: Minor
                    Found in server/core/helpers/custom-validators/activitypub/videos.ts - About 5 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-actions-dropdown.component.ts has 412 lines of code (exceeds 250 allowed). Consider refactoring.
                    Open

                    import { NgIf } from '@angular/common'
                    import { Component, EventEmitter, Input, OnChanges, Output, ViewChild, booleanAttribute } from '@angular/core'
                    import { AuthService, ConfirmService, Notifier, ScreenService, ServerService } from '@app/core'
                    import { NgbDropdown, NgbDropdownAnchor, NgbDropdownMenu } from '@ng-bootstrap/ng-bootstrap'
                    import { VideoCaption } from '@peertube/peertube-models'

                      File peertube-player.ts has 410 lines of code (exceeds 250 allowed). Consider refactoring.
                      Open

                      import '@peertube/videojs-contextmenu'
                      import './shared/upnext/end-card'
                      import './shared/upnext/upnext-plugin'
                      import './shared/stats/stats-card'
                      import './shared/stats/stats-plugin'
                      Severity: Minor
                      Found in client/src/assets/player/peertube-player.ts - About 5 hrs to fix

                        Function buildIdsListQuery has 143 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                          private buildIdsListQuery (options: BuildVideosListQueryOptions) {
                            this.attributes = options.attributes || [ '"video"."id"' ]
                        
                            if (options.group) this.group = options.group
                            if (options.having) this.having = options.having
                        Severity: Major
                        Found in server/core/models/video/sql/video/videos-id-list-query-builder.ts - About 5 hrs to fix

                          VideoWatchComponent has 42 functions (exceeds 20 allowed). Consider refactoring.
                          Open

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

                            VideosCommand has 42 functions (exceeds 20 allowed). Consider refactoring.
                            Open

                            export class VideosCommand extends AbstractCommand {
                            
                              getCategories (options: OverrideCommandOptions = {}) {
                                const path = '/api/v1/videos/categories'
                            
                            
                            Severity: Minor
                            Found in packages/server-commands/src/videos/videos-command.ts - About 5 hrs to fix

                              Function run has 141 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                              async function run () {
                                console.log('Preparing server...')
                              
                                await prepare()
                              
                              
                              Severity: Major
                              Found in scripts/benchmark.ts - About 5 hrs to fix

                                Function generateNodeinfo has 139 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                async function generateNodeinfo (req: express.Request, res: express.Response) {
                                  const { totalVideos } = await VideoModel.getStats()
                                  const { totalLocalVideoComments } = await VideoCommentModel.getStats()
                                  const { totalUsers, totalMonthlyActiveUsers, totalHalfYearActiveUsers } = await UserModel.getStats()
                                
                                
                                Severity: Major
                                Found in server/core/controllers/misc.ts - About 5 hrs to fix

                                  File muxing-session.ts has 397 lines of code (exceeds 250 allowed). Consider refactoring.
                                  Open

                                  import { wait } from '@peertube/peertube-core-utils'
                                  import { FileStorage, LiveVideoError, VideoStreamingPlaylistType } from '@peertube/peertube-models'
                                  import { computeOutputFPS } from '@server/helpers/ffmpeg/index.js'
                                  import { LoggerTagsFn, logger, loggerTagsFactory } from '@server/helpers/logger.js'
                                  import { CONFIG } from '@server/initializers/config.js'
                                  Severity: Minor
                                  Found in server/core/lib/live/shared/muxing-session.ts - About 5 hrs to fix

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

                                    import express from 'express'
                                    import { body, param, query } from 'express-validator'
                                    import { forceNumber } from '@peertube/peertube-core-utils'
                                    import { HttpStatusCode, UserRight, UserRole } from '@peertube/peertube-models'
                                    import { exists, isBooleanValid, isIdValid, toBooleanOrNull, toIntOrNull } from '../../../helpers/custom-validators/misc.js'
                                    Severity: Minor
                                    Found in server/core/middlewares/validators/users/users.ts - About 5 hrs to fix

                                      Function run has 134 lines of code (exceeds 25 allowed). Consider refactoring.
                                      Open

                                      async function run () {
                                        await initDatabaseModels(true)
                                      
                                        const serverAccount = await getServerActor()
                                      
                                      
                                      Severity: Major
                                      Found in server/scripts/update-host.ts - About 5 hrs to fix
                                        Severity
                                        Category
                                        Status
                                        Source
                                        Language