Chocobozzz/PeerTube

View on GitHub

Showing 3,313 of 3,313 total issues

Function getCommonVideoEditAttributes has 77 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export function getCommonVideoEditAttributes () {
  return [
    body('thumbnailfile')
      .custom((value, { req }) => isVideoImageValid(req.files, 'thumbnailfile')).withMessage(
        'This thumbnail file is not supported or too large. Please, make sure it is of the following type: ' +
Severity: Major
Found in server/core/middlewares/validators/videos/videos.ts - About 3 hrs to fix

    File app.component.ts has 295 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    import { delay, forkJoin } from 'rxjs'
    import { filter, first, map } from 'rxjs/operators'
    import { DOCUMENT, getLocaleDirection, PlatformLocation, NgIf, NgClass } from '@angular/common'
    import { AfterViewInit, Component, Inject, LOCALE_ID, OnInit, ViewChild } from '@angular/core'
    import { DomSanitizer, SafeHtml } from '@angular/platform-browser'
    Severity: Minor
    Found in client/src/app/app.component.ts - About 3 hrs to fix

      Function buildVideoPlayer has 77 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        private async buildVideoPlayer (options: {
          videoResponse: Response
          storyboardsPromise: Promise<Response>
          captionsPromise: Promise<Response>
          chaptersPromise: Promise<Response>
      Severity: Major
      Found in client/src/standalone/videos/embed.ts - About 3 hrs to fix

        File search.component.ts has 295 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        import { NgFor, NgIf, NgTemplateOutlet } from '@angular/common'
        import { Component, OnDestroy, OnInit } from '@angular/core'
        import { ActivatedRoute, Router, RouterLink } from '@angular/router'
        import { AuthService, HooksService, MetaService, Notifier, ServerService, User, UserService } from '@app/core'
        import { immutableAssign, SimpleMemoize } from '@app/helpers'
        Severity: Minor
        Found in client/src/app/+search/search.component.ts - About 3 hrs to fix

          File video-live-ending.ts has 294 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          import { ffprobePromise, getAudioStream, getVideoStreamDimensionsInfo, getVideoStreamFPS } from '@peertube/peertube-ffmpeg'
          import { ThumbnailType, VideoFileStream, VideoLiveEndingPayload, VideoState } from '@peertube/peertube-models'
          import { peertubeTruncate } from '@server/helpers/core-utils.js'
          import { CONSTRAINTS_FIELDS } from '@server/initializers/constants.js'
          import { getLocalVideoActivityPubUrl } from '@server/lib/activitypub/url.js'
          Severity: Minor
          Found in server/core/lib/job-queue/handlers/video-live-ending.ts - About 3 hrs to fix

            File server-config.model.ts has 294 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            import { ActorImage, VideoCommentPolicyType } from '../index.js'
            import { ClientScriptJSON } from '../plugins/plugin-package-json.model.js'
            import { NSFWPolicyType } from '../videos/nsfw-policy.type.js'
            import { VideoPrivacyType } from '../videos/video-privacy.enum.js'
            import { BroadcastMessageLevel } from './broadcast-message-level.type.js'
            Severity: Minor
            Found in packages/models/src/server/server-config.model.ts - About 3 hrs to fix

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

                abort (options: OverrideCommandOptions & AbortRunnerJobBody & { jobUUID: string }) {
                  const path = '/api/v1/runners/jobs/' + options.jobUUID + '/abort'
              
                  return this.postBodyRequest({
                    ...options,
              Severity: Major
              Found in packages/server-commands/src/runners/runner-jobs-command.ts and 1 other location - About 3 hrs to fix
              packages/server-commands/src/runners/runner-jobs-command.ts on lines 169..180

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

              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 const videoChannelsNameWithHostValidator = [
                param('nameWithHost')
                  .exists(),
              
                async (req: express.Request, res: express.Response, next: express.NextFunction) => {
              Severity: Major
              Found in server/core/middlewares/validators/videos/video-channels.ts and 1 other location - About 3 hrs to fix
              server/core/middlewares/validators/account.ts on lines 18..28

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

              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 accountNameWithHostGetValidator = [
                param('accountName')
                  .exists(),
              
                async (req: express.Request, res: express.Response, next: express.NextFunction) => {
              Severity: Major
              Found in server/core/middlewares/validators/account.ts and 1 other location - About 3 hrs to fix
              server/core/middlewares/validators/videos/video-channels.ts on lines 85..96

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

              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

                error (options: OverrideCommandOptions & ErrorRunnerJobBody & { jobUUID: string }) {
                  const path = '/api/v1/runners/jobs/' + options.jobUUID + '/error'
              
                  return this.postBodyRequest({
                    ...options,
              Severity: Major
              Found in packages/server-commands/src/runners/runner-jobs-command.ts and 1 other location - About 3 hrs to fix
              packages/server-commands/src/runners/runner-jobs-command.ts on lines 123..134

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

              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

                protected includeTags () {
                  this.addJoin(
                    'LEFT OUTER JOIN (' +
                      '"videoTag" AS "Tags->VideoTagModel" INNER JOIN "tag" AS "Tags" ON "Tags"."id" = "Tags->VideoTagModel"."tagId"' +
                    ') ' +
              server/core/models/video/sql/video/shared/abstract-video-query-builder.ts on lines 280..294

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

              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

                protected includeTrackers () {
                  this.addJoin(
                    'LEFT OUTER JOIN (' +
                      '"videoTracker" AS "Trackers->VideoTrackerModel" ' +
                        'INNER JOIN "tracker" AS "Trackers" ON "Trackers"."id" = "Trackers->VideoTrackerModel"."trackerId"' +
              server/core/models/video/sql/video/shared/abstract-video-query-builder.ts on lines 172..186

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

              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 processActivityPubParallelHttpBroadcast (job: Job<ActivitypubHttpBroadcastPayload>) {
                logger.info('Processing ActivityPub parallel broadcast in job %s.', job.id)
              
                const requestOptions = await buildRequestOptions(job.data)
              
              
              server/core/lib/job-queue/handlers/activitypub-http-broadcast.ts on lines 10..18

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

              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.meter.createObservableGauge('peertube_ap_inbox_error_total', {
                    description: 'Total inbox messages processed with error'
                  }).addCallback(async observableResult => {
                    const stats = await this.getInstanceStats()
              
              
              server/core/lib/opentelemetry/metric-helpers/stats-observers-builder.ts on lines 158..166

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

              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.levelChoices = [
                    {
                      id: 'debug',
                      label: $localize`debug`
                    },
              Severity: Major
              Found in client/src/app/+admin/system/logs/logs.component.ts and 1 other location - About 3 hrs to fix
              client/src/app/+search/search-filters.component.ts on lines 42..59

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

              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 videoDislikesController (req: express.Request, res: express.Response) {
                const video = res.locals.onlyVideo
              
                if (redirectIfNotOwned(video.url, res)) return
              
              
              Severity: Major
              Found in server/core/controllers/activitypub/client.ts and 1 other location - About 3 hrs to fix
              server/core/controllers/activitypub/client.ts on lines 362..370

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

              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 processActivityPubHttpSequentialBroadcast (job: Job<ActivitypubHttpBroadcastPayload>) {
                logger.info('Processing ActivityPub broadcast in job %s.', job.id)
              
                const requestOptions = await buildRequestOptions(job.data)
              
              
              server/core/lib/job-queue/handlers/activitypub-http-broadcast.ts on lines 20..28

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

              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 videoLikesController (req: express.Request, res: express.Response) {
                const video = res.locals.onlyVideo
              
                if (redirectIfNotOwned(video.url, res)) return
              
              
              Severity: Major
              Found in server/core/controllers/activitypub/client.ts and 1 other location - About 3 hrs to fix
              server/core/controllers/activitypub/client.ts on lines 372..380

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

              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.publishedDateRanges = [
                    {
                      id: 'today',
                      label: $localize`Today`
                    },
              Severity: Major
              Found in client/src/app/+search/search-filters.component.ts and 1 other location - About 3 hrs to fix
              client/src/app/+admin/system/logs/logs.component.ts on lines 142..159

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

              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 buildHandlesObserver () {
                  if (typeof (process as any)._getActiveHandles !== 'function') return
              
                  this.meter.createObservableGauge('nodejs_active_handles_total', {
                    description: 'Total number of active handles.'
              server/core/lib/opentelemetry/metric-helpers/nodejs-observers-builder.ts on lines 156..166

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

              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