Chocobozzz/PeerTube

View on GitHub

Showing 1,292 of 3,313 total issues

VideoEditComponent has 31 functions (exceeds 20 allowed). Consider refactoring.
Open

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

    File video-add-to-playlist.component.ts has 326 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    import debug from 'debug'
    import { Subject, Subscription } from 'rxjs'
    import { debounceTime, filter } from 'rxjs/operators'
    import { ChangeDetectionStrategy, ChangeDetectorRef, Component, Input, OnChanges, OnDestroy, OnInit, SimpleChanges } from '@angular/core'
    import { AuthService, DisableForReuseHook, Notifier } from '@app/core'

      Function up has 95 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      async function up (utils: {
        transaction: Sequelize.Transaction
        queryInterface: Sequelize.QueryInterface
        sequelize: Sequelize.Sequelize
      }): Promise<void> {
      Severity: Major
      Found in server/core/initializers/migrations/0760-video-live-replay-setting.ts - About 3 hrs to fix

        File jobs.ts has 323 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        import {
          AbortRunnerJobBody,
          AcceptRunnerJobResult,
          ErrorRunnerJobBody,
          HttpStatusCode,
        Severity: Minor
        Found in server/core/controllers/api/runners/jobs.ts - About 3 hrs to fix

          Function defineAuthProgram has 93 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          export function defineAuthProgram () {
            const program = new Command()
              .name('auth')
              .description('Register your accounts on remote instances to use them with other commands')
          
          
          Severity: Major
          Found in apps/peertube-cli/src/peertube-auth.ts - About 3 hrs to fix

            File video-comment-list-query-builder.ts has 321 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            import { ActorImageType, VideoPrivacy } from '@peertube/peertube-models'
            import { AbstractRunQuery, ModelBuilder } from '@server/models/shared/index.js'
            import { Model, Sequelize, Transaction } from 'sequelize'
            import { createSafeIn, getSort, parseRowCountResult } from '../../../shared/index.js'
            import { VideoCommentTableAttributes } from './video-comment-table-attributes.js'

              VideoStatsComponent has 30 functions (exceeds 20 allowed). Consider refactoring.
              Open

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

                Function buildAbuseListQuery has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
                Open

                function buildAbuseListQuery (options: BuildAbusesQueryOptions, type: 'count' | 'id') {
                  const whereAnd: string[] = []
                  const replacements: any = {}
                
                  const joins = [
                Severity: Minor
                Found in server/core/models/abuse/sql/abuse-query-builder.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

                Function up has 89 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                async function up (utils: {
                  transaction: Sequelize.Transaction
                  queryInterface: Sequelize.QueryInterface
                  sequelize: Sequelize.Sequelize
                }): Promise<void> {
                Severity: Major
                Found in server/core/initializers/migrations/0845-auto-tags.ts - About 3 hrs to fix

                  Function up has 88 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  async function up (utils: {
                    transaction: Sequelize.Transaction
                    queryInterface: Sequelize.QueryInterface
                    sequelize: Sequelize.Sequelize
                    db: any
                  Severity: Major
                  Found in server/core/initializers/migrations/0595-remote-url.ts - About 3 hrs to fix

                    VideoAddToPlaylistComponent has 29 functions (exceeds 20 allowed). Consider refactoring.
                    Open

                    @Component({
                      selector: 'my-video-add-to-playlist',
                      styleUrls: [ './video-add-to-playlist.component.scss' ],
                      templateUrl: './video-add-to-playlist.component.html',
                      changeDetection: ChangeDetectionStrategy.OnPush,

                      File local-video-viewer.ts has 312 lines of code (exceeds 250 allowed). Consider refactoring.
                      Open

                      import { QueryTypes } from 'sequelize'
                      import { AllowNull, BelongsTo, Column, CreatedAt, DataType, Default, ForeignKey, HasMany, IsUUID, Table } from 'sequelize-typescript'
                      import { getActivityStreamDuration } from '@server/lib/activitypub/activity.js'
                      import { buildGroupByAndBoundaries } from '@server/lib/timeserie.js'
                      import { MLocalVideoViewer, MLocalVideoViewerWithWatchSections, MVideo } from '@server/types/models/index.js'
                      Severity: Minor
                      Found in server/core/models/view/local-video-viewer.ts - About 3 hrs to fix

                        File thumbnail.ts has 312 lines of code (exceeds 250 allowed). Consider refactoring.
                        Open

                        import { ThumbnailType, ThumbnailType_Type, VideoFileStream } from '@peertube/peertube-models'
                        import { generateThumbnailFromVideo } from '@server/helpers/ffmpeg/ffmpeg-image.js'
                        import { logger, loggerTagsFactory } from '@server/helpers/logger.js'
                        import Bluebird from 'bluebird'
                        import { FfprobeData } from 'fluent-ffmpeg'
                        Severity: Minor
                        Found in server/core/lib/thumbnail.ts - About 3 hrs to fix

                          File user-list.component.ts has 312 lines of code (exceeds 250 allowed). Consider refactoring.
                          Open

                          import { DatePipe, NgClass, NgIf } from '@angular/common'
                          import { Component, OnInit, ViewChild } from '@angular/core'
                          import { FormsModule } from '@angular/forms'
                          import { ActivatedRoute, Router, RouterLink } from '@angular/router'
                          import { AuthService, ConfirmService, LocalStorageService, Notifier, RestPagination, RestTable } from '@app/core'
                          Severity: Minor
                          Found in client/src/app/+admin/overview/users/user-list/user-list.component.ts - About 3 hrs to fix

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

                            import debug from 'debug'
                            import { UploadState, UploadxService } from 'ngx-uploadx'
                            import { of, Subject, Subscription } from 'rxjs'
                            import { catchError, map, switchMap } from 'rxjs/operators'
                            import { SelectChannelItem } from 'src/types/select-options-item.model'
                            Severity: Minor
                            Found in client/src/app/+videos/+video-edit/video-update.component.ts - About 3 hrs to fix

                              File signup.e2e-spec.ts has 312 lines of code (exceeds 250 allowed). Consider refactoring.
                              Open

                              import { AdminConfigPage } from '../po/admin-config.po'
                              import { AdminRegistrationPage } from '../po/admin-registration.po'
                              import { LoginPage } from '../po/login.po'
                              import { SignupPage } from '../po/signup.po'
                              import {
                              Severity: Minor
                              Found in client/e2e/src/suites-local/signup.e2e-spec.ts - About 3 hrs to fix

                                File download.ts has 311 lines of code (exceeds 250 allowed). Consider refactoring.
                                Open

                                import { forceNumber, maxBy } from '@peertube/peertube-core-utils'
                                import { FileStorage, HttpStatusCode, VideoResolution, VideoStreamingPlaylistType } from '@peertube/peertube-models'
                                import { exists } from '@server/helpers/custom-validators/misc.js'
                                import { logger, loggerTagsFactory } from '@server/helpers/logger.js'
                                import { CONFIG } from '@server/initializers/config.js'
                                Severity: Minor
                                Found in server/core/controllers/download.ts - About 3 hrs to fix

                                  Function listForApi has 86 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                    static listForApi (options: {
                                      start: number
                                      count: number
                                      sort: string
                                      target: VideoRedundanciesTarget
                                  Severity: Major
                                  Found in server/core/models/redundancy/video-redundancy.ts - About 3 hrs to fix

                                    Function processGenerateStoryboard has 86 lines of code (exceeds 25 allowed). Consider refactoring.
                                    Open

                                    async function processGenerateStoryboard (job: Job): Promise<void> {
                                      const payload = job.data as GenerateStoryboardPayload
                                      const lTags = lTagsBase(payload.videoUUID)
                                    
                                      logger.info('Processing generate storyboard of %s in job %s.', payload.videoUUID, job.id, lTags)
                                    Severity: Major
                                    Found in server/core/lib/job-queue/handlers/generate-storyboard.ts - About 3 hrs to fix

                                      Function createOptimizeOrMergeAudioJobs has 86 lines of code (exceeds 25 allowed). Consider refactoring.
                                      Open

                                        async createOptimizeOrMergeAudioJobs (options: {
                                          video: MVideoFullLight
                                          videoFile: MVideoFile
                                          isNewVideo: boolean
                                          user: MUserId
                                        Severity
                                        Category
                                        Status
                                        Source
                                        Language