Chocobozzz/PeerTube

View on GitHub

Showing 3,313 of 3,313 total issues

Function getOutputFromFile has 38 lines of code (exceeds 25 allowed). Consider refactoring.
Open

async function getOutputFromFile (options: {
  path: string
  startDate: Date
  endDate: Date
  level: ServerLogLevel
Severity: Minor
Found in server/core/controllers/api/server/logs.ts - About 1 hr to fix

    Function watchTSFiles has 38 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      private watchTSFiles () {
        const startStreamDateTime = new Date().getTime()
    
        const addHandler = async (segmentPath: string) => {
          if (segmentPath.endsWith('.ts') !== true) return
    Severity: Minor
    Found in server/core/lib/live/shared/muxing-session.ts - About 1 hr to fix

      Function videoStudioAddEditionValidator has 38 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        async (req: express.Request, res: express.Response, next: express.NextFunction) => {
          if (CONFIG.VIDEO_STUDIO.ENABLED !== true) {
            res.fail({
              status: HttpStatusCode.BAD_REQUEST_400,
              message: 'Video studio is disabled on this instance'
      Severity: Minor
      Found in server/core/middlewares/validators/videos/video-studio.ts - About 1 hr to fix

        Function buildTranscodingManager has 38 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          private buildTranscodingManager () {
            const self = this
        
            function addProfile (type: 'live' | 'vod', encoder: string, profile: string, builder: EncoderOptionsBuilder) {
              if (profile === 'default') {
        Severity: Minor
        Found in server/core/lib/plugins/register-helpers.ts - About 1 hr to fix

          Function processVideoLiveEnding has 38 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          async function processVideoLiveEnding (job: Job) {
            const payload = job.data as VideoLiveEndingPayload
          
            logger.info('Processing video live ending for %s.', payload.videoId, { payload, ...lTags() })
          
          
          Severity: Minor
          Found in server/core/lib/job-queue/handlers/video-live-ending.ts - About 1 hr to fix

            Function processDeleteActivity has 38 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            async function processDeleteActivity (options: APProcessorOptions<ActivityDelete>) {
              const { activity, byActor } = options
            
              const objectUrl = typeof activity.object === 'string' ? activity.object : activity.object.id
            
            
            Severity: Minor
            Found in server/core/lib/activitypub/process/process-delete.ts - About 1 hr to fix

              Function initTouchStartEvents has 38 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                private initTouchStartEvents () {
                  const handleTouchStart = (event: TouchEvent, onlyDetectDoubleTap = false) => {
                    debugLogger('Handle touch start')
              
                    if (this.tapTimeout) {
              Severity: Minor
              Found in client/src/assets/player/shared/mobile/peertube-mobile-plugin.ts - About 1 hr to fix

                Function onContextMenu has 38 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  private onContextMenu (e: TouchEvent & MouseEvent) {
                    // If this event happens while the custom menu is open, close it and do
                    // nothing else. This will cause native contextmenu events to be intercepted
                    // once again; so, the next time a contextmenu event is encountered, we'll
                    // open the custom menu.
                Severity: Minor
                Found in client/src/assets/player/shared/context-menu/context-menu-plugin.ts - About 1 hr to fix

                  Function importVideo has 38 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    importVideo () {
                      this.isImportingVideo = true
                  
                      const videoUpdate: VideoUpdate = {
                        privacy: this.highestPrivacy,

                    Function buildInternalActions has 38 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      private buildInternalActions (): DropdownAction<ProcessedAbuse>[] {
                        return [
                          {
                            label: $localize`Internal actions`,
                            isHeader: true

                      Function show has 38 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                        show (currentVideoTimestamp?: number, currentPlaylistPosition?: number) {
                          let subtitle: string
                          if (this.videoCaptions && this.videoCaptions.length !== 0) {
                            subtitle = this.videoCaptions[0].language.id
                          }
                      Severity: Minor
                      Found in client/src/app/shared/shared-share-modal/video-share.component.ts - About 1 hr to fix

                        Function setupStateTracking has 38 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                          private setupStateTracking () {
                            let currentState: 'playing' | 'paused' | 'unstarted' | 'ended' = 'unstarted'
                        
                            this.videoElInterval = setInterval(() => {
                              const position = this.player?.currentTime() ?? 0
                        Severity: Minor
                        Found in client/src/standalone/videos/embed-api.ts - About 1 hr to fix

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

                            {
                              for (const column of [ 'playlistUrl', 'segmentsSha256Url' ]) {
                                const data = {
                                  type: Sequelize.STRING,
                                  allowNull: true,
                          server/core/initializers/migrations/0655-streaming-playlist-filenames.ts on lines 28..38
                          server/core/initializers/migrations/0655-streaming-playlist-filenames.ts on lines 46..56

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

                          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

                            async toggleSignupEmailVerification (required: boolean) {
                              if (await isCheckboxSelected('signupRequiresEmailVerification') === required) return
                          
                              const checkbox = await getCheckbox('signupRequiresEmailVerification')
                          
                          
                          Severity: Major
                          Found in client/e2e/src/po/admin-config.po.ts and 2 other locations - About 1 hr to fix
                          client/e2e/src/po/admin-config.po.ts on lines 30..37
                          client/e2e/src/po/admin-config.po.ts on lines 39..46

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

                          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

                                  filesRedundancies.push({
                                    id: redundancy.id,
                                    fileUrl: redundancy.fileUrl,
                                    strategy: redundancy.strategy,
                                    createdAt: redundancy.createdAt,
                          Severity: Major
                          Found in server/core/models/redundancy/video-redundancy.ts and 2 other locations - About 1 hr to fix
                          client/src/app/+my-account/my-account-settings/my-account-notification-preferences/my-account-notification-preferences.component.ts on lines 99..107
                          client/src/app/core/users/user-local-storage.service.ts on lines 124..132

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

                          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

                              this.rightNotifications = {
                                abuseAsModerator: UserRight.MANAGE_ABUSES,
                                videoAutoBlacklistAsModerator: UserRight.MANAGE_VIDEO_BLACKLIST,
                                newUserRegistration: UserRight.MANAGE_USERS,
                                newInstanceFollower: UserRight.MANAGE_SERVER_FOLLOW,
                          client/src/app/core/users/user-local-storage.service.ts on lines 124..132
                          server/core/models/redundancy/video-redundancy.ts on lines 655..663

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

                          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

                                getBaseRouterRoute: () => {
                                  const pathPrefix = PluginsManager.getPluginPathPrefix(pluginInfo.isTheme)
                                  return environment.apiUrl + `${pathPrefix}/${plugin.name}/${plugin.version}/router`
                                },
                          Severity: Major
                          Found in client/src/app/core/plugins/plugin.service.ts and 2 other locations - About 1 hr to fix
                          client/src/app/core/plugins/plugin.service.ts on lines 222..225
                          client/src/app/core/plugins/plugin.service.ts on lines 232..235

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

                          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

                            body('name')
                              .trim()
                              .custom(isVideoNameValid).withMessage(
                                `Should have a video name between ${CONSTRAINTS_FIELDS.VIDEOS.NAME.min} and ${CONSTRAINTS_FIELDS.VIDEOS.NAME.max} characters long`
                              ),
                          Severity: Major
                          Found in server/core/middlewares/validators/videos/videos.ts and 2 other locations - About 1 hr to fix
                          server/core/middlewares/validators/videos/video-imports.ts on lines 35..39
                          server/core/middlewares/validators/videos/videos.ts on lines 145..149

                          Duplicated Code

                          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                          Tuning

                          This issue has a mass of 65.

                          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

                              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: ' +
                                  CONSTRAINTS_FIELDS.VIDEO_PLAYLISTS.IMAGE.EXTNAME.join(', ')
                          server/core/middlewares/validators/videos/videos.ts on lines 351..355
                          server/core/middlewares/validators/videos/videos.ts on lines 356..360

                          Duplicated Code

                          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                          Tuning

                          This issue has a mass of 65.

                          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

                            {
                              for (const column of [ 'playlistFilename', 'segmentsSha256Filename' ]) {
                                const data = {
                                  type: Sequelize.STRING,
                                  allowNull: true,
                          server/core/initializers/migrations/0655-streaming-playlist-filenames.ts on lines 9..19
                          server/core/initializers/migrations/0655-streaming-playlist-filenames.ts on lines 46..56

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

                          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