Chocobozzz/PeerTube

View on GitHub

Showing 1,292 of 3,313 total issues

Function buildLowerResolutionJobPayloads has 45 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  private async buildLowerResolutionJobPayloads (options: {
    video: MVideoFullLight
    inputVideoResolution: number
    inputVideoFPS: number
    hasAudio: boolean

    Function init has 45 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      private async init () {
        // Before HTML rendering restore line feed for markdown list compatibility
        const commentText = this.comment.text.replace(/<br.?\/?>/g, '\r\n')
        const html = await this.markdownService.textMarkdownToHTML({ markdown: commentText, withHtml: true, withEmoji: true })
        this.sanitizedCommentHTML = this.markdownService.processVideoTimestamps(this.video.shortUUID, html)

      Function ngOnInit has 45 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        ngOnInit () {
          this.video = this.route.snapshot.data.video
      
          this.availableCharts = [
            {
      Severity: Minor
      Found in client/src/app/+stats/video/video-stats.component.ts - About 1 hr to fix

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

        async function run () {
          await initDatabaseModels(true)
        
          displayPeerTubeMustBeStoppedWarning()
        
        
        Severity: Minor
        Found in server/scripts/update-object-storage-url.ts - About 1 hr to fix

          Function getTimeserieStats has 44 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            static async getTimeserieStats (options: {
              video: MVideo
              metric: VideoStatsTimeserieMetric
              startDate: string
              endDate: string
          Severity: Minor
          Found in server/core/models/view/local-video-viewer.ts - About 1 hr to fix

            Function reportAbuse has 44 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            async function reportAbuse (req: express.Request, res: express.Response) {
              const videoInstance = res.locals.videoAll
              const commentInstance = res.locals.videoCommentFull
              const accountInstance = res.locals.account
            
            
            Severity: Minor
            Found in server/core/controllers/api/abuse.ts - About 1 hr to fix

              Function moveToJob has 44 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              export async function moveToJob (options: {
                jobId: string
                videoUUID: string
                loggerTags: (number | string)[]
              
              
              Severity: Minor
              Found in server/core/lib/job-queue/handlers/shared/move-video.ts - About 1 hr to fix

                Function install has 44 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  async install (options: {
                    toInstall: string
                    version?: string
                    fromDisk?: boolean // default false
                    register?: boolean // default true
                Severity: Minor
                Found in server/core/lib/plugins/plugin-manager.ts - About 1 hr to fix

                  Function addVideoJobsAfterCreation has 44 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  export async function addVideoJobsAfterCreation (options: {
                    video: MVideo
                    videoFile: MVideoFile
                    generateTranscription: boolean
                  }) {
                  Severity: Minor
                  Found in server/core/lib/video-jobs.ts - About 1 hr to fix

                    Function create has 44 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      async create (options: CreateOptions) {
                        const { video, priority, tasks } = options
                    
                        const jobUUID = buildUUID()
                        const { separatedAudioFile } = video.getMaxQualityAudioAndVideoFiles()

                      Function buildOverallStatCard has 44 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                        private buildOverallStatCard (overallStats: VideoStatsOverall) {
                          this.globalStatsCards = [
                            {
                              label: $localize`Views`,
                              value: this.numberFormatter.transform(this.video.views),
                      Severity: Minor
                      Found in client/src/app/+stats/video/video-stats.component.ts - About 1 hr to fix

                        Function processWebVideoTranscoding has 44 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        export async function processWebVideoTranscoding (options: ProcessOptions<RunnerJobVODWebVideoTranscodingPayload>) {
                          const { server, job, runnerToken } = options
                        
                          const payload = job.payload
                        
                        
                        Severity: Minor
                        Found in apps/peertube-runner/src/server/process/shared/process-vod.ts - About 1 hr to fix

                          Function checkLocalRedundancyConfig has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                          Open

                          function checkLocalRedundancyConfig () {
                            const redundancyVideos = CONFIG.REDUNDANCY.VIDEOS.STRATEGIES
                          
                            if (isArray(redundancyVideos)) {
                              const available = [ 'most-views', 'trending', 'recently-added' ]
                          Severity: Minor
                          Found in server/core/initializers/checker-after-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 buildModerationHelpers has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                          Open

                          function buildModerationHelpers () {
                            return {
                              blockServer: async (options: { byAccountId: number, hostToBlock: string }) => {
                                const serverToBlock = await ServerModel.loadOrCreateByHost(options.hostToBlock)
                                const user = await UserModel.loadByAccountId(options.byAccountId)
                          Severity: Minor
                          Found in server/core/lib/plugins/plugin-helpers-builder.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 sanitize has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                          Open

                            protected sanitize (o: ImportObject) {
                              if (!isVideoPlaylistTypeValid(o.type)) return undefined
                              if (!isVideoPlaylistNameValid(o.displayName)) return undefined
                              if (!isVideoPlaylistPrivacyValid(o.privacy)) return undefined
                              if (!isArray(o.elements)) return undefined

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

                            protected async importObject (videoImportData: SanitizedObject) {
                              const videoFilePath = !videoImportData.isLive
                                ? this.getSafeArchivePathOrThrow(videoImportData.archiveFiles.videoFile)
                                : null
                          
                          
                          Severity: Minor
                          Found in server/core/lib/user-import-export/importers/videos-importer.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 processActivities has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                          Open

                          export async function processActivities (
                            activities: Activity[],
                            options: {
                              signatureActor?: MActorSignature
                              inboxActor?: MActorDefault
                          Severity: Minor
                          Found in server/core/lib/activitypub/process/process.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 getOrCreateAPVideo has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                          Open

                          export async function getOrCreateAPVideo (
                            options: GetVideoParamAll | GetVideoParamImmutable | GetVideoParamOther
                          ): GetVideoResult<MVideoAccountLightBlacklistAllFiles | MVideoThumbnailBlacklist | MVideoImmutable> {
                            // Default params
                            const syncParam = options.syncParam || { rates: true, shares: true, comments: true, refreshVideo: false }
                          Severity: Minor
                          Found in server/core/lib/activitypub/videos/get.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 buildActions has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                          Open

                            private buildActions () {
                              this.videoActions = [
                                [
                                  {
                                    label: $localize`Save to playlist`,

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

                            private buildTitle (scope: VideoFilterScope = this.defaultScope, sort: VideoSortField = this.defaultSort) {
                              const sanitizedSort = this.getSanitizedSort(sort)
                          
                              if (scope === 'local') {
                                this.title = $localize`Local videos`

                          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