Chocobozzz/PeerTube

View on GitHub

Showing 3,313 of 3,313 total issues

Function runUserViewing has 47 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  private runUserViewing () {
    const startTime = timeToInt(this.options.startTime())

    let lastCurrentTime = startTime
    let lastViewEvent: VideoViewEvent
Severity: Minor
Found in client/src/assets/player/shared/peertube/peertube-plugin.ts - About 1 hr to fix

    Function buildPieData has 47 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      buildPieData (stats: VideosRedundancyStats) {
        if (stats.totalSize === 0) return
    
        const totalAvailable = stats.totalSize
          ? stats.totalSize - stats.totalUsed

      Function buildAdminParamsFromSearch has 47 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        private buildAdminParamsFromSearch (search: string, params: HttpParams) {
          let include = VideoInclude.BLACKLISTED |
            VideoInclude.BLOCKED_OWNER |
            VideoInclude.NOT_PUBLISHED_STATE |
            VideoInclude.FILES |
      Severity: Minor
      Found in client/src/app/+admin/overview/videos/video-admin.service.ts - About 1 hr to fix

        Function buildChartOptions has 47 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          private buildChartOptions () {
            const channelsMinimumDailyViews = Math.min(...this.videoChannels.map(v => minBy(v.viewsPerDay, 'views').views))
            const channelsMaximumDailyViews = Math.max(...this.videoChannels.map(v => maxBy(v.viewsPerDay, 'views').views))
        
            this.chartOptions = {

          Function getPrefefinedReasons has 47 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            getPrefefinedReasons (type: AbuseFilter) {
              let reasons: { id: AbusePredefinedReasonsString, label: string, description?: string, help?: string }[] = [
                {
                  id: 'violentOrRepulsive',
                  label: $localize`Violent or repulsive`,
          Severity: Minor
          Found in client/src/app/shared/shared-moderation/abuse.service.ts - About 1 hr to fix

            Function tasksBuilder has 47 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              function tasksBuilder () {
                const tasks: Promise<any>[] = []
            
                // Check if each server has pending request
                for (const server of servers) {
            Severity: Minor
            Found in packages/server-commands/src/server/jobs.ts - About 1 hr to fix

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

                      {
                        label: $localize`Delete HLS files`,
                        handler: videos => this.removeVideoFiles(videos, 'hls'),
                        isDisplayed: videos => videos.every(v => v.canRemoveAllHLSOrWebFiles(this.authUser)),
                        iconName: 'delete'
              client/src/app/+admin/overview/videos/video-list.component.ts on lines 147..152
              client/src/app/+admin/overview/videos/video-list.component.ts on lines 153..158
              client/src/app/+admin/overview/videos/video-list.component.ts on lines 165..170

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

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

                onNearOfBottom () {
                  // Last page
                  if (this.pagination.totalItems <= (this.pagination.currentPage * this.pagination.itemsPerPage)) return
              
                  this.pagination.currentPage += 1
              client/src/app/+my-library/my-follows/my-followers.component.ts on lines 61..67
              client/src/app/+my-library/my-follows/my-subscriptions.component.ts on lines 48..54
              client/src/app/+my-library/my-video-playlists/my-video-playlists.component.ts on lines 80..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 72.

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

              function isRunnerJobTranscriptionUpdatePayloadValid (
                value: RunnerJobUpdatePayload,
                type: RunnerJobType,
                _files: UploadFilesForCheck
              ) {
              Severity: Major
              Found in server/core/helpers/custom-validators/runners/jobs.ts and 3 other locations - About 1 hr to fix
              server/core/helpers/custom-validators/runners/jobs.ts on lines 138..145
              server/core/helpers/custom-validators/runners/jobs.ts on lines 147..154
              server/core/helpers/custom-validators/runners/jobs.ts on lines 199..206

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

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

                      {
                        label: $localize`Run HLS transcoding`,
                        handler: ({ video }) => this.runTranscoding(video, 'hls'),
                        isDisplayed: () => this.displayOptions.transcoding && this.canRunTranscoding(),
                        iconName: 'cog'
              client/src/app/shared/shared-video-miniature/video-actions-dropdown.component.ts on lines 545..550
              client/src/app/shared/shared-video-miniature/video-actions-dropdown.component.ts on lines 551..556
              client/src/app/shared/shared-video-miniature/video-actions-dropdown.component.ts on lines 557..562

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

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

              function isRunnerJobVideoStudioUpdatePayloadValid (
                value: RunnerJobUpdatePayload,
                type: RunnerJobType,
                _files: UploadFilesForCheck
              ) {
              Severity: Major
              Found in server/core/helpers/custom-validators/runners/jobs.ts and 3 other locations - About 1 hr to fix
              server/core/helpers/custom-validators/runners/jobs.ts on lines 138..145
              server/core/helpers/custom-validators/runners/jobs.ts on lines 147..154
              server/core/helpers/custom-validators/runners/jobs.ts on lines 156..163

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

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

                onNearOfBottom () {
                  // Last page
                  if (this.pagination.totalItems <= (this.pagination.currentPage * this.pagination.itemsPerPage)) return
              
                  this.pagination.currentPage += 1
              client/src/app/+my-library/my-follows/my-subscriptions.component.ts on lines 48..54
              client/src/app/+my-library/my-video-playlists/my-video-playlist-elements.component.ts on lines 125..131
              client/src/app/+my-library/my-video-playlists/my-video-playlists.component.ts on lines 80..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 72.

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

                      {
                        label: $localize`Delete Web Video files`,
                        handler: videos => this.removeVideoFiles(videos, 'web-videos'),
                        isDisplayed: videos => videos.every(v => v.canRemoveAllHLSOrWebFiles(this.authUser)),
                        iconName: 'delete'
              client/src/app/+admin/overview/videos/video-list.component.ts on lines 147..152
              client/src/app/+admin/overview/videos/video-list.component.ts on lines 153..158
              client/src/app/+admin/overview/videos/video-list.component.ts on lines 159..164

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

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

                      {
                        label: $localize`Run Web Video transcoding`,
                        handler: ({ video }) => this.runTranscoding(video, 'web-video'),
                        isDisplayed: () => this.displayOptions.transcoding && this.canRunTranscoding(),
                        iconName: 'cog'
              client/src/app/shared/shared-video-miniature/video-actions-dropdown.component.ts on lines 539..544
              client/src/app/shared/shared-video-miniature/video-actions-dropdown.component.ts on lines 551..556
              client/src/app/shared/shared-video-miniature/video-actions-dropdown.component.ts on lines 557..562

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

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

                      {
                        label: $localize`Delete HLS files`,
                        handler: ({ video }) => this.removeVideoFiles(video, 'hls'),
                        isDisplayed: () => this.displayOptions.removeFiles && this.canRemoveVideoFiles(),
                        iconName: 'delete'
              client/src/app/shared/shared-video-miniature/video-actions-dropdown.component.ts on lines 539..544
              client/src/app/shared/shared-video-miniature/video-actions-dropdown.component.ts on lines 545..550
              client/src/app/shared/shared-video-miniature/video-actions-dropdown.component.ts on lines 557..562

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

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

              function isRunnerJobVODHLSUpdatePayloadValid (
                value: RunnerJobUpdatePayload,
                type: RunnerJobType,
                _files: UploadFilesForCheck
              ) {
              Severity: Major
              Found in server/core/helpers/custom-validators/runners/jobs.ts and 3 other locations - About 1 hr to fix
              server/core/helpers/custom-validators/runners/jobs.ts on lines 147..154
              server/core/helpers/custom-validators/runners/jobs.ts on lines 156..163
              server/core/helpers/custom-validators/runners/jobs.ts on lines 199..206

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

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

                onNearOfBottom () {
                  // Last page
                  if (this.pagination.totalItems <= (this.pagination.currentPage * this.pagination.itemsPerPage)) return
              
                  this.pagination.currentPage += 1
              client/src/app/+my-library/my-follows/my-followers.component.ts on lines 61..67
              client/src/app/+my-library/my-video-playlists/my-video-playlist-elements.component.ts on lines 125..131
              client/src/app/+my-library/my-video-playlists/my-video-playlists.component.ts on lines 80..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 72.

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

                onNearOfBottom () {
                  // Last page
                  if (this.pagination.totalItems <= (this.pagination.currentPage * this.pagination.itemsPerPage)) return
              
                  this.pagination.currentPage += 1
              client/src/app/+my-library/my-follows/my-followers.component.ts on lines 61..67
              client/src/app/+my-library/my-follows/my-subscriptions.component.ts on lines 48..54
              client/src/app/+my-library/my-video-playlists/my-video-playlist-elements.component.ts on lines 125..131

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

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

                      {
                        label: $localize`Delete Web Video files`,
                        handler: ({ video }) => this.removeVideoFiles(video, 'web-videos'),
                        isDisplayed: () => this.displayOptions.removeFiles && this.canRemoveVideoFiles(),
                        iconName: 'delete'
              client/src/app/shared/shared-video-miniature/video-actions-dropdown.component.ts on lines 539..544
              client/src/app/shared/shared-video-miniature/video-actions-dropdown.component.ts on lines 545..550
              client/src/app/shared/shared-video-miniature/video-actions-dropdown.component.ts on lines 551..556

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

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

                      {
                        label: $localize`Run HLS transcoding`,
                        handler: videos => this.runTranscoding(videos, 'hls'),
                        isDisplayed: videos => videos.every(v => v.canRunTranscoding(this.authUser)),
                        iconName: 'cog'
              client/src/app/+admin/overview/videos/video-list.component.ts on lines 153..158
              client/src/app/+admin/overview/videos/video-list.component.ts on lines 159..164
              client/src/app/+admin/overview/videos/video-list.component.ts on lines 165..170

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

              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