Chocobozzz/PeerTube

View on GitHub

Showing 3,313 of 3,313 total issues

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

    hlsControl.valueChanges
      .subscribe(newValue => {
        if (newValue === false && webVideosControl.value === false) {
          webVideosControl.setValue(true)

client/src/app/+admin/config/edit-custom-config/edit-vod-transcoding.component.ts on lines 123..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 85.

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

    webVideosControl.valueChanges
      .subscribe(newValue => {
        if (newValue === false && hlsControl.value === false) {
          hlsControl.setValue(true)

client/src/app/+admin/config/edit-custom-config/edit-vod-transcoding.component.ts on lines 133..141

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

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

  getRegisteredSettings (options: OverrideCommandOptions & {
    npmName: string
  }) {
    const path = '/api/v1/plugins/' + options.npmName + '/registered-settings'

Severity: Major
Found in packages/server-commands/src/server/plugins-command.ts and 1 other location - About 2 hrs to fix
packages/server-commands/src/moderation/automatic-tags-command.ts on lines 12..24

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

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

  getCommentPolicies (options: OverrideCommandOptions & {
    accountName: string
  }) {
    const path = '/api/v1/automatic-tags/policies/accounts/' + options.accountName + '/comments'

packages/server-commands/src/server/plugins-command.ts on lines 115..127

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

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

  {
    await utils.queryInterface.addColumn('videoFile', 'storage', {
      type: Sequelize.INTEGER,
      allowNull: true,
      defaultValue: FileStorage.FILE_SYSTEM
Severity: Major
Found in server/core/initializers/migrations/0660-object-storage.ts and 1 other location - About 2 hrs to fix
server/core/initializers/migrations/0660-object-storage.ts on lines 35..46

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

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 me.ts has 270 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import { pick } from '@peertube/peertube-core-utils'
import {
  ActorImageType,
  UserVideoRate as FormattedUserVideoRate,
  HttpStatusCode,
Severity: Minor
Found in server/core/controllers/api/users/me.ts - About 2 hrs to fix

    File register-helpers.ts has 270 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    import express from 'express'
    import { Server } from 'http'
    import {
      EncoderOptionsBuilder,
      PluginSettingsManager,
    Severity: Minor
    Found in server/core/lib/plugins/register-helpers.ts - About 2 hrs to fix

      Function saveReplayToExternalVideo has 62 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      async function saveReplayToExternalVideo (options: {
        liveVideo: MVideoThumbnail
        liveSession: MVideoLiveSession
        publishedAt: string
        replayDirectory: string
      Severity: Major
      Found in server/core/lib/job-queue/handlers/video-live-ending.ts - About 2 hrs to fix

        Function sendCreateVideoCommentIfNeeded has 62 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        export async function sendCreateVideoCommentIfNeeded (comment: MCommentOwnerVideoReply, transaction: Transaction) {
          const isOrigin = comment.Video.isOwned()
        
          if (isOrigin) {
            const videoWithBlacklist = await VideoModel.loadWithBlacklist(comment.Video.id)
        Severity: Major
        Found in server/core/lib/activitypub/send/send-create.ts - About 2 hrs to fix

          Function buildAdminInputFilter has 62 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            buildAdminInputFilter (): AdvancedInputFilter[] {
              return [
                {
                  title: $localize`Video type`,
                  children: [
          Severity: Major
          Found in client/src/app/+admin/overview/videos/video-admin.service.ts - About 2 hrs to fix

            File video-caption-edit-modal-content.component.ts has 269 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            import { NgClass, NgForOf, NgIf } from '@angular/common'
            import { AfterViewInit, ChangeDetectorRef, Component, ElementRef, EventEmitter, Input, OnInit, Output, ViewChild } from '@angular/core'
            import { FormsModule, ReactiveFormsModule } from '@angular/forms'
            import { VIDEO_CAPTION_FILE_CONTENT_VALIDATOR } from '@app/shared/form-validators/video-captions-validators'
            import { FormReactive } from '@app/shared/shared-forms/form-reactive'

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

                remove (options: OverrideCommandOptions & {
                  userId: number
                }) {
                  const { userId } = options
                  const path = '/api/v1/users/' + userId
              Severity: Major
              Found in packages/server-commands/src/users/users-command.ts and 3 other locations - About 2 hrs to fix
              packages/server-commands/src/moderation/abuses-command.ts on lines 165..178
              packages/server-commands/src/server/redundancy-command.ts on lines 66..79
              packages/server-commands/src/videos/history-command.ts on lines 24..37

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

              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

                delete (options: OverrideCommandOptions & {
                  abuseId: number
                }) {
                  const { abuseId } = options
                  const path = '/api/v1/abuses/' + abuseId
              Severity: Major
              Found in packages/server-commands/src/moderation/abuses-command.ts and 3 other locations - About 2 hrs to fix
              packages/server-commands/src/server/redundancy-command.ts on lines 66..79
              packages/server-commands/src/users/users-command.ts on lines 342..355
              packages/server-commands/src/videos/history-command.ts on lines 24..37

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

              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

                removeElement (options: OverrideCommandOptions & {
                  videoId: number
                }) {
                  const { videoId } = options
                  const path = '/api/v1/users/me/history/videos/' + videoId
              Severity: Major
              Found in packages/server-commands/src/videos/history-command.ts and 3 other locations - About 2 hrs to fix
              packages/server-commands/src/moderation/abuses-command.ts on lines 165..178
              packages/server-commands/src/server/redundancy-command.ts on lines 66..79
              packages/server-commands/src/users/users-command.ts on lines 342..355

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

              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

                removeVideo (options: OverrideCommandOptions & {
                  redundancyId: number
                }) {
                  const { redundancyId } = options
                  const path = '/api/v1/server/redundancy/videos/' + redundancyId
              Severity: Major
              Found in packages/server-commands/src/server/redundancy-command.ts and 3 other locations - About 2 hrs to fix
              packages/server-commands/src/moderation/abuses-command.ts on lines 165..178
              packages/server-commands/src/users/users-command.ts on lines 342..355
              packages/server-commands/src/videos/history-command.ts on lines 24..37

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

              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 setAccountAvatarUrl (actor: { avatarUrl?: string, avatars: { width: number, url?: string, path: string }[] }) {
                  actor.avatarUrl = VideoChannel.GET_ACTOR_AVATAR_URL(actor, 48) || Account.GET_DEFAULT_AVATAR_URL(48)
                }
              client/src/app/shared/shared-main/users/user-notification.model.ts on lines 300..302

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

              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 (touchClientX > touchClientY) {
                      if (touchClientX > 0) {
                        if (direction === 'left') {
                          if (removeEventOnEnd) this.removeFingerSwipeEventListener(onTouchStart, onTouchMove)
                          action()
              Severity: Major
              Found in client/src/app/core/wrappers/screen.service.ts and 1 other location - About 2 hrs to fix
              client/src/app/core/wrappers/screen.service.ts on lines 90..102

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

              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

                          this.videoBlocklistService.unblockVideo(videoBlock.video.id).pipe(
                            switchMap(_ => this.videoBlocklistService.blockVideo([ { videoId: videoBlock.video.id, unfederate: true } ]))
                          ).subscribe({
                            next: () => {
                              this.notifier.success($localize`Video ${videoBlock.video.name} switched to manual block.`)
              client/src/app/+admin/moderation/video-block-list/video-block-list.component.ts on lines 164..172

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

              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

                  this.videoBlocklistService.unblockVideo(entry.video.id)
                    .subscribe({
                      next: () => {
                        this.notifier.success($localize`Video ${entry.video.name} unblocked.`)
                        this.reloadData()
              client/src/app/+admin/moderation/video-block-list/video-block-list.component.ts on lines 91..100

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

              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 setVideoChannelAvatarUrl (actor: { avatarUrl?: string, avatars: { width: number, url?: string, path: string }[] }) {
                  actor.avatarUrl = VideoChannel.GET_ACTOR_AVATAR_URL(actor, 48) || VideoChannel.GET_DEFAULT_AVATAR_URL(48)
                }
              client/src/app/shared/shared-main/users/user-notification.model.ts on lines 296..298

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

              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