Chocobozzz/PeerTube

View on GitHub

Showing 3,313 of 3,313 total issues

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

    this.queues['videos-views-stats'].add('job', {}, {
      repeat: REPEAT_JOBS['videos-views-stats'],

      ...this.buildJobRemovalOptions('videos-views-stats')
    }).catch(err => logger.error('Cannot add repeatable job.', { err }))
Severity: Major
Found in server/core/lib/job-queue/job-queue.ts and 1 other location - About 1 hr to fix
server/core/lib/job-queue/job-queue.ts on lines 531..535

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

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 type MAbuseAP =
  MAbuse &
  Pick<AbuseModel, 'toActivityPubObject'> &
  Use<'ReporterAccount', MAccountUrl> &
  Use<'FlaggedAccount', MAccountUrl> &
Severity: Major
Found in server/core/types/models/abuse/abuse.ts and 1 other location - About 1 hr to fix
server/core/types/models/abuse/abuse.ts on lines 83..89

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

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 ffmpegVod.transcode({
      type: 'merge-audio',

      audioPath,
      videoInputPath: previewPath,
apps/peertube-runner/src/server/process/shared/process-vod.ts on lines 52..64

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

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

  deleteVideoImport (videoImport: VideoImport) {
    return this.authHttp.delete(VideoImportService.BASE_VIDEO_IMPORT_URL + videoImport.id)
                        .pipe(catchError(err => this.restExtractor.handleError(err)))
  }
client/src/app/shared/shared-main/channel/video-channel.service.ts on lines 104..107

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

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.queues['activitypub-cleaner'].add('job', {}, {
        repeat: REPEAT_JOBS['activitypub-cleaner'],

        ...this.buildJobRemovalOptions('activitypub-cleaner')
      }).catch(err => logger.error('Cannot add repeatable job.', { err }))
Severity: Major
Found in server/core/lib/job-queue/job-queue.ts and 1 other location - About 1 hr to fix
server/core/lib/job-queue/job-queue.ts on lines 524..528

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

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

  removeVideoChannel (videoChannel: VideoChannel) {
    return this.authHttp.delete(VideoChannelService.BASE_VIDEO_CHANNEL_URL + videoChannel.nameWithHost)
               .pipe(catchError(err => this.restExtractor.handleError(err)))
  }
client/src/app/shared/shared-main/video/video-import.service.ts on lines 71..74

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

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 type MAbuseFull =
  MAbuse &
  Pick<AbuseModel, 'toActivityPubObject'> &
  Use<'ReporterAccount', MAccountLight> &
  Use<'FlaggedAccount', MAccountLight> &
Severity: Major
Found in server/core/types/models/abuse/abuse.ts and 1 other location - About 1 hr to fix
server/core/types/models/abuse/abuse.ts on lines 108..114

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

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

    const getQuery = (forCount: boolean) => {
      const query: FindOptions = {
        offset: start,
        limit: count,
        order: getSort(sort),
Severity: Minor
Found in server/core/models/account/account-blocklist.ts - About 1 hr to fix

    Function up has 43 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    async function up (utils: {
      transaction: Sequelize.Transaction
      queryInterface: Sequelize.QueryInterface
      sequelize: Sequelize.Sequelize
    }): Promise<void> {
    Severity: Minor
    Found in server/core/initializers/migrations/0855-transcription.ts - About 1 hr to fix

      Function updateMe has 43 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      async function updateMe (req: express.Request, res: express.Response) {
        const body: UserUpdateMe = req.body
        let sendVerificationEmail = false
      
        const user = res.locals.oauth.token.user
      Severity: Minor
      Found in server/core/controllers/api/users/me.ts - About 1 hr to fix

        Function export has 43 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          async export () {
            const playlistsJSON: VideoPlaylistsExportJSON['videoPlaylists'] = []
            const staticFiles: ExportResult<VideoPlaylistsExportJSON>['staticFiles'] = []
        
            const playlists = await VideoPlaylistModel.listPlaylistForExport(this.user.Account.id)

          Function export has 43 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            async export (exportModel: MUserExport) {
              try {
                exportModel.state = UserExportState.PROCESSING
                await saveInTransactionWithRetries(exportModel)
          
          
          Severity: Minor
          Found in server/core/lib/user-import-export/user-exporter.ts - About 1 hr to fix

            Function muxToMergeVideoFiles has 43 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            export async function muxToMergeVideoFiles (options: {
              video: MVideoThumbnail
              videoFiles: MVideoFile[]
              output: Writable
            }) {
            Severity: Minor
            Found in server/core/lib/video-file.ts - About 1 hr to fix

              Function metricsInterval has 43 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  this.metricsInterval = setInterval(() => {
                    let resolution: number
                    let fps: number
              
                    if (this.player.usingPlugin('p2pMediaLoader')) {
              Severity: Minor
              Found in client/src/assets/player/shared/metrics/metrics-plugin.ts - About 1 hr to fix

                Function prepare has 43 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                async function prepare () {
                  pool = new Piscina({
                    filename: join(dirname(fileURLToPath(import.meta.url)), 'simulate-many-viewers-worker.js'),
                    minThreads: 20,
                    maxThreads: 20
                Severity: Minor
                Found in scripts/simulate-many-viewers.ts - About 1 hr to fix

                  Function ngOnInit has 43 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    ngOnInit () {
                      this.initialize()
                  
                      this.bulkActions = [
                        [

                    Function getVideoAttributesFromObject has 43 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    export function getVideoAttributesFromObject (videoChannel: MChannelId, videoObject: VideoObject, to: string[] = []) {
                      const privacy = hasAPPublic(to)
                        ? VideoPrivacy.PUBLIC
                        : VideoPrivacy.UNLISTED
                    
                    

                      Function buildGroupedDateLabels has 43 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                        buildGroupedDateLabels () {
                          let currentGroupedDate: GroupDate = GroupDate.UNKNOWN
                      
                          const periods = [
                            {

                        Function onFingerSwipe has 43 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                          onFingerSwipe (direction: 'left' | 'right' | 'up' | 'down', action: () => void, removeEventOnEnd = true) {
                            let touchDownClientX: number
                            let touchDownClientY: number
                        
                            const onTouchStart = (event: TouchEvent) => {
                        Severity: Minor
                        Found in client/src/app/core/wrappers/screen.service.ts - About 1 hr to fix

                          Function reloadDataInternal has 43 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                            protected reloadDataInternal () {
                              debugLogger('Loading data.')
                          
                              const options = {
                                pagination: this.pagination,
                            Severity
                            Category
                            Status
                            Source
                            Language