Chocobozzz/PeerTube

View on GitHub
server/core/lib/notifier/notifier.ts

Summary

Maintainability
F
1 wk
Test Coverage

Notifier has 28 functions (exceeds 20 allowed). Consider refactoring.
Open

class Notifier {

  private readonly notificationModels = {
    newVideoOrLive: [ NewVideoOrLiveForSubscribers ],
    publicationAfterTranscoding: [ OwnedPublicationAfterTranscoding ],
Severity: Minor
Found in server/core/lib/notifier/notifier.ts - About 3 hrs to fix

    File notifier.ts has 262 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    import { UserNotificationSettingValue, UserNotificationSettingValueType } from '@peertube/peertube-models'
    import { MRegistration, MUser, MUserDefault } from '@server/types/models/user/index.js'
    import { MVideoBlacklistLightVideo, MVideoBlacklistVideo } from '@server/types/models/video/video-blacklist.js'
    import { logger, loggerTagsFactory } from '../../helpers/logger.js'
    import { CONFIG } from '../../initializers/config.js'
    Severity: Minor
    Found in server/core/lib/notifier/notifier.ts - About 2 hrs to fix

      Function notify has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

        private async notify <T> (object: AbstractNotification<T>) {
          await object.prepare()
      
          const users = object.getTargetUsers()
      
      
      Severity: Minor
      Found in server/core/lib/notifier/notifier.ts - About 45 mins to fix

      Cognitive Complexity

      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

      A method's cognitive complexity is based on a few simple rules:

      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
      • Code is considered more complex for each "break in the linear flow of the code"
      • Code is considered more complex when "flow breaking structures are nested"

      Further reading

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

        notifyOnNewAbuse (payload: NewAbusePayload): void {
          const models = this.notificationModels.newAbuse
      
          logger.debug('Notify on new abuse', { abuse: payload.abuseInstance.id, ...lTags() })
      
      
      Severity: Major
      Found in server/core/lib/notifier/notifier.ts and 2 other locations - About 3 hrs to fix
      server/core/lib/notifier/notifier.ts on lines 218..225
      server/core/lib/notifier/notifier.ts on lines 227..234

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

      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

        notifyOfNewInstanceFollow (actorFollow: MActorFollowFull): void {
          const models = this.notificationModels.instanceFollow
      
          logger.debug('Notify on new instance follow', { follower: actorFollow.ActorFollower.url, ...lTags() })
      
      
      Severity: Major
      Found in server/core/lib/notifier/notifier.ts and 2 other locations - About 3 hrs to fix
      server/core/lib/notifier/notifier.ts on lines 139..146
      server/core/lib/notifier/notifier.ts on lines 227..234

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

      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

        notifyOfAutoInstanceFollowing (actorFollow: MActorFollowFull): void {
          const models = this.notificationModels.autoInstanceFollow
      
          logger.debug('Notify on new instance auto following', { following: actorFollow.ActorFollowing.url, ...lTags() })
      
      
      Severity: Major
      Found in server/core/lib/notifier/notifier.ts and 2 other locations - About 3 hrs to fix
      server/core/lib/notifier/notifier.ts on lines 139..146
      server/core/lib/notifier/notifier.ts on lines 218..225

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

      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

        notifyOnVideoBlacklist (videoBlacklist: MVideoBlacklistVideo): void {
          const models = this.notificationModels.newBlacklist
      
          logger.debug('Notify on video manual blacklist', { video: videoBlacklist?.Video?.url, ...lTags() })
      
      
      Severity: Major
      Found in server/core/lib/notifier/notifier.ts and 1 other location - About 3 hrs to fix
      server/core/lib/notifier/notifier.ts on lines 148..155

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

      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

        notifyOnVideoAutoBlacklist (videoBlacklist: MVideoBlacklistLightVideo): void {
          const models = this.notificationModels.newAutoBlacklist
      
          logger.debug('Notify on video auto blacklist', { video: videoBlacklist?.Video?.url, ...lTags() })
      
      
      Severity: Major
      Found in server/core/lib/notifier/notifier.ts and 1 other location - About 3 hrs to fix
      server/core/lib/notifier/notifier.ts on lines 157..164

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

      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 9 locations. Consider refactoring.
      Open

        notifyOnVideoPublishedAfterTranscoding (video: MVideoFullLight): void {
          const models = this.notificationModels.publicationAfterTranscoding
      
          logger.debug('Notify on published video after transcoding', { video: video.url, ...lTags() })
      
      
      Severity: Major
      Found in server/core/lib/notifier/notifier.ts and 8 other locations - About 3 hrs to fix
      server/core/lib/notifier/notifier.ts on lines 83..90
      server/core/lib/notifier/notifier.ts on lines 101..108
      server/core/lib/notifier/notifier.ts on lines 121..128
      server/core/lib/notifier/notifier.ts on lines 130..137
      server/core/lib/notifier/notifier.ts on lines 166..173
      server/core/lib/notifier/notifier.ts on lines 186..193
      server/core/lib/notifier/notifier.ts on lines 195..202
      server/core/lib/notifier/notifier.ts on lines 236..243

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

      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 9 locations. Consider refactoring.
      Open

        notifyOnNewVideoOrLiveIfNeeded (video: MVideoAccountLight): void {
          const models = this.notificationModels.newVideoOrLive
      
          logger.debug('Notify on new video or live if needed', { video: video.url, ...lTags() })
      
      
      Severity: Major
      Found in server/core/lib/notifier/notifier.ts and 8 other locations - About 3 hrs to fix
      server/core/lib/notifier/notifier.ts on lines 92..99
      server/core/lib/notifier/notifier.ts on lines 101..108
      server/core/lib/notifier/notifier.ts on lines 121..128
      server/core/lib/notifier/notifier.ts on lines 130..137
      server/core/lib/notifier/notifier.ts on lines 166..173
      server/core/lib/notifier/notifier.ts on lines 186..193
      server/core/lib/notifier/notifier.ts on lines 195..202
      server/core/lib/notifier/notifier.ts on lines 236..243

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

      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 9 locations. Consider refactoring.
      Open

        notifyOnVideoPublishedAfterScheduledUpdate (video: MVideoFullLight): void {
          const models = this.notificationModels.publicationAfterScheduleUpdate
      
          logger.debug('Notify on published video after scheduled update', { video: video.url, ...lTags() })
      
      
      Severity: Major
      Found in server/core/lib/notifier/notifier.ts and 8 other locations - About 3 hrs to fix
      server/core/lib/notifier/notifier.ts on lines 83..90
      server/core/lib/notifier/notifier.ts on lines 92..99
      server/core/lib/notifier/notifier.ts on lines 121..128
      server/core/lib/notifier/notifier.ts on lines 130..137
      server/core/lib/notifier/notifier.ts on lines 166..173
      server/core/lib/notifier/notifier.ts on lines 186..193
      server/core/lib/notifier/notifier.ts on lines 195..202
      server/core/lib/notifier/notifier.ts on lines 236..243

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

      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 9 locations. Consider refactoring.
      Open

        notifyOnNewDirectRegistration (user: MUserDefault): void {
          const models = this.notificationModels.directRegistration
      
          logger.debug('Notify on new direct registration', { user: user.username, ...lTags() })
      
      
      Severity: Major
      Found in server/core/lib/notifier/notifier.ts and 8 other locations - About 3 hrs to fix
      server/core/lib/notifier/notifier.ts on lines 83..90
      server/core/lib/notifier/notifier.ts on lines 92..99
      server/core/lib/notifier/notifier.ts on lines 101..108
      server/core/lib/notifier/notifier.ts on lines 121..128
      server/core/lib/notifier/notifier.ts on lines 130..137
      server/core/lib/notifier/notifier.ts on lines 166..173
      server/core/lib/notifier/notifier.ts on lines 195..202
      server/core/lib/notifier/notifier.ts on lines 236..243

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

      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 9 locations. Consider refactoring.
      Open

        notifyOnNewRegistrationRequest (registration: MRegistration): void {
          const models = this.notificationModels.registrationRequest
      
          logger.debug('Notify on new registration request', { registration: registration.username, ...lTags() })
      
      
      Severity: Major
      Found in server/core/lib/notifier/notifier.ts and 8 other locations - About 3 hrs to fix
      server/core/lib/notifier/notifier.ts on lines 83..90
      server/core/lib/notifier/notifier.ts on lines 92..99
      server/core/lib/notifier/notifier.ts on lines 101..108
      server/core/lib/notifier/notifier.ts on lines 121..128
      server/core/lib/notifier/notifier.ts on lines 130..137
      server/core/lib/notifier/notifier.ts on lines 166..173
      server/core/lib/notifier/notifier.ts on lines 186..193
      server/core/lib/notifier/notifier.ts on lines 236..243

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

      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 9 locations. Consider refactoring.
      Open

        notifyOnAbuseStateChange (abuse: MAbuseFull): void {
          const models = this.notificationModels.abuseStateChange
      
          logger.debug('Notify on abuse state change', { abuse: abuse.id, ...lTags() })
      
      
      Severity: Major
      Found in server/core/lib/notifier/notifier.ts and 8 other locations - About 3 hrs to fix
      server/core/lib/notifier/notifier.ts on lines 83..90
      server/core/lib/notifier/notifier.ts on lines 92..99
      server/core/lib/notifier/notifier.ts on lines 101..108
      server/core/lib/notifier/notifier.ts on lines 121..128
      server/core/lib/notifier/notifier.ts on lines 130..137
      server/core/lib/notifier/notifier.ts on lines 166..173
      server/core/lib/notifier/notifier.ts on lines 186..193
      server/core/lib/notifier/notifier.ts on lines 195..202

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

      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 9 locations. Consider refactoring.
      Open

        notifyOnNewComment (comment: MCommentOwnerVideo): void {
          const models = this.notificationModels.newComment
      
          logger.debug('Notify on new comment', { comment: comment.url, ...lTags() })
      
      
      Severity: Major
      Found in server/core/lib/notifier/notifier.ts and 8 other locations - About 3 hrs to fix
      server/core/lib/notifier/notifier.ts on lines 83..90
      server/core/lib/notifier/notifier.ts on lines 92..99
      server/core/lib/notifier/notifier.ts on lines 101..108
      server/core/lib/notifier/notifier.ts on lines 130..137
      server/core/lib/notifier/notifier.ts on lines 166..173
      server/core/lib/notifier/notifier.ts on lines 186..193
      server/core/lib/notifier/notifier.ts on lines 195..202
      server/core/lib/notifier/notifier.ts on lines 236..243

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

      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 9 locations. Consider refactoring.
      Open

        notifyOnVideoUnblacklist (video: MVideoFullLight): void {
          const models = this.notificationModels.unblacklist
      
          logger.debug('Notify on video unblacklist', { video: video.url, ...lTags() })
      
      
      Severity: Major
      Found in server/core/lib/notifier/notifier.ts and 8 other locations - About 3 hrs to fix
      server/core/lib/notifier/notifier.ts on lines 83..90
      server/core/lib/notifier/notifier.ts on lines 92..99
      server/core/lib/notifier/notifier.ts on lines 101..108
      server/core/lib/notifier/notifier.ts on lines 121..128
      server/core/lib/notifier/notifier.ts on lines 130..137
      server/core/lib/notifier/notifier.ts on lines 186..193
      server/core/lib/notifier/notifier.ts on lines 195..202
      server/core/lib/notifier/notifier.ts on lines 236..243

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

      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 9 locations. Consider refactoring.
      Open

        notifyOnNewCommentApproval (comment: MCommentOwnerVideo): void {
          const models = this.notificationModels.commentApproval
      
          logger.debug('Notify on comment approval', { comment: comment.url, ...lTags() })
      
      
      Severity: Major
      Found in server/core/lib/notifier/notifier.ts and 8 other locations - About 3 hrs to fix
      server/core/lib/notifier/notifier.ts on lines 83..90
      server/core/lib/notifier/notifier.ts on lines 92..99
      server/core/lib/notifier/notifier.ts on lines 101..108
      server/core/lib/notifier/notifier.ts on lines 121..128
      server/core/lib/notifier/notifier.ts on lines 166..173
      server/core/lib/notifier/notifier.ts on lines 186..193
      server/core/lib/notifier/notifier.ts on lines 195..202
      server/core/lib/notifier/notifier.ts on lines 236..243

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

      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

        notifyOfNewPluginVersion (plugin: MPlugin) {
          const models = this.notificationModels.newPluginVersion
      
          logger.debug('Notify on new plugin version', { plugin: plugin.name, ...lTags() })
      
      
      Severity: Major
      Found in server/core/lib/notifier/notifier.ts and 1 other location - About 3 hrs to fix
      server/core/lib/notifier/notifier.ts on lines 272..279

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

      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

        notifyOfFinishedVideoStudioEdition (video: MVideoFullLight) {
          const models = this.notificationModels.videoStudioEditionFinished
      
          logger.debug('Notify on finished video studio edition', { video: video.url, ...lTags() })
      
      
      Severity: Major
      Found in server/core/lib/notifier/notifier.ts and 1 other location - About 3 hrs to fix
      server/core/lib/notifier/notifier.ts on lines 263..270

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

      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

      There are no issues that match your filters.

      Category
      Status