Chocobozzz/PeerTube

View on GitHub

Showing 3,313 of 3,313 total issues

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

  ngOnInit () {
    this.serverConfig = this.serverService.getHTMLConfig()

    this.updateForm()

Severity: Minor
Found in client/src/app/+videos/+video-edit/shared/video-edit.component.ts - About 1 hr to fix

    Function constructor has 46 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      constructor (
        private serverService: ServerService
      ) {
        this.publishedDateRanges = [
          {
    Severity: Minor
    Found in client/src/app/+search/search-filters.component.ts - About 1 hr to fix

      Function refreshFetch has 46 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        private refreshFetch (url: string, options?: RequestInit) {
          return fetch(url, options)
            .then((res: Response) => {
              if (res.status !== HttpStatusCode.UNAUTHORIZED_401) return res
      
      
      Severity: Minor
      Found in client/src/standalone/videos/shared/auth-http.ts - About 1 hr to fix

        Function getEncoderBuilderResult has 46 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          async getEncoderBuilderResult (options: EncoderOptionsBuilderParams & {
            streamType: 'video' | 'audio'
            input: string
        
            videoType: 'vod' | 'live'
        Severity: Minor
        Found in packages/ffmpeg/src/ffmpeg-command-wrapper.ts - About 1 hr to fix

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

            static async listLocalByVideoId (videoId: number): Promise<MVideoRedundancyVideo[]> {
              const actor = await getServerActor()
          
              const queryStreamingPlaylist = {
                where: {
          Severity: Minor
          Found in server/core/models/redundancy/video-redundancy.ts - About 1 hr to fix

            Function buildModerationHelpers has 45 lines of code (exceeds 25 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

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

              export function downloadPlaylistSegments (playlistUrl: string, destinationDir: string, timeout: number, bodyKBLimit: number) {
                let timer
                let remainingBodyKBLimit = bodyKBLimit
              
                logger.info('Importing HLS playlist %s', playlistUrl)
              Severity: Minor
              Found in server/core/lib/hls.ts - About 1 hr to fix

                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

                      Similar blocks of code found in 5 locations. Consider refactoring.
                      Open

                      export const CONCURRENCY_VALIDATOR: BuildFormValidator = {
                        VALIDATORS: [ Validators.required, Validators.min(1) ],
                        MESSAGES: {
                          required: $localize`Concurrency is required.`,
                          min: $localize`Concurrency must be greater or equal to 1.`
                      client/src/app/shared/form-validators/custom-config-validators.ts on lines 60..66
                      client/src/app/shared/form-validators/custom-config-validators.ts on lines 68..74
                      client/src/app/shared/form-validators/custom-config-validators.ts on lines 131..137
                      client/src/app/shared/form-validators/custom-config-validators.ts on lines 138..144

                      Duplicated Code

                      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                      Tuning

                      This issue has a mass of 71.

                      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                      Refactorings

                      Further Reading

                      Similar blocks of code found in 5 locations. Consider refactoring.
                      Open

                      export const TRANSCODING_THREADS_VALIDATOR: BuildFormValidator = {
                        VALIDATORS: [ Validators.required, Validators.min(0) ],
                        MESSAGES: {
                          required: $localize`Transcoding threads is required.`,
                          min: $localize`Transcoding threads must be greater or equal to 0.`
                      client/src/app/shared/form-validators/custom-config-validators.ts on lines 68..74
                      client/src/app/shared/form-validators/custom-config-validators.ts on lines 109..115
                      client/src/app/shared/form-validators/custom-config-validators.ts on lines 131..137
                      client/src/app/shared/form-validators/custom-config-validators.ts on lines 138..144

                      Duplicated Code

                      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                      Tuning

                      This issue has a mass of 71.

                      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                      Refactorings

                      Further Reading

                      Similar blocks of code found in 5 locations. Consider refactoring.
                      Open

                      export const EXPORT_EXPIRATION_VALIDATOR: BuildFormValidator = {
                        VALIDATORS: [ Validators.required, Validators.min(1) ],
                        MESSAGES: {
                          required: $localize`Export expiration is required.`,
                          min: $localize`Export expiration must be greater or equal to 1.`
                      client/src/app/shared/form-validators/custom-config-validators.ts on lines 60..66
                      client/src/app/shared/form-validators/custom-config-validators.ts on lines 68..74
                      client/src/app/shared/form-validators/custom-config-validators.ts on lines 109..115
                      client/src/app/shared/form-validators/custom-config-validators.ts on lines 138..144

                      Duplicated Code

                      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                      Tuning

                      This issue has a mass of 71.

                      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                      Refactorings

                      Further Reading

                      Similar blocks of code found in 5 locations. Consider refactoring.
                      Open

                      export const EXPORT_MAX_USER_VIDEO_QUOTA_VALIDATOR: BuildFormValidator = {
                        VALIDATORS: [ Validators.required, Validators.min(1) ],
                        MESSAGES: {
                          required: $localize`Max user video quota is required.`,
                          min: $localize`Max user video video quota must be greater or equal to 1.`
                      client/src/app/shared/form-validators/custom-config-validators.ts on lines 60..66
                      client/src/app/shared/form-validators/custom-config-validators.ts on lines 68..74
                      client/src/app/shared/form-validators/custom-config-validators.ts on lines 109..115
                      client/src/app/shared/form-validators/custom-config-validators.ts on lines 131..137

                      Duplicated Code

                      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                      Tuning

                      This issue has a mass of 71.

                      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                      Refactorings

                      Further Reading

                      Similar blocks of code found in 5 locations. Consider refactoring.
                      Open

                      export const TRANSCODING_MAX_FPS_VALIDATOR: BuildFormValidator = {
                        VALIDATORS: [ Validators.required, Validators.min(1) ],
                        MESSAGES: {
                          required: $localize`Transcoding max FPS is required.`,
                          min: $localize`Transcoding max FPS must be greater or equal to 1.`
                      client/src/app/shared/form-validators/custom-config-validators.ts on lines 60..66
                      client/src/app/shared/form-validators/custom-config-validators.ts on lines 109..115
                      client/src/app/shared/form-validators/custom-config-validators.ts on lines 131..137
                      client/src/app/shared/form-validators/custom-config-validators.ts on lines 138..144

                      Duplicated Code

                      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                      Tuning

                      This issue has a mass of 71.

                      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                      Refactorings

                      Further Reading

                      Identical blocks of code found in 2 locations. Consider refactoring.
                      Open

                            try {
                              const { videoChannels } = await this.server.users.getMyInfo({ token: options.token })
                              defaultChannelId = videoChannels[0].id
                            } catch (e) { /* empty */ }
                      Severity: Major
                      Found in packages/server-commands/src/videos/videos-command.ts and 1 other location - About 1 hr to fix
                      packages/server-commands/src/videos/video-imports-command.ts on lines 15..18

                      Duplicated Code

                      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                      Tuning

                      This issue has a mass of 71.

                      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                      Refactorings

                      Further Reading

                      Identical blocks of code found in 2 locations. Consider refactoring.
                      Open

                          try {
                            const { videoChannels } = await this.server.users.getMyInfo({ token: options.token })
                            defaultChannelId = videoChannels[0].id
                          } catch (e) { /* empty */ }
                      packages/server-commands/src/videos/videos-command.ts on lines 426..429

                      Duplicated Code

                      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                      Tuning

                      This issue has a mass of 71.

                      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                      Refactorings

                      Further Reading

                      Similar blocks of code found in 3 locations. Consider refactoring.
                      Open

                        constructor (
                          private authService: AuthService,
                          private notifier: Notifier,
                          private confirmService: ConfirmService,
                          private serverService: ServerService,
                      client/src/app/+my-library/my-video-playlists/my-video-playlist-elements.component.ts on lines 54..62
                      client/src/app/shared/shared-video-miniature/videos-list.component.ts on lines 148..158

                      Duplicated Code

                      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                      Tuning

                      This issue has a mass of 71.

                      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                      Refactorings

                      Further Reading

                      Similar blocks of code found in 2 locations. Consider refactoring.
                      Open

                        const options = {
                          accountId: res.locals.account.id,
                          start: req.query.start,
                          count: req.query.count,
                          sort: req.query.sort,
                      Severity: Major
                      Found in server/core/controllers/api/accounts.ts and 1 other location - About 1 hr to fix
                      server/core/lib/live/live-manager.ts on lines 47..53

                      Duplicated Code

                      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                      Tuning

                      This issue has a mass of 71.

                      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                      Refactorings

                      Further Reading

                      Similar blocks of code found in 2 locations. Consider refactoring.
                      Open

                          return VideoCommentModel.sequelize.query<{ url: string }>(query, {
                            type: QueryTypes.SELECT,
                            raw: true
                          }).then(rows => rows.map(r => r.url))
                      Severity: Major
                      Found in server/core/models/video/video-comment.ts and 1 other location - About 1 hr to fix
                      server/core/models/video/video-share.ts on lines 194..197

                      Duplicated Code

                      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                      Tuning

                      This issue has a mass of 71.

                      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                      Refactorings

                      Further Reading

                      Severity
                      Category
                      Status
                      Source
                      Language