Chocobozzz/PeerTube

View on GitHub

Showing 3,313 of 3,313 total issues

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

  private loadAccountBlockStatus () {
    this.blocklist.getStatus({ accounts: [ this.account.nameWithHostForced ], hosts: [ this.account.host ] })
      .subscribe(status => this.account.updateBlockStatus(status))
  }
Severity: Major
Found in client/src/app/+accounts/accounts.component.ts and 1 other location - About 2 hrs to fix
client/src/app/+video-channels/video-channels.component.ts on lines 185..188

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

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

    if (this.options_.title) {
      const title = videojs.dom.createEl('div', {
        className: 'peertube-dock-title',
        title: this.options_.title,
        innerText: this.options_.title
client/src/assets/player/shared/dock/peertube-dock-component.ts on lines 45..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 78.

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

  blockServerByUser (host: string) {
    const body = { host }

    return this.authHttp.post(BlocklistService.BASE_USER_BLOCKLIST_URL + '/servers', body)
               .pipe(catchError(err => this.restExtractor.handleError(err)))
Severity: Major
Found in client/src/app/shared/shared-moderation/blocklist.service.ts and 1 other location - About 2 hrs to fix
client/src/app/shared/shared-moderation/blocklist.service.ts on lines 152..157

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

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

  private loadOwnerBlockStatus () {
    this.blocklist.getStatus({ accounts: [ this.ownerAccount.nameWithHostForced ], hosts: [ this.ownerAccount.host ] })
      .subscribe(status => this.ownerAccount.updateBlockStatus(status))
  }
Severity: Major
Found in client/src/app/+video-channels/video-channels.component.ts and 1 other location - About 2 hrs to fix
client/src/app/+accounts/accounts.component.ts on lines 242..245

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

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 fromQueryHLS = `SELECT 'https://' || server.host AS "serverUrl", ` +
      `'/static/streaming-playlists/hls/' || video.uuid || '/' AS "filePath", "videoFile".id ` +
      `FROM video ` +
      `INNER JOIN "videoChannel" ON "videoChannel".id = video."channelId" ` +
      `INNER JOIN actor ON actor.id = "videoChannel"."actorId" ` +
Severity: Major
Found in server/core/initializers/migrations/0595-remote-url.ts and 1 other location - About 2 hrs to fix
server/core/models/redundancy/video-redundancy.ts on lines 618..626

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

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

async function doesUnblockServerExist (accountId: number, host: string, res: express.Response) {
  const serverBlock = await ServerBlocklistModel.loadByAccountAndHost(accountId, host)
  if (!serverBlock) {
    res.fail({
      status: HttpStatusCode.NOT_FOUND_404,
Severity: Major
Found in server/core/middlewares/validators/blocklist.ts and 1 other location - About 2 hrs to fix
server/core/middlewares/validators/blocklist.ts on lines 153..165

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

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

        {
          label: $localize`Block`,
          handler: () => this.showBlockModal(),
          iconName: 'no',
          isDisplayed: () => this.authService.isLoggedIn() && this.displayOptions.blacklist && this.isVideoBlockable()
client/src/app/shared/shared-video-miniature/video-actions-dropdown.component.ts on lines 513..518

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

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

File videos-importer.ts has 256 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import { pick } from '@peertube/peertube-core-utils'
import { ffprobePromise, getVideoStreamDuration } from '@peertube/peertube-ffmpeg'
import {
  LiveVideoLatencyMode,
  ThumbnailType,
Severity: Minor
Found in server/core/lib/user-import-export/importers/videos-importer.ts - About 2 hrs to fix

    File plugin.service.ts has 256 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    import { firstValueFrom, Observable, of } from 'rxjs'
    import { catchError, map, shareReplay } from 'rxjs/operators'
    import { HttpClient } from '@angular/common/http'
    import { Inject, Injectable, LOCALE_ID, NgZone } from '@angular/core'
    import { VideoEditType } from '@app/+videos/+video-edit/shared/video-edit.type'
    Severity: Minor
    Found in client/src/app/core/plugins/plugin.service.ts - About 2 hrs to fix

      Function ScopeNames.SUMMARY has 53 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        [ScopeNames.SUMMARY]: (options: SummaryOptions = {}) => {
          const serverInclude: IncludeOptions = {
            attributes: [ 'host' ],
            model: ServerModel.unscoped(),
            required: !!options.whereServer,
      Severity: Major
      Found in server/core/models/account/account.ts - About 2 hrs to fix

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

          constructor (
            protected route: ActivatedRoute,
            protected router: Router,
            private notifier: Notifier,
            private serverService: ServerService,

          Function hijackMouseTooltip has 53 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            private hijackMouseTooltip (evt: Event) {
              const sprite = this.sprites[this.url]
              const imgWidth = sprite.naturalWidth
              const imgHeight = sprite.naturalHeight
              const seekBarEl = this.seekBar.el()
          Severity: Major
          Found in client/src/assets/player/shared/control-bar/storyboard-plugin.ts - About 2 hrs to fix

            Function loadVideo has 53 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              private loadVideo (options: {
                videoId: string
                forceAutoplay: boolean
                liveRefresh?: boolean
                videoPassword?: string
            Severity: Major
            Found in client/src/app/+videos/+video-watch/video-watch.component.ts - About 2 hrs to fix

              Function loadPlayer has 53 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                private async loadPlayer (options: {
                  loggedInOrAnonymousUser: User
                  forceAutoplay: boolean
                }) {
                  const { loggedInOrAnonymousUser, forceAutoplay } = options
              Severity: Major
              Found in client/src/app/+videos/+video-watch/video-watch.component.ts - About 2 hrs to fix

                File video-comments.component.ts has 255 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                import { NgFor, NgIf } from '@angular/common'
                import { Component, ElementRef, EventEmitter, Input, OnChanges, OnDestroy, OnInit, Output, SimpleChanges, ViewChild } from '@angular/core'
                import { ActivatedRoute } from '@angular/router'
                import { AuthService, ComponentPagination, ConfirmService, Notifier, User, hasMoreItems } from '@app/core'
                import { HooksService } from '@app/core/plugins/hooks.service'

                  Function processStudioTranscoding has 53 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  export async function processStudioTranscoding (options: ProcessOptions<RunnerJobStudioTranscodingPayload>) {
                    const { server, job, runnerToken } = options
                    const payload = job.payload
                  
                    let videoInputPath: string
                  Severity: Major
                  Found in apps/peertube-runner/src/server/process/shared/process-studio.ts - About 2 hrs to fix

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

                      getPrivacies (options: OverrideCommandOptions = {}) {
                        const path = '/api/v1/video-playlists/privacies'
                    
                        return this.getRequestBody<{ [ id: number ]: string }>({
                          ...options,
                    Severity: Major
                    Found in packages/server-commands/src/videos/playlists-command.ts and 2 other locations - About 2 hrs to fix
                    packages/server-commands/src/videos/videos-command.ts on lines 35..45
                    packages/server-commands/src/videos/videos-command.ts on lines 47..57

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

                    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

                      getLicences (options: OverrideCommandOptions = {}) {
                        const path = '/api/v1/videos/licences'
                    
                        return this.getRequestBody<{ [id: number]: string }>({
                          ...options,
                    Severity: Major
                    Found in packages/server-commands/src/videos/videos-command.ts and 2 other locations - About 2 hrs to fix
                    packages/server-commands/src/videos/playlists-command.ts on lines 294..304
                    packages/server-commands/src/videos/videos-command.ts on lines 35..45

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

                    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

                      getCategories (options: OverrideCommandOptions = {}) {
                        const path = '/api/v1/videos/categories'
                    
                        return this.getRequestBody<{ [id: number]: string }>({
                          ...options,
                    Severity: Major
                    Found in packages/server-commands/src/videos/videos-command.ts and 2 other locations - About 2 hrs to fix
                    packages/server-commands/src/videos/playlists-command.ts on lines 294..304
                    packages/server-commands/src/videos/videos-command.ts on lines 47..57

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

                    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

                      createSync (body: VideoChannelSyncCreate) {
                        return this.authHttp.post<{ videoChannelSync: VideoChannelSync }>(VideoChannelSyncService.BASE_VIDEO_CHANNEL_URL, body)
                                   .pipe(catchError(err => this.restExtractor.handleError(err)))
                      }
                    client/src/app/shared/shared-video-live/live-video.service.ts on lines 18..22

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

                    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