Chocobozzz/PeerTube

View on GitHub

Showing 3,313 of 3,313 total issues

Function buildPlayerIfNeeded has 30 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  private async buildPlayerIfNeeded () {
    if (this.player) return

    await TranslationsManager.loadLocaleInVideoJS(this.options.serverUrl, this.options.language, videojs)

Severity: Minor
Found in client/src/assets/player/peertube-player.ts - About 1 hr to fix

    Function initHotkeys has 30 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      private initHotkeys () {
        this.hotkeysService.add([
          new Hotkey([ 'Shift+/', 's' ], () => {
            document.getElementById('search-video').focus()
            return false
    Severity: Minor
    Found in client/src/app/app.component.ts - About 1 hr to fix

      Function autoFollow has 30 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        private async autoFollow () {
          if (CONFIG.FOLLOWINGS.INSTANCE.AUTO_FOLLOW_INDEX.ENABLED === false) return
      
          const indexUrl = CONFIG.FOLLOWINGS.INSTANCE.AUTO_FOLLOW_INDEX.INDEX_URL
      
      
      Severity: Minor
      Found in server/core/lib/schedulers/auto-follow-index-instances.ts - About 1 hr to fix

        Function listRunnerJobs has 30 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          listRunnerJobs (options: {
            pagination: RestPagination
            sort: SortMeta
            search?: string
          }) {
        Severity: Minor
        Found in client/src/app/+admin/system/runners/runner.service.ts - About 1 hr to fix

          Function refreshVideoIfNeeded has 30 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          async function refreshVideoIfNeeded (options: {
            video: MVideoThumbnail
            fetchedType: VideoLoadByUrlType
            syncParam: SyncParam
          }): Promise<MVideoThumbnail> {
          Severity: Minor
          Found in server/core/lib/activitypub/videos/refresh.ts - About 1 hr to fix

            Function generateCaption has 30 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              private generateCaption (videos: Video[]) {
                this.videoCaptionService.generateCaption({ videos })
                  .subscribe({
                    next: result => {
                      if (result.success) {
            Severity: Minor
            Found in client/src/app/+admin/overview/videos/video-list.component.ts - About 1 hr to fix

              Function requestNewArchive has 30 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                requestNewArchive () {
                  if (this.requestingArchive) return
                  this.requestingArchive = true
              
                  let baseObs = of<any>(true)

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

                  ngOnInit () {
                    this.buildActions()
                
                    this.user = this.authService.getUser()
                
                
                Severity: Minor
                Found in client/src/app/+my-library/my-videos/my-videos.component.ts - About 1 hr to fix

                  Function formatUser has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    private formatUser (user: UserServerModel, translations: { [ id: string ]: string } = {}) {
                      let videoQuota
                      if (user.videoQuota === -1) {
                        videoQuota = '∞'
                      } else {
                  Severity: Minor
                  Found in client/src/app/shared/shared-users/user-admin.service.ts - About 1 hr to fix

                    Function before has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        before: function () {
                          require('./src/commands/upload')
                    
                          // Force keep alive: https://www.browserstack.com/docs/automate/selenium/error-codes/keep-alive-not-used#Node_JS
                          const http = require('http')
                    Severity: Minor
                    Found in client/e2e/wdio.browserstack.conf.ts - About 1 hr to fix

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

                          if (this.hasRight(UserRight.MANAGE_ACCOUNTS_BLOCKLIST)) {
                            moderationItems.children.push({
                              label: $localize`Muted accounts`,
                              routerLink: '/admin/moderation/blocklist/accounts',
                              iconName: 'user-x'
                      Severity: Major
                      Found in client/src/app/+admin/admin.component.ts and 10 other locations - About 1 hr to fix
                      client/src/app/+admin/admin.component.ts on lines 53..59
                      client/src/app/+admin/admin.component.ts on lines 72..78
                      client/src/app/+admin/admin.component.ts on lines 116..122
                      client/src/app/+admin/admin.component.ts on lines 124..130
                      client/src/app/+admin/admin.component.ts on lines 132..138
                      client/src/app/+admin/admin.component.ts on lines 148..154
                      client/src/app/+admin/admin.component.ts on lines 156..162
                      client/src/app/+admin/admin.component.ts on lines 199..205
                      client/src/app/+admin/admin.component.ts on lines 207..213
                      client/src/app/+admin/admin.component.ts on lines 215..221

                      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 59.

                      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 11 locations. Consider refactoring.
                      Open

                          if (this.hasRight(UserRight.MANAGE_DEBUG)) {
                            systemItems.children.push({
                              label: $localize`Debug`,
                              iconName: 'cog',
                              routerLink: '/admin/system/debug'
                      Severity: Major
                      Found in client/src/app/+admin/admin.component.ts and 10 other locations - About 1 hr to fix
                      client/src/app/+admin/admin.component.ts on lines 53..59
                      client/src/app/+admin/admin.component.ts on lines 72..78
                      client/src/app/+admin/admin.component.ts on lines 116..122
                      client/src/app/+admin/admin.component.ts on lines 124..130
                      client/src/app/+admin/admin.component.ts on lines 132..138
                      client/src/app/+admin/admin.component.ts on lines 140..146
                      client/src/app/+admin/admin.component.ts on lines 148..154
                      client/src/app/+admin/admin.component.ts on lines 156..162
                      client/src/app/+admin/admin.component.ts on lines 199..205
                      client/src/app/+admin/admin.component.ts on lines 207..213

                      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 59.

                      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 9 locations. Consider refactoring.
                      Open

                        constructor (
                          private videoChannelsSyncService: VideoChannelSyncService,
                          private serverService: ServerService,
                          private notifier: Notifier,
                          private authService: AuthService,
                      client/src/app/+admin/moderation/registration-list/process-registration-modal.component.ts on lines 32..40
                      client/src/app/+my-library/my-ownership/my-accept-ownership/my-accept-ownership.component.ts on lines 33..41
                      client/src/app/+my-library/my-videos/modals/video-change-ownership.component.ts on lines 30..38
                      client/src/app/+reset-password/reset-password.component.ts on lines 21..29
                      client/src/app/+signup/+verify-account/verify-account-ask-send-email/verify-account-ask-send-email.component.ts on lines 21..29
                      client/src/app/shared/shared-moderation/user-ban-modal.component.ts on lines 34..42
                      client/src/app/shared/shared-user-settings/user-video-settings.component.ts on lines 42..50
                      client/src/app/shared/shared-video-playlist/video-add-to-playlist.component.ts on lines 78..86

                      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 59.

                      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 11 locations. Consider refactoring.
                      Open

                          if (this.hasRight(UserRight.SEE_ALL_COMMENTS)) {
                            overviewItems.children.push({
                              label: $localize`Comments`,
                              routerLink: '/admin/comments',
                              iconName: 'message-circle'
                      Severity: Major
                      Found in client/src/app/+admin/admin.component.ts and 10 other locations - About 1 hr to fix
                      client/src/app/+admin/admin.component.ts on lines 53..59
                      client/src/app/+admin/admin.component.ts on lines 116..122
                      client/src/app/+admin/admin.component.ts on lines 124..130
                      client/src/app/+admin/admin.component.ts on lines 132..138
                      client/src/app/+admin/admin.component.ts on lines 140..146
                      client/src/app/+admin/admin.component.ts on lines 148..154
                      client/src/app/+admin/admin.component.ts on lines 156..162
                      client/src/app/+admin/admin.component.ts on lines 199..205
                      client/src/app/+admin/admin.component.ts on lines 207..213
                      client/src/app/+admin/admin.component.ts on lines 215..221

                      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 59.

                      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 11 locations. Consider refactoring.
                      Open

                          if (this.hasRight(UserRight.MANAGE_JOBS)) {
                            systemItems.children.push({
                              label: $localize`Local jobs`,
                              iconName: 'circle-tick',
                              routerLink: '/admin/system/jobs'
                      Severity: Major
                      Found in client/src/app/+admin/admin.component.ts and 10 other locations - About 1 hr to fix
                      client/src/app/+admin/admin.component.ts on lines 53..59
                      client/src/app/+admin/admin.component.ts on lines 72..78
                      client/src/app/+admin/admin.component.ts on lines 116..122
                      client/src/app/+admin/admin.component.ts on lines 124..130
                      client/src/app/+admin/admin.component.ts on lines 132..138
                      client/src/app/+admin/admin.component.ts on lines 140..146
                      client/src/app/+admin/admin.component.ts on lines 148..154
                      client/src/app/+admin/admin.component.ts on lines 156..162
                      client/src/app/+admin/admin.component.ts on lines 207..213
                      client/src/app/+admin/admin.component.ts on lines 215..221

                      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 59.

                      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 9 locations. Consider refactoring.
                      Open

                        constructor (
                          protected formReactiveService: FormReactiveService,
                          private server: ServerService,
                          private modalService: NgbModal,
                          private notifier: Notifier,
                      client/src/app/+my-library/my-ownership/my-accept-ownership/my-accept-ownership.component.ts on lines 33..41
                      client/src/app/+my-library/my-video-channel-syncs/my-video-channel-syncs.component.ts on lines 53..61
                      client/src/app/+my-library/my-videos/modals/video-change-ownership.component.ts on lines 30..38
                      client/src/app/+reset-password/reset-password.component.ts on lines 21..29
                      client/src/app/+signup/+verify-account/verify-account-ask-send-email/verify-account-ask-send-email.component.ts on lines 21..29
                      client/src/app/shared/shared-moderation/user-ban-modal.component.ts on lines 34..42
                      client/src/app/shared/shared-user-settings/user-video-settings.component.ts on lines 42..50
                      client/src/app/shared/shared-video-playlist/video-add-to-playlist.component.ts on lines 78..86

                      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 59.

                      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 11 locations. Consider refactoring.
                      Open

                          if (this.hasRight(UserRight.MANAGE_ABUSES)) {
                            moderationItems.children.push({
                              label: $localize`Reports`,
                              routerLink: '/admin/moderation/abuses/list',
                              iconName: 'flag'
                      Severity: Major
                      Found in client/src/app/+admin/admin.component.ts and 10 other locations - About 1 hr to fix
                      client/src/app/+admin/admin.component.ts on lines 53..59
                      client/src/app/+admin/admin.component.ts on lines 72..78
                      client/src/app/+admin/admin.component.ts on lines 116..122
                      client/src/app/+admin/admin.component.ts on lines 132..138
                      client/src/app/+admin/admin.component.ts on lines 140..146
                      client/src/app/+admin/admin.component.ts on lines 148..154
                      client/src/app/+admin/admin.component.ts on lines 156..162
                      client/src/app/+admin/admin.component.ts on lines 199..205
                      client/src/app/+admin/admin.component.ts on lines 207..213
                      client/src/app/+admin/admin.component.ts on lines 215..221

                      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 59.

                      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 9 locations. Consider refactoring.
                      Open

                        constructor (
                          protected formReactiveService: FormReactiveService,
                          private videoOwnershipService: VideoOwnershipService,
                          private notifier: Notifier,
                          private authService: AuthService,
                      client/src/app/+admin/moderation/registration-list/process-registration-modal.component.ts on lines 32..40
                      client/src/app/+my-library/my-video-channel-syncs/my-video-channel-syncs.component.ts on lines 53..61
                      client/src/app/+my-library/my-videos/modals/video-change-ownership.component.ts on lines 30..38
                      client/src/app/+reset-password/reset-password.component.ts on lines 21..29
                      client/src/app/+signup/+verify-account/verify-account-ask-send-email/verify-account-ask-send-email.component.ts on lines 21..29
                      client/src/app/shared/shared-moderation/user-ban-modal.component.ts on lines 34..42
                      client/src/app/shared/shared-user-settings/user-video-settings.component.ts on lines 42..50
                      client/src/app/shared/shared-video-playlist/video-add-to-playlist.component.ts on lines 78..86

                      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 59.

                      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 11 locations. Consider refactoring.
                      Open

                          if (this.hasRight(UserRight.MANAGE_INSTANCE_WATCHED_WORDS)) {
                            moderationItems.children.push({
                              label: $localize`Watched words`,
                              routerLink: '/admin/moderation/watched-words/list',
                              iconName: 'eye-open'
                      Severity: Major
                      Found in client/src/app/+admin/admin.component.ts and 10 other locations - About 1 hr to fix
                      client/src/app/+admin/admin.component.ts on lines 53..59
                      client/src/app/+admin/admin.component.ts on lines 72..78
                      client/src/app/+admin/admin.component.ts on lines 116..122
                      client/src/app/+admin/admin.component.ts on lines 124..130
                      client/src/app/+admin/admin.component.ts on lines 132..138
                      client/src/app/+admin/admin.component.ts on lines 140..146
                      client/src/app/+admin/admin.component.ts on lines 148..154
                      client/src/app/+admin/admin.component.ts on lines 199..205
                      client/src/app/+admin/admin.component.ts on lines 207..213
                      client/src/app/+admin/admin.component.ts on lines 215..221

                      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 59.

                      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 11 locations. Consider refactoring.
                      Open

                          if (this.hasRight(UserRight.MANAGE_VIDEO_BLACKLIST)) {
                            moderationItems.children.push({
                              label: $localize`Video blocks`,
                              routerLink: '/admin/moderation/video-blocks/list',
                              iconName: 'cross'
                      Severity: Major
                      Found in client/src/app/+admin/admin.component.ts and 10 other locations - About 1 hr to fix
                      client/src/app/+admin/admin.component.ts on lines 53..59
                      client/src/app/+admin/admin.component.ts on lines 72..78
                      client/src/app/+admin/admin.component.ts on lines 116..122
                      client/src/app/+admin/admin.component.ts on lines 124..130
                      client/src/app/+admin/admin.component.ts on lines 140..146
                      client/src/app/+admin/admin.component.ts on lines 148..154
                      client/src/app/+admin/admin.component.ts on lines 156..162
                      client/src/app/+admin/admin.component.ts on lines 199..205
                      client/src/app/+admin/admin.component.ts on lines 207..213
                      client/src/app/+admin/admin.component.ts on lines 215..221

                      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 59.

                      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