Chocobozzz/PeerTube

View on GitHub

Showing 1,292 of 3,313 total issues

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

async function prepare () {
  const config = {
    rates_limit: {
      api: {
        max: 5_000_000
Severity: Major
Found in scripts/benchmark.ts - About 3 hrs to fix

    File checker-after-init.ts has 296 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    import { uniqify } from '@peertube/peertube-core-utils'
    import { getFFmpegVersion } from '@peertube/peertube-ffmpeg'
    import { VideoRedundancyConfigFilter } from '@peertube/peertube-models'
    import { isProdInstance } from '@peertube/peertube-node-utils'
    import config from 'config'
    Severity: Minor
    Found in server/core/initializers/checker-after-init.ts - About 3 hrs to fix

      Function createModel has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
      Open

        private createModel (json: any, modelName: string, keyPath: string) {
          if (!json.id) return { created: false, model: null }
      
          const { created, model } = this.createOrFindModel(json, modelName, keyPath)
      
      
      Severity: Minor
      Found in server/core/models/shared/model-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 focus has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
      Open

        focus (item = 0): void {
          const children = this.children().slice()
          const haveTitle = children.length && children[0].hasClass('vjs-menu-title')
      
          if (haveTitle) {
      Severity: Minor
      Found in client/src/assets/player/shared/settings/menu-focus-fixed.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 parseQueryStringFilter has a Cognitive Complexity of 22 (exceeds 5 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 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 getCommonVideoEditAttributes has 77 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      export function getCommonVideoEditAttributes () {
        return [
          body('thumbnailfile')
            .custom((value, { req }) => isVideoImageValid(req.files, 'thumbnailfile')).withMessage(
              'This thumbnail file is not supported or too large. Please, make sure it is of the following type: ' +
      Severity: Major
      Found in server/core/middlewares/validators/videos/videos.ts - About 3 hrs to fix

        File app.component.ts has 295 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        import { delay, forkJoin } from 'rxjs'
        import { filter, first, map } from 'rxjs/operators'
        import { DOCUMENT, getLocaleDirection, PlatformLocation, NgIf, NgClass } from '@angular/common'
        import { AfterViewInit, Component, Inject, LOCALE_ID, OnInit, ViewChild } from '@angular/core'
        import { DomSanitizer, SafeHtml } from '@angular/platform-browser'
        Severity: Minor
        Found in client/src/app/app.component.ts - About 3 hrs to fix

          Function buildVideoPlayer has 77 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            private async buildVideoPlayer (options: {
              videoResponse: Response
              storyboardsPromise: Promise<Response>
              captionsPromise: Promise<Response>
              chaptersPromise: Promise<Response>
          Severity: Major
          Found in client/src/standalone/videos/embed.ts - About 3 hrs to fix

            File search.component.ts has 295 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            import { NgFor, NgIf, NgTemplateOutlet } from '@angular/common'
            import { Component, OnDestroy, OnInit } from '@angular/core'
            import { ActivatedRoute, Router, RouterLink } from '@angular/router'
            import { AuthService, HooksService, MetaService, Notifier, ServerService, User, UserService } from '@app/core'
            import { immutableAssign, SimpleMemoize } from '@app/helpers'
            Severity: Minor
            Found in client/src/app/+search/search.component.ts - About 3 hrs to fix

              File video-live-ending.ts has 294 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              import { ffprobePromise, getAudioStream, getVideoStreamDimensionsInfo, getVideoStreamFPS } from '@peertube/peertube-ffmpeg'
              import { ThumbnailType, VideoFileStream, VideoLiveEndingPayload, VideoState } from '@peertube/peertube-models'
              import { peertubeTruncate } from '@server/helpers/core-utils.js'
              import { CONSTRAINTS_FIELDS } from '@server/initializers/constants.js'
              import { getLocalVideoActivityPubUrl } from '@server/lib/activitypub/url.js'
              Severity: Minor
              Found in server/core/lib/job-queue/handlers/video-live-ending.ts - About 3 hrs to fix

                File server-config.model.ts has 294 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                import { ActorImage, VideoCommentPolicyType } from '../index.js'
                import { ClientScriptJSON } from '../plugins/plugin-package-json.model.js'
                import { NSFWPolicyType } from '../videos/nsfw-policy.type.js'
                import { VideoPrivacyType } from '../videos/video-privacy.enum.js'
                import { BroadcastMessageLevel } from './broadcast-message-level.type.js'
                Severity: Minor
                Found in packages/models/src/server/server-config.model.ts - About 3 hrs to fix

                  Function buildHandlers has 76 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    private buildHandlers () {
                      const handlers: KeyHandler[] = [
                        // Play
                        {
                          accept: e => (e.key === ' ' || e.key === 'MediaPlayPause'),
                  Severity: Major
                  Found in client/src/assets/player/shared/hotkeys/peertube-hotkeys-plugin.ts - About 3 hrs to fix

                    File emailer.ts has 293 lines of code (exceeds 250 allowed). Consider refactoring.
                    Open

                    import { arrayify } from '@peertube/peertube-core-utils'
                    import { EmailPayload, SendEmailDefaultOptions, UserExportState, UserRegistrationState } from '@peertube/peertube-models'
                    import { isTestOrDevInstance, root } from '@peertube/peertube-node-utils'
                    import { UserModel } from '@server/models/user/user.js'
                    import { readFileSync } from 'fs'
                    Severity: Minor
                    Found in server/core/lib/emailer.ts - About 3 hrs to fix

                      AbstractVideoQueryBuilder has 26 functions (exceeds 20 allowed). Consider refactoring.
                      Open

                      export class AbstractVideoQueryBuilder extends AbstractRunQuery {
                        protected attributes: { [key: string]: string } = {}
                      
                        protected joins = ''
                        protected where: string

                        VideoTableAttributes has 26 functions (exceeds 20 allowed). Consider refactoring.
                        Open

                        export class VideoTableAttributes {
                        
                          constructor (private readonly mode: 'get' | 'list') {
                        
                          }
                        Severity: Minor
                        Found in server/core/models/video/sql/video/shared/video-table-attributes.ts - About 3 hrs to fix

                          PeerTubePlugin has 26 functions (exceeds 20 allowed). Consider refactoring.
                          Open

                          class PeerTubePlugin extends Plugin {
                            declare private readonly videoViewUrl: () => string
                            declare private readonly authorizationHeader: () => string
                            declare private readonly initialInactivityTimeout: number
                          
                          
                          Severity: Minor
                          Found in client/src/assets/player/shared/peertube/peertube-plugin.ts - About 3 hrs to fix

                            VideoMiniatureComponent has 26 functions (exceeds 20 allowed). Consider refactoring.
                            Open

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

                              PlayerOptionsBuilder has 26 functions (exceeds 20 allowed). Consider refactoring.
                              Open

                              export class PlayerOptionsBuilder {
                                private autoplay: boolean
                              
                                private controls: boolean
                                private controlBar: boolean
                              Severity: Minor
                              Found in client/src/standalone/videos/shared/player-options-builder.ts - About 3 hrs to fix

                                AbuseListTableComponent has 26 functions (exceeds 20 allowed). Consider refactoring.
                                Open

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

                                  VideoWatchPage has 26 functions (exceeds 20 allowed). Consider refactoring.
                                  Open

                                  export class VideoWatchPage {
                                  
                                    constructor (private isMobileDevice: boolean, private isSafari: boolean) {
                                  
                                    }
                                  Severity: Minor
                                  Found in client/e2e/src/po/video-watch.po.ts - About 3 hrs to fix
                                    Severity
                                    Category
                                    Status
                                    Source
                                    Language