Chocobozzz/PeerTube

View on GitHub

Showing 3,313 of 3,313 total issues

File signup.e2e-spec.ts has 312 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import { AdminConfigPage } from '../po/admin-config.po'
import { AdminRegistrationPage } from '../po/admin-registration.po'
import { LoginPage } from '../po/login.po'
import { SignupPage } from '../po/signup.po'
import {
Severity: Minor
Found in client/e2e/src/suites-local/signup.e2e-spec.ts - About 3 hrs to fix

    File download.ts has 311 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    import { forceNumber, maxBy } from '@peertube/peertube-core-utils'
    import { FileStorage, HttpStatusCode, VideoResolution, VideoStreamingPlaylistType } from '@peertube/peertube-models'
    import { exists } from '@server/helpers/custom-validators/misc.js'
    import { logger, loggerTagsFactory } from '@server/helpers/logger.js'
    import { CONFIG } from '@server/initializers/config.js'
    Severity: Minor
    Found in server/core/controllers/download.ts - About 3 hrs to fix

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

        uninstall (pluginName: string, pluginType: PluginType_Type) {
          const body: ManagePlugin = {
            npmName: this.pluginService.nameToNpmName(pluginName, pluginType)
          }
      
      
      Severity: Major
      Found in client/src/app/+admin/plugins/shared/plugin-api.service.ts and 1 other location - About 3 hrs to fix
      client/src/app/+admin/plugins/shared/plugin-api.service.ts on lines 104..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 104.

      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

        navigateToNextPlaylistVideo () {
          const next = this.findPlaylistVideo(this.currentPlaylistPosition + 1, 'next')
          if (!next) return
      
          const start = next.startTimestamp
      client/src/app/+videos/+video-watch/shared/player-widgets/video-watch-playlist.component.ts on lines 184..191

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

      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 whereTagsOneOf (tagsOneOf: string[]) {
          const tagsOneOfLower = tagsOneOf.map(t => t.toLowerCase())
      
          this.cte.push(
            '"tagsOneOf" AS (' +
      server/core/models/video/sql/video/videos-id-list-query-builder.ts on lines 464..476

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

      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

        constructor (
          protected route: ActivatedRoute,
          protected router: Router,
          private notifier: Notifier,
          private abuseService: AbuseService,
      client/src/app/+login/login.component.ts on lines 76..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 104.

      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

        constructor (
          protected formReactiveService: FormReactiveService,
          private route: ActivatedRoute,
          private modalService: NgbModal,
          private authService: AuthService,
      Severity: Major
      Found in client/src/app/+login/login.component.ts and 1 other location - About 3 hrs to fix
      client/src/app/shared/shared-abuse-list/abuse-list-table.component.ts on lines 99..112

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

      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 whereAutoTagOneOf (autoTagOneOf: string[]) {
          const tags = autoTagOneOf.map(t => t.toLowerCase())
      
          this.cte.push(
            '"autoTagsOneOf" AS (' +
      server/core/models/video/sql/video/videos-id-list-query-builder.ts on lines 450..462

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

      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 putBodyRequest (options: InternalCommonCommandOptions & {
          fields?: { [ fieldName: string ]: any }
          headers?: { [name: string]: string }
        }) {
          const { fields, headers } = options
      Severity: Major
      Found in packages/server-commands/src/shared/abstract-command.ts and 1 other location - About 3 hrs to fix
      packages/server-commands/src/shared/abstract-command.ts on lines 123..135

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

      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 videoFeedsPodcastSetCacheKey = [
        (req: express.Request, res: express.Response, next: express.NextFunction) => {
          if (req.query.videoChannelId) {
            res.locals.apicacheGroups = [ buildPodcastGroupsCache({ channelId: req.query.videoChannelId }) ]
          }
      Severity: Major
      Found in server/core/middlewares/cache/cache.ts and 1 other location - About 3 hrs to fix
      server/core/middlewares/cache/cache.ts on lines 50..58

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

      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

        navigateToPreviousPlaylistVideo () {
          const previous = this.findPlaylistVideo(this.currentPlaylistPosition - 1, 'previous')
          if (!previous) return
      
          const start = previous.startTimestamp
      client/src/app/+videos/+video-watch/shared/player-widgets/video-watch-playlist.component.ts on lines 217..224

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

      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 apVideoChaptersSetCacheKey = [
        (req: express.Request, res: express.Response, next: express.NextFunction) => {
          if (req.params.id) {
            res.locals.apicacheGroups = [ buildAPVideoChaptersGroupsCache({ videoId: req.params.id }) ]
          }
      Severity: Major
      Found in server/core/middlewares/cache/cache.ts and 1 other location - About 3 hrs to fix
      server/core/middlewares/cache/cache.ts on lines 40..48

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

      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

        update (pluginName: string, pluginType: PluginType_Type) {
          const body: ManagePlugin = {
            npmName: this.pluginService.nameToNpmName(pluginName, pluginType)
          }
      
      
      Severity: Major
      Found in client/src/app/+admin/plugins/shared/plugin-api.service.ts and 1 other location - About 3 hrs to fix
      client/src/app/+admin/plugins/shared/plugin-api.service.ts on lines 95..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 104.

      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 postBodyRequest (options: InternalCommonCommandOptions & {
          fields?: { [ fieldName: string ]: any }
          headers?: { [name: string]: string }
        }) {
          const { fields, headers } = options
      Severity: Major
      Found in packages/server-commands/src/shared/abstract-command.ts and 1 other location - About 3 hrs to fix
      packages/server-commands/src/shared/abstract-command.ts on lines 109..121

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

      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

      Function listForApi has 86 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        static listForApi (options: {
          start: number
          count: number
          sort: string
          target: VideoRedundanciesTarget
      Severity: Major
      Found in server/core/models/redundancy/video-redundancy.ts - About 3 hrs to fix

        Function processGenerateStoryboard has 86 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        async function processGenerateStoryboard (job: Job): Promise<void> {
          const payload = job.data as GenerateStoryboardPayload
          const lTags = lTagsBase(payload.videoUUID)
        
          logger.info('Processing generate storyboard of %s in job %s.', payload.videoUUID, job.id, lTags)
        Severity: Major
        Found in server/core/lib/job-queue/handlers/generate-storyboard.ts - About 3 hrs to fix

          Function createOptimizeOrMergeAudioJobs has 86 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            async createOptimizeOrMergeAudioJobs (options: {
              video: MVideoFullLight
              videoFile: MVideoFile
              isNewVideo: boolean
              user: MUserId

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

            import { omit, pick } from '@peertube/peertube-core-utils'
            import {
              HttpStatusCode,
              MyUser,
              ResultList,
            Severity: Minor
            Found in packages/server-commands/src/users/users-command.ts - About 3 hrs to fix

              Identical 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
                  if (!await doesVideoExist(req.params.videoId, res)) return
                  if (!await doesVideoBlacklistExist(res.locals.videoAll.id, res)) return
              
              
              Severity: Major
              Found in server/core/middlewares/validators/videos/video-blacklist.ts and 1 other location - About 3 hrs to fix
              server/core/middlewares/validators/videos/video-blacklist.ts on lines 11..17

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

              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

              Identical 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
                  if (!await doesVideoExist(req.params.videoId, res)) return
                  if (!await doesVideoBlacklistExist(res.locals.videoAll.id, res)) return
              
              
              Severity: Major
              Found in server/core/middlewares/validators/videos/video-blacklist.ts and 1 other location - About 3 hrs to fix
              server/core/middlewares/validators/videos/video-blacklist.ts on lines 54..60

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

              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