Chocobozzz/PeerTube

View on GitHub

Showing 3,313 of 3,313 total issues

Function getStateLabel has 29 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  getStateLabel (video: Video) {
    if (!video.state) return ''

    if (video.privacy.id !== VideoPrivacy.PRIVATE && video.state.id === VideoState.PUBLISHED) {
      return $localize`Published`

    Function loadPlaylistElements has 29 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      loadPlaylistElements (playlist: VideoPlaylist, redirectToFirst = false, position?: number) {
        const obs = this.hooks.wrapObsFun(
          this.videoPlaylist.getPlaylistVideos.bind(this.videoPlaylist),
          { videoPlaylistId: playlist.uuid, componentPagination: this.playlistPagination },
          'video-watch',

      Function containerBuilder has 29 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        private containerBuilder (el: HTMLElement) {
          const data = el.dataset as ContainerMarkupData
      
          // Move inner HTML in the new element we'll create
          const content = el.innerHTML
      Severity: Minor
      Found in client/src/app/shared/shared-custom-markup/custom-markup.service.ts - About 1 hr to fix

        Function next has 29 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

              next: async resultList => {
                this.totalRecords = resultList.total
        
                this.abuses = []
        
        

          Function defineGetAccessProgram has 29 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          export function defineGetAccessProgram () {
            const program = new Command()
              .name('get-access-token')
              .description('Get a peertube access token')
              .alias('token')
          Severity: Minor
          Found in apps/peertube-cli/src/peertube-get-access-token.ts - About 1 hr to fix

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

                this.userService.getMyVideoQuotaUsed()
                    .subscribe(data => {
                      this.userVideoQuotaUsed = data.videoQuotaUsed
                      this.userVideoQuotaUsedDaily = data.videoQuotaUsedDaily
                    })
            client/src/app/+videos/+video-edit/video-update.component.ts on lines 107..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 58.

            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

                broadcastMessage: {
                  enabled: CONFIG.BROADCAST_MESSAGE.ENABLED,
                  message: CONFIG.BROADCAST_MESSAGE.MESSAGE,
                  level: CONFIG.BROADCAST_MESSAGE.LEVEL,
                  dismissable: CONFIG.BROADCAST_MESSAGE.DISMISSABLE
            Severity: Major
            Found in server/core/controllers/api/config.ts and 1 other location - About 1 hr to fix
            server/core/lib/server-config-manager.ts on lines 294..299

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

            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

                this.userService.getMyVideoQuotaUsed()
                  .subscribe(data => {
                    this.userVideoQuotaUsed = data.videoQuotaUsed
                    this.userVideoQuotaUsedDaily = data.videoQuotaUsedDaily
                  })
            client/src/app/+videos/+video-edit/video-add-components/video-upload.component.ts on lines 113..117

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

            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

                  broadcastMessage: {
                    enabled: CONFIG.BROADCAST_MESSAGE.ENABLED,
                    message: CONFIG.BROADCAST_MESSAGE.MESSAGE,
                    level: CONFIG.BROADCAST_MESSAGE.LEVEL,
                    dismissable: CONFIG.BROADCAST_MESSAGE.DISMISSABLE
            Severity: Major
            Found in server/core/lib/server-config-manager.ts and 1 other location - About 1 hr to fix
            server/core/controllers/api/config.ts on lines 465..470

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

            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 PREVIEWS_SIZE = {
              width: maxBy(CONFIG.THUMBNAILS.SIZES, 'width').width,
              height: maxBy(CONFIG.THUMBNAILS.SIZES, 'width').height,
              minRemoteWidth: 400
            }
            Severity: Major
            Found in server/core/initializers/constants.ts and 1 other location - About 1 hr to fix
            server/core/initializers/constants.ts on lines 901..905

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

            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

              @Memoize()
              getServerAttributes (actorTableName: string) {
                return ServerModel.getSQLAttributes(`${actorTableName}->Server`, `${actorTableName}.Server.`).join(', ')
              }
            server/core/models/actor/sql/shared/actor-follow-table-attributes.ts on lines 24..27

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

            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

              addInboxProcessedError (type: ActivityType) {
                this.inboxMessages.processed++
                this.inboxMessages.errors++
                this.inboxMessages.errorsPerType[type]++
              }
            Severity: Major
            Found in server/core/lib/stat-manager.ts and 1 other location - About 1 hr to fix
            server/core/lib/stat-manager.ts on lines 37..41

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

            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

              @Memoize()
              getAvatarAttributes (actorTableName: string) {
                return ActorImageModel.getSQLAttributes(`${actorTableName}->Avatars`, `${actorTableName}.Avatars.`).join(', ')
              }
            server/core/models/actor/sql/shared/actor-follow-table-attributes.ts on lines 19..22

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

            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 THUMBNAILS_SIZE = {
              width: minBy(CONFIG.THUMBNAILS.SIZES, 'width').width,
              height: minBy(CONFIG.THUMBNAILS.SIZES, 'width').height,
              minRemoteWidth: 150
            }
            Severity: Major
            Found in server/core/initializers/constants.ts and 1 other location - About 1 hr to fix
            server/core/initializers/constants.ts on lines 906..910

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

            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 static buildPlaylistHTML (options: {
                html: string
                playlist: MVideoPlaylistFull
            
                addOG: boolean
            Severity: Major
            Found in server/core/lib/html/shared/playlist-html.ts and 1 other location - About 1 hr to fix
            server/core/lib/html/shared/video-html.ts on lines 79..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 58.

            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 static buildVideoHTML (options: {
                html: string
                video: MVideoThumbnail
            
                addOG: boolean
            Severity: Major
            Found in server/core/lib/html/shared/video-html.ts and 1 other location - About 1 hr to fix
            server/core/lib/html/shared/playlist-html.ts on lines 78..131

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

            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

              addInboxProcessedSuccess (type: ActivityType) {
                this.inboxMessages.processed++
                this.inboxMessages.successes++
                this.inboxMessages.successesPerType[type]++
              }
            Severity: Major
            Found in server/core/lib/stat-manager.ts and 1 other location - About 1 hr to fix
            server/core/lib/stat-manager.ts on lines 43..47

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

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

            async function up (utils: {
              transaction: Sequelize.Transaction
              queryInterface: Sequelize.QueryInterface
              sequelize: Sequelize.Sequelize
              db: any
            Severity: Minor
            Found in server/core/initializers/migrations/0585-video-file-names.ts - About 1 hr to fix

              Function sendCachedResponse has 28 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                private sendCachedResponse (request: express.Request, response: express.Response, cacheObject: CacheObject, duration: number) {
                  const headers = response.getHeaders()
              
                  if (isTestInstance()) {
                    Object.assign(headers, {
              Severity: Minor
              Found in server/core/middlewares/cache/shared/api-cache.ts - About 1 hr to fix

                Function plainTextPlugin has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                function plainTextPlugin (markdownIt: any) {
                  function plainTextRule (state: any) {
                    const text = scan(state.tokens)
                
                    markdownIt.plainText = text
                Severity: Minor
                Found in server/core/helpers/markdown.ts - About 1 hr to fix
                  Severity
                  Category
                  Status
                  Source
                  Language