Chocobozzz/PeerTube

View on GitHub

Showing 3,313 of 3,313 total issues

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

  private buildLibUVActiveRequestsObserver () {
    if (typeof (process as any)._getActiveRequests !== 'function') return

    this.meter.createObservableGauge('nodejs_active_requests_total', {
      description: 'Total number of active libuv requests.'
server/core/lib/opentelemetry/metric-helpers/nodejs-observers-builder.ts on lines 83..93

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

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

    this.meter.createObservableGauge('peertube_ap_inbox_success_total', {
      description: 'Total inbox messages processed with success'
    }).addCallback(async observableResult => {
      const stats = await this.getInstanceStats()

server/core/lib/opentelemetry/metric-helpers/stats-observers-builder.ts on lines 168..176

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

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

  private buildHandlers () {
    const handlers: KeyHandler[] = [
      // Play
      {
        accept: e => (e.key === ' ' || e.key === 'MediaPlayPause'),
Severity: Major
Found in client/src/assets/player/shared/hotkeys/peertube-hotkeys-plugin.ts - About 3 hrs to fix

    File emailer.ts has 293 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    import { arrayify } from '@peertube/peertube-core-utils'
    import { EmailPayload, SendEmailDefaultOptions, UserExportState, UserRegistrationState } from '@peertube/peertube-models'
    import { isTestOrDevInstance, root } from '@peertube/peertube-node-utils'
    import { UserModel } from '@server/models/user/user.js'
    import { readFileSync } from 'fs'
    Severity: Minor
    Found in server/core/lib/emailer.ts - About 3 hrs to fix

      AbstractVideoQueryBuilder has 26 functions (exceeds 20 allowed). Consider refactoring.
      Open

      export class AbstractVideoQueryBuilder extends AbstractRunQuery {
        protected attributes: { [key: string]: string } = {}
      
        protected joins = ''
        protected where: string

        VideoTableAttributes has 26 functions (exceeds 20 allowed). Consider refactoring.
        Open

        export class VideoTableAttributes {
        
          constructor (private readonly mode: 'get' | 'list') {
        
          }
        Severity: Minor
        Found in server/core/models/video/sql/video/shared/video-table-attributes.ts - About 3 hrs to fix

          PeerTubePlugin has 26 functions (exceeds 20 allowed). Consider refactoring.
          Open

          class PeerTubePlugin extends Plugin {
            declare private readonly videoViewUrl: () => string
            declare private readonly authorizationHeader: () => string
            declare private readonly initialInactivityTimeout: number
          
          
          Severity: Minor
          Found in client/src/assets/player/shared/peertube/peertube-plugin.ts - About 3 hrs to fix

            VideoMiniatureComponent has 26 functions (exceeds 20 allowed). Consider refactoring.
            Open

            @Component({
              selector: 'my-video-miniature',
              styleUrls: [ './video-miniature.component.scss' ],
              templateUrl: './video-miniature.component.html',
              changeDetection: ChangeDetectionStrategy.OnPush,

              PlayerOptionsBuilder has 26 functions (exceeds 20 allowed). Consider refactoring.
              Open

              export class PlayerOptionsBuilder {
                private autoplay: boolean
              
                private controls: boolean
                private controlBar: boolean
              Severity: Minor
              Found in client/src/standalone/videos/shared/player-options-builder.ts - About 3 hrs to fix

                AbuseListTableComponent has 26 functions (exceeds 20 allowed). Consider refactoring.
                Open

                @Component({
                  selector: 'my-abuse-list-table',
                  templateUrl: './abuse-list-table.component.html',
                  styleUrls: [ '../shared-moderation/moderation.scss', './abuse-list-table.component.scss' ],
                  standalone: true,
                Severity: Minor
                Found in client/src/app/shared/shared-abuse-list/abuse-list-table.component.ts - About 3 hrs to fix

                  VideoWatchPage has 26 functions (exceeds 20 allowed). Consider refactoring.
                  Open

                  export class VideoWatchPage {
                  
                    constructor (private isMobileDevice: boolean, private isSafari: boolean) {
                  
                    }
                  Severity: Minor
                  Found in client/e2e/src/po/video-watch.po.ts - About 3 hrs to fix

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

                        return this.authHttp
                                   .get<ResultList<Video>>(AccountService.BASE_ACCOUNT_URL + account.nameWithHost + '/videos', { params })
                                   .pipe(
                                     switchMap(res => this.extractVideos(res)),
                                     catchError(err => this.restExtractor.handleError(err))
                    Severity: Major
                    Found in client/src/app/shared/shared-main/video/video.service.ts and 1 other location - About 3 hrs to fix
                    client/src/app/shared/shared-main/video/video.service.ts on lines 206..211

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

                    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 formatFollowersJSON (
                        follows: {
                          createdAt: Date
                          followerHandle: string
                        }[],
                    server/core/lib/user-import-export/exporters/following-exporter.ts on lines 27..39

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

                    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

                    const averageBitPerPixel: BitPerPixel = {
                      [VideoResolution.H_NOVIDEO]: 0,
                      [VideoResolution.H_144P]: 0.19,
                      [VideoResolution.H_240P]: 0.17,
                      [VideoResolution.H_360P]: 0.15,
                    Severity: Major
                    Found in packages/core-utils/src/videos/bitrate.ts and 1 other location - About 3 hrs to fix
                    packages/core-utils/src/videos/bitrate.ts on lines 31..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 95.

                    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

                    const maxBitPerPixel: BitPerPixel = {
                      [VideoResolution.H_NOVIDEO]: 0,
                      [VideoResolution.H_144P]: 0.32,
                      [VideoResolution.H_240P]: 0.29,
                      [VideoResolution.H_360P]: 0.26,
                    Severity: Major
                    Found in packages/core-utils/src/videos/bitrate.ts and 1 other location - About 3 hrs to fix
                    packages/core-utils/src/videos/bitrate.ts on lines 19..29

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

                    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

                      {
                        await utils.queryInterface.addColumn('videoCaption', 'automaticallyGenerated', {
                          type: Sequelize.BOOLEAN,
                          defaultValue: false,
                          allowNull: false
                    server/core/initializers/migrations/0845-auto-tags.ts on lines 93..105

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

                    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

                      getVideoChannel (videoChannelName: string) {
                        return this.authHttp.get<VideoChannel>(VideoChannelService.BASE_VIDEO_CHANNEL_URL + videoChannelName)
                                   .pipe(
                                     map(videoChannelHash => new VideoChannel(videoChannelHash)),
                                     tap(videoChannel => this.videoChannelLoaded.next(videoChannel)),
                    client/src/app/shared/shared-main/account/account.service.ts on lines 21..28

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

                    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

                        this.meter.createObservableGauge('peertube_redundancy_available_bytes_total', {
                          description: 'Total redundancy available of the instance'
                        }).addCallback(async observableResult => {
                          const stats = await this.getInstanceStats()
                    
                    
                    server/core/lib/opentelemetry/metric-helpers/stats-observers-builder.ts on lines 134..142

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

                    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 formatFollowingJSON (
                        follows: {
                          createdAt: Date
                          followingHandle: string
                        }[],
                    server/core/lib/user-import-export/exporters/followers-exporter.ts on lines 32..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 95.

                    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

                        this.meter.createObservableGauge('peertube_redundancy_used_bytes_total', {
                          description: 'Total redundancy used of the instance'
                        }).addCallback(async observableResult => {
                          const stats = await this.getInstanceStats()
                    
                    
                    server/core/lib/opentelemetry/metric-helpers/stats-observers-builder.ts on lines 144..152

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

                    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