Chocobozzz/PeerTube

View on GitHub

Showing 3,313 of 3,313 total issues

Function createEl has 71 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  createEl () {
    const div = videojs.dom.createEl('div', { className: 'vjs-peertube' })
    const subDivP2P = videojs.dom.createEl('div', {
      className: 'vjs-peertube-hidden' // Hide the stats before we get the info
    }) as HTMLDivElement
Severity: Major
Found in client/src/assets/player/shared/control-bar/p2p-info-button.ts - About 2 hrs to fix

    VideoModelBuilder has 25 functions (exceeds 20 allowed). Consider refactoring.
    Open

    export class VideoModelBuilder {
      private videosMemo: { [ id: number ]: VideoModel }
      private videoStreamingPlaylistMemo: { [ id: number ]: VideoStreamingPlaylistModel }
      private videoFileMemo: { [ id: number ]: VideoFileModel }
    
    
    Severity: Minor
    Found in server/core/models/video/sql/video/shared/video-model-builder.ts - About 2 hrs to fix

      MuxingSession has 25 functions (exceeds 20 allowed). Consider refactoring.
      Open

      class MuxingSession extends EventEmitter {
      
        private transcodingWrapper: AbstractTranscodingWrapper
      
        private readonly context: any
      Severity: Minor
      Found in server/core/lib/live/shared/muxing-session.ts - About 2 hrs to fix

        JobQueue has 25 functions (exceeds 20 allowed). Consider refactoring.
        Open

        class JobQueue {
        
          private static instance: JobQueue
        
          private workers: { [id in JobType]?: Worker } = {}
        Severity: Minor
        Found in server/core/lib/job-queue/job-queue.ts - About 2 hrs to fix

          Function videoModelToActivityPubObject has 70 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          export function videoModelToActivityPubObject (video: MVideoAP): VideoObject {
            const language = video.language
              ? { identifier: video.language, name: getLanguageLabel(video.language) }
              : undefined
          
          
          Severity: Major
          Found in server/core/models/video/formatter/video-activity-pub-format.ts - About 2 hrs to fix

            Function definePluginsProgram has 70 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            export function definePluginsProgram () {
              const program = new Command()
            
              program
                .name('plugins')
            Severity: Major
            Found in apps/peertube-cli/src/peertube-plugins.ts - About 2 hrs to fix

              Function process has 70 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                process () {
                  const job = this.options.job
                  const payload = job.payload
              
                  return new Promise<void>(async (res, rej) => {
              Severity: Major
              Found in apps/peertube-runner/src/server/process/shared/process-live.ts - About 2 hrs to fix

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

                  askResetPassword (options: OverrideCommandOptions & {
                    email: string
                  }) {
                    const { email } = options
                    const path = '/api/v1/users/ask-reset-password'
                Severity: Major
                Found in packages/server-commands/src/users/users-command.ts and 2 other locations - About 2 hrs to fix
                packages/server-commands/src/custom-pages/custom-pages-command.ts on lines 18..32
                packages/server-commands/src/server/plugins-command.ts on lines 194..208

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

                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

                  uninstall (options: OverrideCommandOptions & {
                    npmName: string
                  }) {
                    const { npmName } = options
                    const apiPath = '/api/v1/plugins/uninstall'
                Severity: Major
                Found in packages/server-commands/src/server/plugins-command.ts and 2 other locations - About 2 hrs to fix
                packages/server-commands/src/custom-pages/custom-pages-command.ts on lines 18..32
                packages/server-commands/src/users/users-command.ts on lines 22..36

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

                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

                  updateInstanceHomepage (options: OverrideCommandOptions & {
                    content: string
                  }) {
                    const { content } = options
                    const path = '/api/v1/custom-pages/homepage/instance'
                packages/server-commands/src/server/plugins-command.ts on lines 194..208
                packages/server-commands/src/users/users-command.ts on lines 22..36

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

                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 VIDEO_CHAPTER_TITLE_VALIDATOR: BuildFormValidator = {
                  VALIDATORS: [ Validators.minLength(2), Validators.maxLength(100) ], // Required is set dynamically
                  MESSAGES: {
                    required: $localize`A chapter title is required.`,
                    minlength: $localize`A chapter title should be more than 2 characters long.`,
                client/src/app/shared/form-validators/video-validators.ts on lines 29..36

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

                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

                  removeRegistrations (registrationsArg: UserRegistration | UserRegistration[]) {
                    const registrations = arrayify(registrationsArg)
                
                    return from(registrations)
                      .pipe(
                client/src/app/+admin/system/runners/runner.service.ts on lines 127..136

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

                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 VIDEO_PASSWORD_VALIDATOR: BuildFormValidator = {
                  VALIDATORS: [ Validators.minLength(2), Validators.maxLength(100) ], // Required is set dynamically
                  MESSAGES: {
                    minLength: $localize`A password should be at least 2 characters long.`,
                    maxLength: $localize`A password should be shorter than 100 characters long.`,
                Severity: Major
                Found in client/src/app/shared/form-validators/video-validators.ts and 1 other location - About 2 hrs to fix
                client/src/app/shared/form-validators/video-chapter-validators.ts on lines 4..11

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

                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

                  requestNewUserExport (options: {
                    userId: number
                    withVideoFiles: boolean
                  }) {
                    const { userId, withVideoFiles } = options
                client/src/app/shared/shared-users/two-factor.service.ts on lines 41..51

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

                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

                  disableTwoFactor (options: {
                    userId: number
                    currentPassword?: string
                  }) {
                    const { userId, currentPassword } = options
                Severity: Major
                Found in client/src/app/shared/shared-users/two-factor.service.ts and 1 other location - About 2 hrs to fix
                client/src/app/+my-account/my-account-import-export/user-import-export.service.ts on lines 34..44

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

                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

                  removeJobs (jobsArg: RunnerJob | RunnerJob[]) {
                    const jobs = arrayify(jobsArg)
                
                    return from(jobs)
                      .pipe(
                Severity: Major
                Found in client/src/app/+admin/system/runners/runner.service.ts and 1 other location - About 2 hrs to fix
                client/src/app/+admin/moderation/registration-list/admin-registration.service.ts on lines 71..80

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

                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 menu.component.ts has 282 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                import { CommonModule, ViewportScroller } from '@angular/common'
                import { Component, OnDestroy, OnInit, ViewChild } from '@angular/core'
                import { Router, RouterLink, RouterLinkActive } from '@angular/router'
                import {
                  AuthService,
                Severity: Minor
                Found in client/src/app/menu/menu.component.ts - About 2 hrs to fix

                  Function constructor has 69 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    constructor (
                      private userNotificationService: UserNotificationService,
                      private serverService: ServerService,
                      private notifier: Notifier
                    ) {

                    Function buildPeerTubeHelpers has 69 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      private buildPeerTubeHelpers (pluginInfo: PluginInfo): RegisterClientHelpers {
                        const { plugin } = pluginInfo
                        const npmName = pluginInfo.plugin.npmName
                    
                        return {
                    Severity: Major
                    Found in client/src/app/core/plugins/plugin.service.ts - About 2 hrs to fix

                      Function waitJobs has 69 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      async function waitJobs (
                        serversArg: PeerTubeServer[] | PeerTubeServer,
                        options: {
                          skipDelayed?: boolean // default false
                          runnerJobs?: boolean // default false
                      Severity: Major
                      Found in packages/server-commands/src/server/jobs.ts - About 2 hrs to fix
                        Severity
                        Category
                        Status
                        Source
                        Language