Chocobozzz/PeerTube

View on GitHub
apps/peertube-runner/src/server/process/shared/process-live.ts

Summary

Maintainability
C
1 day
Test Coverage

Function process has 70 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  process () {
    const job = this.options.job
    const payload = job.payload

    return new Promise<void>(async (res, rej) => {
Severity: Major
Found in apps/peertube-runner/src/server/process/shared/process-live.ts - About 2 hrs to fix

    File process-live.ts has 277 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    import { wait } from '@peertube/peertube-core-utils'
    import {
      ffprobePromise,
      getVideoStreamBitrate,
      getVideoStreamDimensionsInfo,
    Severity: Minor
    Found in apps/peertube-runner/src/server/process/shared/process-live.ts - About 2 hrs to fix

      Function sendPendingChunks has 33 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        private async sendPendingChunks (): Promise<any> {
          if (this.ended) return Promise.resolve()
      
          const parallelPromises: Promise<any>[] = []
      
      
      Severity: Minor
      Found in apps/peertube-runner/src/server/process/shared/process-live.ts - About 1 hr to fix

        Function sendPendingChunks has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
        Open

          private async sendPendingChunks (): Promise<any> {
            if (this.ended) return Promise.resolve()
        
            const parallelPromises: Promise<any>[] = []
        
        
        Severity: Minor
        Found in apps/peertube-runner/src/server/process/shared/process-live.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 updateWithRetry has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

          private async updateWithRetry (payload: CustomLiveRTMPHLSTranscodingUpdatePayload, currentTry = 1): Promise<any> {
            if (this.ended || this.errored) return
        
            try {
              await this.options.server.runnerJobs.update({
        Severity: Minor
        Found in apps/peertube-runner/src/server/process/shared/process-live.ts - About 45 mins 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

        There are no issues that match your filters.

        Category
        Status