Chocobozzz/PeerTube

View on GitHub

Showing 3,313 of 3,313 total issues

Function addVideo has 51 lines of code (exceeds 25 allowed). Consider refactoring.
Open

async function addVideo (options: {
  req: express.Request
  res: express.Response
  videoPhysicalFile: express.VideoLegacyUploadFile
  videoInfo: VideoCreate
Severity: Major
Found in server/core/controllers/api/videos/upload.ts - About 2 hrs to fix

    Function addVideosToFeed has 51 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function addVideosToFeed (feed: Feed, videos: VideoModel[]) {
      /**
       * Adding video items to the feed object, one at a time
       */
      for (const video of videos) {
    Severity: Major
    Found in server/core/controllers/feeds/video-feeds.ts - About 2 hrs to fix

      Function run has 50 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      async function run () {
        await initDatabaseModels(true)
      
        JobQueue.Instance.init()
      
      
      Severity: Minor
      Found in server/scripts/create-move-video-storage-job.ts - About 2 hrs to fix

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

          static listForApi (parameters: {
            start: number
            count: number
            sort: string
            search?: string
        Severity: Minor
        Found in server/core/models/account/account-blocklist.ts - About 2 hrs to fix

          Function buildVideosFromRows has 50 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            buildVideosFromRows (options: {
              rows: SQLRow[]
              include?: VideoIncludeType
              rowsWebVideoFiles?: SQLRow[]
              rowsStreamingPlaylist?: SQLRow[]
          Severity: Minor
          Found in server/core/models/video/sql/video/shared/video-model-builder.ts - About 2 hrs to fix

            Function getBypassFromPasswordGrant has 50 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            async function getBypassFromPasswordGrant (username: string, password: string): Promise<BypassLogin> {
              const plugins = PluginManager.Instance.getIdAndPassAuths()
              const pluginAuths: { npmName?: string, registerAuthOptions: RegisterServerAuthPassOptions }[] = []
            
              for (const plugin of plugins) {
            Severity: Minor
            Found in server/core/lib/auth/external-auth.ts - About 2 hrs to fix

              Function generateSubtitle has 50 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              export async function generateSubtitle (options: {
                video: MVideoUUID
              }) {
                const outputPath = join(CONFIG.STORAGE.TMP_DIR, 'transcription', buildSUUID())
              
              
              Severity: Minor
              Found in server/core/lib/video-captions.ts - About 2 hrs to fix

                Function buildImporters has 50 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  private buildImporters (user: MUserDefault) {
                    // Keep consistency in import order (don't import videos before channels for example)
                    return [
                      {
                        name: 'account' as 'account',
                Severity: Minor
                Found in server/core/lib/user-import-export/user-importer.ts - About 2 hrs to fix

                  Function getStats has 50 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    async getStats () {
                      const { totalLocalVideos, totalLocalVideoViews, totalVideos } = await VideoModel.getStats()
                      const { totalLocalVideoComments, totalVideoComments } = await VideoCommentModel.getStats()
                      const {
                        totalUsers,
                  Severity: Minor
                  Found in server/core/lib/stat-manager.ts - About 2 hrs to fix

                    Function getContextMenuOptions has 50 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      private getContextMenuOptions () {
                    
                        const content = () => {
                          const self = this
                          const player = this.player
                    Severity: Minor
                    Found in client/src/assets/player/peertube-player.ts - About 2 hrs to fix

                      Function updateForm has 50 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                        updateForm () {
                          const defaultValues: any = {
                            nsfw: 'false',
                            commentsPolicy: this.serverConfig.defaults.publish.commentsPolicy,
                            downloadEnabled: this.serverConfig.defaults.publish.downloadEnabled,
                      Severity: Minor
                      Found in client/src/app/+videos/+video-edit/shared/video-edit.component.ts - About 2 hrs to fix

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

                        export const VIDEO_DESCRIPTION_VALIDATOR: BuildFormValidator = {
                          VALIDATORS: [ Validators.minLength(3), Validators.maxLength(10000) ],
                          MESSAGES: {
                            minlength: $localize`Video description must be at least 3 characters long.`,
                            maxlength: $localize`Video description cannot be more than 10000 characters long.`
                        Severity: Major
                        Found in client/src/app/shared/form-validators/video-validators.ts and 8 other locations - About 2 hrs to fix
                        client/src/app/shared/form-validators/user-validators.ts on lines 86..95
                        client/src/app/shared/form-validators/user-validators.ts on lines 128..137
                        client/src/app/shared/form-validators/user-validators.ts on lines 139..148
                        client/src/app/shared/form-validators/video-block-validators.ts on lines 4..10
                        client/src/app/shared/form-validators/video-channel-validators.ts on lines 30..39
                        client/src/app/shared/form-validators/video-channel-validators.ts on lines 41..50
                        client/src/app/shared/form-validators/video-playlist-validators.ts on lines 27..36
                        client/src/app/shared/form-validators/video-validators.ts on lines 81..87

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

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

                        export const USER_PASSWORD_OPTIONAL_VALIDATOR: BuildFormValidator = {
                          VALIDATORS: [
                            Validators.minLength(6),
                            Validators.maxLength(255)
                          ],
                        Severity: Major
                        Found in client/src/app/shared/form-validators/user-validators.ts and 8 other locations - About 2 hrs to fix
                        client/src/app/shared/form-validators/user-validators.ts on lines 128..137
                        client/src/app/shared/form-validators/user-validators.ts on lines 139..148
                        client/src/app/shared/form-validators/video-block-validators.ts on lines 4..10
                        client/src/app/shared/form-validators/video-channel-validators.ts on lines 30..39
                        client/src/app/shared/form-validators/video-channel-validators.ts on lines 41..50
                        client/src/app/shared/form-validators/video-playlist-validators.ts on lines 27..36
                        client/src/app/shared/form-validators/video-validators.ts on lines 65..71
                        client/src/app/shared/form-validators/video-validators.ts on lines 81..87

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

                        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 processAudioMergeTranscoding has 50 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        export async function processAudioMergeTranscoding (options: ProcessOptions<RunnerJobVODAudioMergeTranscodingPayload>) {
                          const { server, job, runnerToken } = options
                          const payload = job.payload
                        
                          let ffmpegProgress: number
                        Severity: Minor
                        Found in apps/peertube-runner/src/server/process/shared/process-vod.ts - About 2 hrs to fix

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

                          export const VIDEO_SUPPORT_VALIDATOR: BuildFormValidator = {
                            VALIDATORS: [ Validators.minLength(3), Validators.maxLength(1000) ],
                            MESSAGES: {
                              minlength: $localize`Video support must be at least 3 characters long.`,
                              maxlength: $localize`Video support cannot be more than 1000 characters long.`
                          Severity: Major
                          Found in client/src/app/shared/form-validators/video-validators.ts and 8 other locations - About 2 hrs to fix
                          client/src/app/shared/form-validators/user-validators.ts on lines 86..95
                          client/src/app/shared/form-validators/user-validators.ts on lines 128..137
                          client/src/app/shared/form-validators/user-validators.ts on lines 139..148
                          client/src/app/shared/form-validators/video-block-validators.ts on lines 4..10
                          client/src/app/shared/form-validators/video-channel-validators.ts on lines 30..39
                          client/src/app/shared/form-validators/video-channel-validators.ts on lines 41..50
                          client/src/app/shared/form-validators/video-playlist-validators.ts on lines 27..36
                          client/src/app/shared/form-validators/video-validators.ts on lines 65..71

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

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

                          export const USER_BAN_REASON_VALIDATOR: BuildFormValidator = {
                            VALIDATORS: [
                              Validators.minLength(3),
                              Validators.maxLength(250)
                            ],
                          Severity: Major
                          Found in client/src/app/shared/form-validators/user-validators.ts and 8 other locations - About 2 hrs to fix
                          client/src/app/shared/form-validators/user-validators.ts on lines 86..95
                          client/src/app/shared/form-validators/user-validators.ts on lines 128..137
                          client/src/app/shared/form-validators/video-block-validators.ts on lines 4..10
                          client/src/app/shared/form-validators/video-channel-validators.ts on lines 30..39
                          client/src/app/shared/form-validators/video-channel-validators.ts on lines 41..50
                          client/src/app/shared/form-validators/video-playlist-validators.ts on lines 27..36
                          client/src/app/shared/form-validators/video-validators.ts on lines 65..71
                          client/src/app/shared/form-validators/video-validators.ts on lines 81..87

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

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

                          export const VIDEO_PLAYLIST_DESCRIPTION_VALIDATOR: BuildFormValidator = {
                            VALIDATORS: [
                              Validators.minLength(3),
                              Validators.maxLength(1000)
                            ],
                          client/src/app/shared/form-validators/user-validators.ts on lines 86..95
                          client/src/app/shared/form-validators/user-validators.ts on lines 128..137
                          client/src/app/shared/form-validators/user-validators.ts on lines 139..148
                          client/src/app/shared/form-validators/video-block-validators.ts on lines 4..10
                          client/src/app/shared/form-validators/video-channel-validators.ts on lines 30..39
                          client/src/app/shared/form-validators/video-channel-validators.ts on lines 41..50
                          client/src/app/shared/form-validators/video-validators.ts on lines 65..71
                          client/src/app/shared/form-validators/video-validators.ts on lines 81..87

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

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

                          export const VIDEO_CHANNEL_SUPPORT_VALIDATOR: BuildFormValidator = {
                            VALIDATORS: [
                              Validators.minLength(3),
                              Validators.maxLength(1000)
                            ],
                          client/src/app/shared/form-validators/user-validators.ts on lines 86..95
                          client/src/app/shared/form-validators/user-validators.ts on lines 128..137
                          client/src/app/shared/form-validators/user-validators.ts on lines 139..148
                          client/src/app/shared/form-validators/video-block-validators.ts on lines 4..10
                          client/src/app/shared/form-validators/video-channel-validators.ts on lines 30..39
                          client/src/app/shared/form-validators/video-playlist-validators.ts on lines 27..36
                          client/src/app/shared/form-validators/video-validators.ts on lines 65..71
                          client/src/app/shared/form-validators/video-validators.ts on lines 81..87

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

                          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 buildResumeUpload has 50 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                            protected async buildResumeUpload <T> (options: OverrideCommandOptions & {
                              path: string
                          
                              fixture: string
                              attaches?: Record<string, string>
                          Severity: Minor
                          Found in packages/server-commands/src/shared/abstract-command.ts - About 2 hrs to fix

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

                            export const USER_DESCRIPTION_VALIDATOR: BuildFormValidator = {
                              VALIDATORS: [
                                Validators.minLength(3),
                                Validators.maxLength(1000)
                              ],
                            Severity: Major
                            Found in client/src/app/shared/form-validators/user-validators.ts and 8 other locations - About 2 hrs to fix
                            client/src/app/shared/form-validators/user-validators.ts on lines 86..95
                            client/src/app/shared/form-validators/user-validators.ts on lines 139..148
                            client/src/app/shared/form-validators/video-block-validators.ts on lines 4..10
                            client/src/app/shared/form-validators/video-channel-validators.ts on lines 30..39
                            client/src/app/shared/form-validators/video-channel-validators.ts on lines 41..50
                            client/src/app/shared/form-validators/video-playlist-validators.ts on lines 27..36
                            client/src/app/shared/form-validators/video-validators.ts on lines 65..71
                            client/src/app/shared/form-validators/video-validators.ts on lines 81..87

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

                            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