Chocobozzz/PeerTube

View on GitHub

Showing 3,313 of 3,313 total issues

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

async function listRunners (req: express.Request, res: express.Response) {
  const query: ListRunnersQuery = req.query

  const resultList = await RunnerModel.listForApi({
    start: query.start,
Severity: Major
Found in server/core/controllers/api/runners/manage-runners.ts and 1 other location - About 5 hrs to fix
server/core/controllers/api/runners/registration-tokens.ts on lines 78..91

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

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 handleWebVideoMergeAudioJob (job: Job, payload: MergeAudioTranscodingPayload, video: MVideoFullLight, user: MUserId) {
  logger.info('Handling merge audio transcoding job for %s.', video.uuid, lTags(video.uuid), { payload })

  await mergeAudioVideofile({ video, resolution: payload.resolution, fps: payload.fps, job })

Severity: Major
Found in server/core/lib/job-queue/handlers/video-transcoding.ts and 1 other location - About 5 hrs to fix
server/core/lib/job-queue/handlers/video-transcoding.ts on lines 99..107

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

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 listRegistrationTokens (req: express.Request, res: express.Response) {
  const query: ListRunnerRegistrationTokensQuery = req.query

  const resultList = await RunnerRegistrationTokenModel.listForApi({
    start: query.start,
Severity: Major
Found in server/core/controllers/api/runners/registration-tokens.ts and 1 other location - About 5 hrs to fix
server/core/controllers/api/runners/manage-runners.ts on lines 103..116

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

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 server-config-manager.ts has 383 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import {
  HTMLServerConfig,
  RegisteredExternalAuthConfig,
  RegisteredIdAndPassAuthConfig,
  ServerConfig,
Severity: Minor
Found in server/core/lib/server-config-manager.ts - About 5 hrs to fix

    File users.ts has 379 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    import { forceNumber } from '@peertube/peertube-core-utils'
    import { HttpStatusCode, ServerErrorCode, UserRight, UserRole } from '@peertube/peertube-models'
    import express from 'express'
    import { body, param, query } from 'express-validator'
    import { exists, isBooleanValid, isIdValid, toBooleanOrNull, toIntOrNull } from '../../../helpers/custom-validators/misc.js'
    Severity: Minor
    Found in server/core/middlewares/validators/users/users.ts - About 5 hrs to fix

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

      import { DatePipe, NgClass, NgFor, NgIf } from '@angular/common'
      import { Component, OnInit, ViewChild } from '@angular/core'
      import { ActivatedRoute, Router, RouterLink } from '@angular/router'
      import { AuthService, ConfirmService, Notifier, RestPagination, RestTable, ServerService } from '@app/core'
      import { formatICU } from '@app/helpers'
      Severity: Minor
      Found in client/src/app/+admin/overview/videos/video-list.component.ts - About 5 hrs to fix

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

          private static getOEmbedUrl (video: MVideo, currentQuery: Record<string, string>) {
            const base = WEBSERVER.URL + video.getWatchStaticPath()
        
            const additionalQuery: Record<string, string> = {}
            const allowedParams = new Set([ 'start' ])
        Severity: Major
        Found in server/core/lib/html/shared/video-html.ts and 1 other location - About 5 hrs to fix
        server/core/lib/html/shared/playlist-html.ts on lines 133..144

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

        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

        function generatePlaylistOEmbed (req: express.Request, res: express.Response) {
          const playlist = res.locals.videoPlaylistSummary
        
          const json = buildOEmbed({
            channel: playlist.VideoChannel,
        Severity: Major
        Found in server/core/controllers/services.ts and 1 other location - About 5 hrs to fix
        server/core/controllers/services.ts on lines 52..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 136.

        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 static getOEmbedUrl (playlist: MVideoPlaylist, currentQuery: Record<string, string>) {
            const base = WEBSERVER.URL + playlist.getWatchStaticPath()
        
            const additionalQuery: Record<string, string> = {}
            const allowedParams = new Set([ 'playlistPosition' ])
        Severity: Major
        Found in server/core/lib/html/shared/playlist-html.ts and 1 other location - About 5 hrs to fix
        server/core/lib/html/shared/video-html.ts on lines 138..149

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

        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

        function generateVideoOEmbed (req: express.Request, res: express.Response) {
          const video = res.locals.videoAll
        
          const json = buildOEmbed({
            channel: video.VideoChannel,
        Severity: Major
        Found in server/core/controllers/services.ts and 1 other location - About 5 hrs to fix
        server/core/controllers/services.ts on lines 37..50

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

        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

          unblockAccountByUser (account: AccountMutedStatus) {
            this.blocklistService.unblockAccountByUser(account)
                .subscribe({
                  next: () => {
                    this.notifier.success($localize`Account ${account.nameWithHost} unmuted.`)
        client/src/app/shared/shared-moderation/user-moderation-dropdown.component.ts on lines 135..147
        client/src/app/shared/shared-moderation/user-moderation-dropdown.component.ts on lines 191..203
        client/src/app/shared/shared-moderation/user-moderation-dropdown.component.ts on lines 205..217

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

        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

          unblockAccountByInstance (account: AccountMutedStatus) {
            this.blocklistService.unblockAccountByInstance(account)
                .subscribe({
                  next: () => {
                    this.notifier.success($localize`Account ${account.nameWithHost} unmuted by the instance.`)
        client/src/app/shared/shared-moderation/user-moderation-dropdown.component.ts on lines 135..147
        client/src/app/shared/shared-moderation/user-moderation-dropdown.component.ts on lines 149..161
        client/src/app/shared/shared-moderation/user-moderation-dropdown.component.ts on lines 191..203

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

        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

          blockAccountByInstance (account: AccountMutedStatus) {
            this.blocklistService.blockAccountByInstance(account)
                .subscribe({
                  next: () => {
                    this.notifier.success($localize`Account ${account.nameWithHost} muted by the instance.`)
        client/src/app/shared/shared-moderation/user-moderation-dropdown.component.ts on lines 135..147
        client/src/app/shared/shared-moderation/user-moderation-dropdown.component.ts on lines 149..161
        client/src/app/shared/shared-moderation/user-moderation-dropdown.component.ts on lines 205..217

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

        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

          blockAccountByUser (account: AccountMutedStatus) {
            this.blocklistService.blockAccountByUser(account)
                .subscribe({
                  next: () => {
                    this.notifier.success($localize`Account ${account.nameWithHost} muted.`)
        client/src/app/shared/shared-moderation/user-moderation-dropdown.component.ts on lines 149..161
        client/src/app/shared/shared-moderation/user-moderation-dropdown.component.ts on lines 191..203
        client/src/app/shared/shared-moderation/user-moderation-dropdown.component.ts on lines 205..217

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

        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

          extractPlaylists (result: ResultList<VideoPlaylistServerModel>) {
            return this.serverService.getServerLocale()
                       .pipe(
                         map(translations => {
                           const playlistsJSON = result.data
        client/src/app/shared/shared-main/video/video.service.ts on lines 457..472
        client/src/app/shared/shared-video-playlist/video-playlist.service.ts on lines 345..360

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

          extractVideoPlaylistElements (result: ResultList<ServerVideoPlaylistElement>) {
            return this.serverService.getServerLocale()
                       .pipe(
                         map(translations => {
                           const elementsJson = result.data
        client/src/app/shared/shared-main/video/video.service.ts on lines 457..472
        client/src/app/shared/shared-video-playlist/video-playlist.service.ts on lines 323..338

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

          extractVideos (result: ResultList<VideoServerModel>) {
            return this.serverService.getServerLocale()
                       .pipe(
                         map(translations => {
                           const videosJson = result.data
        Severity: Major
        Found in client/src/app/shared/shared-main/video/video.service.ts and 2 other locations - About 4 hrs to fix
        client/src/app/shared/shared-video-playlist/video-playlist.service.ts on lines 323..338
        client/src/app/shared/shared-video-playlist/video-playlist.service.ts on lines 345..360

        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

        async function listBlockedAccounts (req: express.Request, res: express.Response) {
          const user = res.locals.oauth.token.User
        
          const resultList = await AccountBlocklistModel.listForApi({
            start: req.query.start,
        Severity: Major
        Found in server/core/controllers/api/users/my-blocklist.ts and 1 other location - About 4 hrs to fix
        server/core/controllers/api/users/my-blocklist.ts on lines 111..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 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

            this.followService.acceptFollower(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 110..124

        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

        async function listBlockedServers (req: express.Request, res: express.Response) {
          const user = res.locals.oauth.token.User
        
          const resultList = await ServerBlocklistModel.listForApi({
            start: req.query.start,
        Severity: Major
        Found in server/core/controllers/api/users/my-blocklist.ts and 1 other location - About 4 hrs to fix
        server/core/controllers/api/users/my-blocklist.ts on lines 80..92

        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

        Severity
        Category
        Status
        Source
        Language