Chocobozzz/PeerTube

View on GitHub

Showing 1,292 of 3,313 total issues

Function doRefresh has 28 lines of code (exceeds 25 allowed). Consider refactoring.
Open

async function doRefresh <T extends MActorFull | MActorAccountChannelId> (options: RefreshOptions<T>): RefreshResult <MActorFull> {
  const { actor: actorArg, fetchedType } = options

  // We need more attributes
  const actor = fetchedType === 'all'
Severity: Minor
Found in server/core/lib/activitypub/actors/refresh.ts - About 1 hr to fix

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

      ngOnInit () {
        this.confirmService.showConfirm.subscribe(
          payload => {
            // Reinit fields
            this.title = ''
    Severity: Minor
    Found in client/src/app/modal/confirm.component.ts - About 1 hr to fix

      Function generateCaptionOfSpecificVideo has 28 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        private generateCaptionOfSpecificVideo (options: {
          video: Video
          forceTranscription: boolean
        }): Observable<'success' | 'already-has-captions' | 'already-being-transcribed'> {
          const { video, forceTranscription } = options

        Function checkTranscodingFields has 28 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          private checkTranscodingFields () {
            const transcodingControl = this.form.get('transcoding.enabled')
            const videoStudioControl = this.form.get('videoStudio.enabled')
            const hlsControl = this.form.get('transcoding.hls.enabled')
            const webVideosControl = this.form.get('transcoding.webVideos.enabled')

          Function subscribeToVideoRequests has 28 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            private subscribeToVideoRequests () {
              this.videoRequests
                .pipe(
                  concatMap(({ reset, obsHighlightedLives, obsVideos }) => {
                    return forkJoin([ obsHighlightedLives, obsVideos ])

            Function constructChannel has 28 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              private constructChannel () {
                const channel = Channel.build({ window: window.parent, origin: '*', scope: this.embed.getScope() })
            
                channel.bind('setVideoPassword', (txn, value) => this.embed.setVideoPasswordByAPI(value))
            
            
            Severity: Minor
            Found in client/src/standalone/videos/embed-api.ts - About 1 hr to fix

              Function buildElement has 28 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                async buildElement (text: string) {
                  const html = await this.markdown.customPageMarkdownToHTML({ markdown: text, additionalAllowedTags: this.getSupportedTags() })
              
                  const rootElement = document.createElement('div')
                  rootElement.innerHTML = html
              Severity: Minor
              Found in client/src/app/shared/shared-custom-markup/custom-markup.service.ts - About 1 hr to fix

                Function buildVODCommand has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  private async buildVODCommand (options: TranscodeVODOptions & {
                    videoStreamOnly?: boolean
                    canCopyAudio?: boolean
                    canCopyVideo?: boolean
                  }) {
                Severity: Minor
                Found in packages/ffmpeg/src/ffmpeg-vod.ts - About 1 hr to fix

                  Function report has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    report (options: OverrideCommandOptions & {
                      reason: string
                  
                      accountId?: number
                      videoId?: number
                  Severity: Minor
                  Found in packages/server-commands/src/moderation/abuses-command.ts - About 1 hr to fix

                    Function buildMainGetQuery has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                    Open

                      private buildMainGetQuery (options: BuildVideoGetQueryOptions) {
                        this.attributes = {
                          '"video".*': ''
                        }
                    
                    
                    Severity: Minor
                    Found in server/core/models/video/sql/video/video-model-get-query-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 parseBytes has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                    Open

                    export function parseBytes (value: string | number): number {
                      if (typeof value === 'number') return value
                      if (!isNaN(+value)) return +value
                    
                      const tgm = /^(\d+)\s*TB\s*(\d+)\s*GB\s*(\d+)\s*MB$/
                    Severity: Minor
                    Found in server/core/helpers/core-utils.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 parseDurationToMs has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                    Open

                    export function parseDurationToMs (duration: number | string): number {
                      if (duration === null) return null
                      if (typeof duration === 'number') return duration
                      if (!isNaN(+duration)) return +duration
                    
                    
                    Severity: Minor
                    Found in server/core/helpers/core-utils.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 getOutputFromFile has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                    Open

                    async function getOutputFromFile (options: {
                      path: string
                      startDate: Date
                      endDate: Date
                      level: ServerLogLevel
                    Severity: Minor
                    Found in server/core/controllers/api/server/logs.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 initReadersIfNeeded has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                    Open

                      private async initReadersIfNeeded () {
                        if (!this.countryReader) {
                          let open = true
                    
                          if (!await pathExists(this.countryDBPath)) {
                    Severity: Minor
                    Found in server/core/helpers/geo-ip.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 makeResponseCacheable has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                    Open

                      private makeResponseCacheable (res: express.Response, next: express.NextFunction, key: string, duration: number) {
                        const self = this
                    
                        res.locals.apicache = {
                          write: res.write.bind(res),
                    Severity: Minor
                    Found in server/core/middlewares/cache/shared/api-cache.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 skipProcessing has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                    Open

                    function skipProcessing (options: {
                      sourceImage: Jimp
                      newSize?: { width: number, height: number }
                      imageBytes: number
                      inputExt: string
                    Severity: Minor
                    Found in server/core/helpers/image-utils.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 buildRateLimiter has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                    Open

                    export function buildRateLimiter (options: {
                      windowMs: number
                      max: number
                      skipFailedRequests?: boolean
                    }) {
                    Severity: Minor
                    Found in server/core/middlewares/rate-limiter.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 usersCheckCurrentPasswordFactory has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                    Open

                    export const usersCheckCurrentPasswordFactory = (targetUserIdGetter: (req: express.Request) => number | string) => {
                      return [
                        body('currentPassword').optional().custom(exists),
                    
                        async (req: express.Request, res: express.Response, next: express.NextFunction) => {
                    Severity: Minor
                    Found in server/core/middlewares/validators/users/users.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 handleSession has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                    Open

                      private async handleSession (options: {
                        sessionId: string
                        inputLocalUrl: string
                        inputPublicUrl: string
                        streamKey: string
                    Severity: Minor
                    Found in server/core/lib/live/live-manager.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 getBypassFromPasswordGrant has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                    Open

                    async function getBypassFromPasswordGrant (username: string, password: string): Promise<BypassLogin> {
                      const plugins = PluginManager.Instance.getIdAndPassAuths()
                      const pluginAuths: { npmName?: string, registerAuthOptions: RegisterServerAuthPassOptions }[] = []
                    
                      for (const plugin of plugins) {
                    Severity: Minor
                    Found in server/core/lib/auth/external-auth.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

                    Severity
                    Category
                    Status
                    Source
                    Language