Chocobozzz/PeerTube

View on GitHub

Showing 1,292 of 3,313 total issues

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

  private async buildTranscodingStream (
    options: Pick<LiveTranscodingOptions, 'inputUrl' | 'bitrate' | 'ratio' | 'probe' | 'hasAudio' | 'splitAudioAndVideo'> & {
      command: FfmpegCommand
      resolution: number
      fps: number
Severity: Minor
Found in packages/ffmpeg/src/ffmpeg-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 buildVideoPlayer has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

  private async buildVideoPlayer (options: {
    videoResponse: Response
    storyboardsPromise: Promise<Response>
    captionsPromise: Promise<Response>
    chaptersPromise: Promise<Response>
Severity: Minor
Found in client/src/standalone/videos/embed.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 levenshteinDistance has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

export function levenshteinDistance (a: string, b: string): number {
  if (a === b) {
    return 0
  }

Severity: Minor
Found in packages/transcription-devtools/src/levenshtein.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 getQuery has 43 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    const getQuery = (forCount: boolean) => {
      const query: FindOptions = {
        offset: start,
        limit: count,
        order: getSort(sort),
Severity: Minor
Found in server/core/models/account/account-blocklist.ts - About 1 hr to fix

    Function up has 43 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    async function up (utils: {
      transaction: Sequelize.Transaction
      queryInterface: Sequelize.QueryInterface
      sequelize: Sequelize.Sequelize
    }): Promise<void> {
    Severity: Minor
    Found in server/core/initializers/migrations/0855-transcription.ts - About 1 hr to fix

      Function updateMe has 43 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      async function updateMe (req: express.Request, res: express.Response) {
        const body: UserUpdateMe = req.body
        let sendVerificationEmail = false
      
        const user = res.locals.oauth.token.user
      Severity: Minor
      Found in server/core/controllers/api/users/me.ts - About 1 hr to fix

        Function export has 43 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          async export () {
            const playlistsJSON: VideoPlaylistsExportJSON['videoPlaylists'] = []
            const staticFiles: ExportResult<VideoPlaylistsExportJSON>['staticFiles'] = []
        
            const playlists = await VideoPlaylistModel.listPlaylistForExport(this.user.Account.id)

          Function export has 43 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            async export (exportModel: MUserExport) {
              try {
                exportModel.state = UserExportState.PROCESSING
                await saveInTransactionWithRetries(exportModel)
          
          
          Severity: Minor
          Found in server/core/lib/user-import-export/user-exporter.ts - About 1 hr to fix

            Function muxToMergeVideoFiles has 43 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            export async function muxToMergeVideoFiles (options: {
              video: MVideoThumbnail
              videoFiles: MVideoFile[]
              output: Writable
            }) {
            Severity: Minor
            Found in server/core/lib/video-file.ts - About 1 hr to fix

              Function metricsInterval has 43 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  this.metricsInterval = setInterval(() => {
                    let resolution: number
                    let fps: number
              
                    if (this.player.usingPlugin('p2pMediaLoader')) {
              Severity: Minor
              Found in client/src/assets/player/shared/metrics/metrics-plugin.ts - About 1 hr to fix

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

                async function prepare () {
                  pool = new Piscina({
                    filename: join(dirname(fileURLToPath(import.meta.url)), 'simulate-many-viewers-worker.js'),
                    minThreads: 20,
                    maxThreads: 20
                Severity: Minor
                Found in scripts/simulate-many-viewers.ts - About 1 hr to fix

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

                    ngOnInit () {
                      this.initialize()
                  
                      this.bulkActions = [
                        [

                    Function getVideoAttributesFromObject has 43 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    export function getVideoAttributesFromObject (videoChannel: MChannelId, videoObject: VideoObject, to: string[] = []) {
                      const privacy = hasAPPublic(to)
                        ? VideoPrivacy.PUBLIC
                        : VideoPrivacy.UNLISTED
                    
                    

                      Function buildGroupedDateLabels has 43 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                        buildGroupedDateLabels () {
                          let currentGroupedDate: GroupDate = GroupDate.UNKNOWN
                      
                          const periods = [
                            {

                        Function onFingerSwipe has 43 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                          onFingerSwipe (direction: 'left' | 'right' | 'up' | 'down', action: () => void, removeEventOnEnd = true) {
                            let touchDownClientX: number
                            let touchDownClientY: number
                        
                            const onTouchStart = (event: TouchEvent) => {
                        Severity: Minor
                        Found in client/src/app/core/wrappers/screen.service.ts - About 1 hr to fix

                          Function reloadDataInternal has 43 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                            protected reloadDataInternal () {
                              debugLogger('Loading data.')
                          
                              const options = {
                                pagination: this.pagination,

                            Function defineUploadProgram has 43 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                            export function defineUploadProgram () {
                              const program = new Command('upload')
                                .description('Upload a video on a PeerTube instance')
                                .alias('up')
                            
                            
                            Severity: Minor
                            Found in apps/peertube-cli/src/peertube-upload.ts - About 1 hr to fix

                              Function buildConfigOverride has 43 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                private buildConfigOverride (options: RunServerOptions) {
                                  const base = options.autoEnableImportProxy !== false && process.env.YOUTUBE_DL_PROXY
                                    ? { import: { videos: { http: { proxies: [ process.env.YOUTUBE_DL_PROXY ] } } } }
                                    : {}
                              
                              
                              Severity: Minor
                              Found in packages/server-commands/src/server/server.ts - About 1 hr to fix

                                Function enableTranscoding has 43 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                  async enableTranscoding (options: {
                                    webVideo?: boolean
                                    hls?: boolean
                                    keepOriginal?: boolean
                                    splitAudioAndVideo?: boolean
                                Severity: Minor
                                Found in packages/server-commands/src/server/config-command.ts - About 1 hr to fix

                                  Function up has 42 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                  async function up (utils: {
                                    transaction: Sequelize.Transaction
                                    queryInterface: Sequelize.QueryInterface
                                    sequelize: Sequelize.Sequelize
                                    db: any
                                  Severity: Minor
                                  Found in server/core/initializers/migrations/0725-node-version.ts - About 1 hr to fix
                                    Severity
                                    Category
                                    Status
                                    Source
                                    Language