Chocobozzz/PeerTube

View on GitHub

Showing 1,292 of 3,313 total issues

File video-api-format.ts has 271 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import { getResolutionLabel } from '@peertube/peertube-core-utils'
import {
  Video,
  VideoAdditionalAttributes,
  VideoCommentPolicy,
Severity: Minor
Found in server/core/models/video/formatter/video-api-format.ts - About 2 hrs to fix

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

    import { NgClass, NgFor, NgIf } from '@angular/common'
    import { Component, ElementRef, Input, ViewChild } from '@angular/core'
    import { FormsModule } from '@angular/forms'
    import { DomSanitizer, SafeHtml } from '@angular/platform-browser'
    import { RouterLink } from '@angular/router'
    Severity: Minor
    Found in client/src/app/shared/shared-share-modal/video-share.component.ts - About 2 hrs to fix

      SubscribeButtonComponent has 23 functions (exceeds 20 allowed). Consider refactoring.
      Open

      @Component({
        selector: 'my-subscribe-button',
        templateUrl: './subscribe-button.component.html',
        styleUrls: [ './subscribe-button.component.scss' ],
        standalone: true,

        Video has 23 functions (exceeds 20 allowed). Consider refactoring.
        Open

        export class Video implements VideoServerModel {
          byVideoChannel: string
          byAccount: string
        
          createdAt: Date
        Severity: Minor
        Found in client/src/app/shared/shared-main/video/video.model.ts - About 2 hrs to fix

          UserModerationDropdownComponent has 23 functions (exceeds 20 allowed). Consider refactoring.
          Open

          @Component({
            selector: 'my-user-moderation-dropdown',
            templateUrl: './user-moderation-dropdown.component.html',
            standalone: true,
            imports: [ NgIf, UserBanModalComponent, ActionDropdownComponent ]

            ObjectStorageCommand has 23 functions (exceeds 20 allowed). Consider refactoring.
            Open

            export class ObjectStorageCommand {
              static readonly DEFAULT_SCALEWAY_BUCKET = 'peertube-ci-test'
            
              private readonly bucketsCreated: string[] = []
              private readonly seed: number
            Severity: Minor
            Found in packages/server-commands/src/server/object-storage-command.ts - About 2 hrs to fix

              File me.ts has 270 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              import { pick } from '@peertube/peertube-core-utils'
              import {
                ActorImageType,
                UserVideoRate as FormattedUserVideoRate,
                HttpStatusCode,
              Severity: Minor
              Found in server/core/controllers/api/users/me.ts - About 2 hrs to fix

                File register-helpers.ts has 270 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                import express from 'express'
                import { Server } from 'http'
                import {
                  EncoderOptionsBuilder,
                  PluginSettingsManager,
                Severity: Minor
                Found in server/core/lib/plugins/register-helpers.ts - About 2 hrs to fix

                  Function saveReplayToExternalVideo has 62 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  async function saveReplayToExternalVideo (options: {
                    liveVideo: MVideoThumbnail
                    liveSession: MVideoLiveSession
                    publishedAt: string
                    replayDirectory: string
                  Severity: Major
                  Found in server/core/lib/job-queue/handlers/video-live-ending.ts - About 2 hrs to fix

                    Function sendCreateVideoCommentIfNeeded has 62 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    export async function sendCreateVideoCommentIfNeeded (comment: MCommentOwnerVideoReply, transaction: Transaction) {
                      const isOrigin = comment.Video.isOwned()
                    
                      if (isOrigin) {
                        const videoWithBlacklist = await VideoModel.loadWithBlacklist(comment.Video.id)
                    Severity: Major
                    Found in server/core/lib/activitypub/send/send-create.ts - About 2 hrs to fix

                      Function buildAdminInputFilter has 62 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                        buildAdminInputFilter (): AdvancedInputFilter[] {
                          return [
                            {
                              title: $localize`Video type`,
                              children: [
                      Severity: Major
                      Found in client/src/app/+admin/overview/videos/video-admin.service.ts - About 2 hrs to fix

                        File video-caption-edit-modal-content.component.ts has 269 lines of code (exceeds 250 allowed). Consider refactoring.
                        Open

                        import { NgClass, NgForOf, NgIf } from '@angular/common'
                        import { AfterViewInit, ChangeDetectorRef, Component, ElementRef, EventEmitter, Input, OnInit, Output, ViewChild } from '@angular/core'
                        import { FormsModule, ReactiveFormsModule } from '@angular/forms'
                        import { VIDEO_CAPTION_FILE_CONTENT_VALIDATOR } from '@app/shared/form-validators/video-captions-validators'
                        import { FormReactive } from '@app/shared/shared-forms/form-reactive'

                          Function processCreateAbuse has 61 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                          async function processCreateAbuse (flag: ActivityFlag, byActor: MActorSignature) {
                            const account = byActor.Account
                            if (!account) throw new Error('Cannot create abuse with the non account actor ' + byActor.url)
                          
                            const reporterAccount = await AccountModel.load(account.id)
                          Severity: Major
                          Found in server/core/lib/activitypub/process/process-flag.ts - About 2 hrs to fix

                            Function run has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
                            Open

                            async function run () {
                              await initDatabaseModels(true)
                            
                              JobQueue.Instance.init()
                            
                            
                            Severity: Minor
                            Found in server/scripts/create-move-video-storage-job.ts - About 2 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 oembedValidator has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
                            Open

                              async (req: express.Request, res: express.Response, next: express.NextFunction) => {
                                if (areValidationErrors(req, res)) return
                            
                                if (req.query.format !== undefined && req.query.format !== 'json') {
                                  return res.fail({
                            Severity: Minor
                            Found in server/core/middlewares/validators/oembed.ts - About 2 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 updateVideoViewersCount has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
                            Open

                              private async updateVideoViewersCount () {
                                if (this.processingViewerCounters) return
                                this.processingViewerCounters = true
                            
                                if (!isTestOrDevInstance()) {
                            Severity: Minor
                            Found in server/core/lib/views/shared/video-viewer-counters.ts - About 2 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 watchTSFiles has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
                            Open

                              private watchTSFiles () {
                                const startStreamDateTime = new Date().getTime()
                            
                                const addHandler = async (segmentPath: string) => {
                                  if (segmentPath.endsWith('.ts') !== true) return
                            Severity: Minor
                            Found in server/core/lib/live/shared/muxing-session.ts - About 2 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 update has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
                            Open

                              update (event?: any) {
                                // Playback rate menu button doesn't get a vjs-selected class
                                // or sets options_['selected'] on the selected playback rate.
                                // Thus we get the submenu value based on the labelEl of playbackRateMenuButton
                                if (this.subMenu.name() === 'PlaybackRateMenuButton') {
                            Severity: Minor
                            Found in client/src/assets/player/shared/settings/settings-menu-item.ts - About 2 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 constructor has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
                            Open

                              constructor (hash: UserNotificationServer, user: AuthUser) {
                                this.id = hash.id
                                this.type = hash.type
                                this.read = hash.read
                            
                            
                            Severity: Minor
                            Found in client/src/app/shared/shared-main/users/user-notification.model.ts - About 2 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 decorateVideoLink has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
                            Open

                            function decorateVideoLink (options: {
                              url: string
                            
                              startTime?: number
                              stopTime?: number
                            Severity: Minor
                            Found in packages/core-utils/src/common/url.ts - About 2 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

                            Severity
                            Category
                            Status
                            Source
                            Language