Chocobozzz/PeerTube

View on GitHub

Showing 3,313 of 3,313 total issues

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

    this.followService.rejectFollower(follows)
        .subscribe({
          next: () => {
            // eslint-disable-next-line max-len
            const message = formatICU(
client/src/app/+admin/follows/followers-list/followers-list.component.ts on lines 83..97

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

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

export function makeDeleteRequest (options: CommonRequestParams & {
  query?: any
  rawQuery?: string
}) {
  const req = request(options.url).delete(options.path)
Severity: Major
Found in packages/server-commands/src/requests/requests.ts and 1 other location - About 4 hrs to fix
packages/server-commands/src/requests/requests.ts on lines 71..81

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

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

export function makeGetRequest (options: CommonRequestParams & {
  query?: any
  rawQuery?: string
}) {
  const req = request(options.url).get(options.path)
Severity: Major
Found in packages/server-commands/src/requests/requests.ts and 1 other location - About 4 hrs to fix
packages/server-commands/src/requests/requests.ts on lines 113..123

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

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

  program
    .command('list')
    .description('List installed plugins')
    .option('-u, --url <url>', 'Server url')
    .option('-U, --username <username>', 'Username')
Severity: Major
Found in apps/peertube-cli/src/peertube-plugins.ts and 1 other location - About 4 hrs to fix
apps/peertube-cli/src/peertube-plugins.ts on lines 50..65

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

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

  program
    .command('update')
    .description('Update a plugin or a theme')
    .option('-u, --url <url>', 'Server url')
    .option('-U, --username <username>', 'Username')
Severity: Major
Found in apps/peertube-cli/src/peertube-plugins.ts and 1 other location - About 4 hrs to fix
apps/peertube-cli/src/peertube-plugins.ts on lines 15..30

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

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

import { forceNumber } from '@peertube/peertube-core-utils'
import {
  HttpStatusCode,
  VideoPlaylistCreate,
  VideoPlaylistCreateResult,
Severity: Minor
Found in server/core/controllers/api/video-playlist.ts - About 4 hrs to fix

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

          it('Should validate the email', async function () {
            let email: { text: string }
    
            while (!(email = findEmailTo(emails, 'user_4@example.com'))) {
              await browserSleep(100)
    Severity: Major
    Found in client/e2e/src/suites-local/signup.e2e-spec.ts and 1 other location - About 4 hrs to fix
    client/e2e/src/suites-local/signup.e2e-spec.ts on lines 300..319

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

    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

          it('Should validate the email', async function () {
            let email: { text: string }
    
            while (!(email = findEmailTo(emails, 'user_3@example.com'))) {
              await browserSleep(100)
    Severity: Major
    Found in client/e2e/src/suites-local/signup.e2e-spec.ts and 1 other location - About 4 hrs to fix
    client/e2e/src/suites-local/signup.e2e-spec.ts on lines 387..406

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

    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

      onAvatarChange (formData: FormData) {
        this.instanceService.updateInstanceAvatar(formData)
          .subscribe({
            next: () => {
              this.notifier.success($localize`Avatar changed.`)
    client/src/app/+admin/config/edit-custom-config/edit-instance-information.component.ts on lines 78..89

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

    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

      onBannerChange (formData: FormData) {
        this.instanceService.updateInstanceBanner(formData)
          .subscribe({
            next: () => {
              this.notifier.success($localize`Banner changed.`)
    client/src/app/+admin/config/edit-custom-config/edit-instance-information.component.ts on lines 104..115

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

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

    import express from 'express'
    import {
      ActorImageType,
      HttpStatusCode,
      VideoChannelCreate,
    Severity: Minor
    Found in server/core/controllers/api/video-channel.ts - About 4 hrs to fix

      Function getZanataContributors has 119 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function getZanataContributors () {
        return [
          { username: 'abdhessuk', name: 'Abd Hessuk' },
          { username: 'abidin24', name: 'abidin toumi' },
          { username: 'aditoo', name: 'Lorem Ipsum' },
      Severity: Major
      Found in scripts/generate-code-contributors.ts - About 4 hrs to fix

        File hls-plugin.ts has 365 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        // Thanks https://github.com/streamroot/videojs-hlsjs-plugin
        // We duplicated this plugin to choose the hls.js version we want, because streamroot only provide a bundled file
        
        import { logger } from '@root-helpers/logger'
        import Hlsjs, { ErrorData, Level, LevelSwitchingData, ManifestParsedData } from 'hls.js'
        Severity: Minor
        Found in client/src/assets/player/shared/p2p-media-loader/hls-plugin.ts - About 4 hrs to fix

          Function buildPeerTubePlayerLoadOptions has 119 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            private buildPeerTubePlayerLoadOptions (options: {
              video: VideoDetails
              liveVideo: LiveVideo
              videoCaptions: VideoCaption[]
              videoChapters: VideoChapter[]
          Severity: Major
          Found in client/src/app/+videos/+video-watch/video-watch.component.ts - About 4 hrs to fix

            File player-options-builder.ts has 365 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            import { peertubeTranslate } from '@peertube/peertube-core-utils'
            import {
              HTMLServerConfig,
              LiveVideo,
              Storyboard,
            Severity: Minor
            Found in client/src/standalone/videos/shared/player-options-builder.ts - About 4 hrs to fix

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

                  this.videoPlaylistService.removeVideoPlaylist(videoPlaylist)
                    .subscribe({
                      next: () => {
                        this.videoPlaylists = this.videoPlaylists
                                                  .filter(p => p.id !== videoPlaylist.id)
              client/src/app/+my-library/+my-video-channels/my-video-channels.component.ts on lines 103..111

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

              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

                textMarkdownToHTML (options: {
                  markdown: string
                  withHtml?: boolean // default false
                  withEmoji?: boolean // default false
                }) {
              Severity: Major
              Found in client/src/app/core/renderer/markdown.service.ts and 1 other location - About 4 hrs to fix
              client/src/app/core/renderer/markdown.service.ts on lines 78..88

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

              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 setUserHistory (row: SQLRow, videoModel: VideoModel) {
                  const id = row['userVideoHistory.id']
                  if (!id || this.historyDone.has(id)) return
              
                  const attributes = this.grab(row, this.tables.getUserHistoryAttributes(), 'userVideoHistory')
              server/core/models/video/sql/video/shared/video-model-builder.ts on lines 269..278

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

              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.videoChannelService.removeVideoChannel(videoChannel)
                    .subscribe({
                      next: () => {
                        this.videoChannels = this.videoChannels.filter(c => c.id !== videoChannel.id)
                        this.notifier.success($localize`Video channel ${videoChannel.displayName} deleted.`)
              client/src/app/+my-library/my-video-playlists/my-video-playlists.component.ts on lines 63..73

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

              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 (req: express.Request, res: express.Response, next: express.NextFunction) => {
                  if (areValidationErrors(req, res)) return
              
                  const plugin = await PluginModel.loadByNpmName(req.params.npmName)
                  if (!plugin) {
              Severity: Major
              Found in server/core/middlewares/validators/plugins.ts and 1 other location - About 4 hrs to fix
              server/core/middlewares/validators/server.ts on lines 15..29

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

              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