Chocobozzz/PeerTube

View on GitHub
client/src/app/shared/shared-moderation/user-moderation-dropdown.component.ts

Summary

Maintainability
F
1 wk
Test Coverage

File user-moderation-dropdown.component.ts has 352 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import { Component, EventEmitter, Input, OnChanges, OnInit, Output, ViewChild } from '@angular/core'
import { AuthService, ConfirmService, Notifier, ServerService } from '@app/core'
import { BulkRemoveCommentsOfBody, User, UserRight } from '@peertube/peertube-models'
import { BlocklistService } from './blocklist.service'
import { BulkService } from './bulk.service'

    Function buildInstanceModerationActions has 79 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      private buildInstanceModerationActions () {
        if (!this.authService.isLoggedIn()) return []
    
        const authUser = this.authService.getUser()
    
    

      UserModerationDropdownComponent has 23 functions (exceeds 20 allowed). Consider refactoring.
      Open

      @Component({
        selector: 'my-user-moderation-dropdown',
        templateUrl: './user-moderation-dropdown.component.html',
        standalone: true,
        imports: [ NgIf, UserBanModalComponent, ActionDropdownComponent ]

        Function buildMyAccountModerationActions has 39 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          private buildMyAccountModerationActions () {
            if (!this.account || !this.displayOptions.myAccount || !this.authService.isLoggedIn()) return []
        
            const myAccountActions: DropdownAction<{ user: User, account: AccountMutedStatus }>[] = [
              {

          Consider simplifying this complex logical expression.
          Open

              if (this.user && this.displayOptions.instanceUser && authUser.hasRight(UserRight.MANAGE_USERS) && authUser.canManage(this.user)) {
                instanceActions = instanceActions.concat([
                  {
                    label: $localize`Edit user`,
                    description: $localize`Change quota, role, and more.`,

            Function buildInstanceModerationActions has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

              private buildInstanceModerationActions () {
                if (!this.authService.isLoggedIn()) return []
            
                const authUser = this.authService.getUser()
            
            

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

              unblockAccountByUser (account: AccountMutedStatus) {
                this.blocklistService.unblockAccountByUser(account)
                    .subscribe({
                      next: () => {
                        this.notifier.success($localize`Account ${account.nameWithHost} unmuted.`)
            client/src/app/shared/shared-moderation/user-moderation-dropdown.component.ts on lines 135..147
            client/src/app/shared/shared-moderation/user-moderation-dropdown.component.ts on lines 191..203
            client/src/app/shared/shared-moderation/user-moderation-dropdown.component.ts on lines 205..217

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

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

              unblockAccountByInstance (account: AccountMutedStatus) {
                this.blocklistService.unblockAccountByInstance(account)
                    .subscribe({
                      next: () => {
                        this.notifier.success($localize`Account ${account.nameWithHost} unmuted by the instance.`)
            client/src/app/shared/shared-moderation/user-moderation-dropdown.component.ts on lines 135..147
            client/src/app/shared/shared-moderation/user-moderation-dropdown.component.ts on lines 149..161
            client/src/app/shared/shared-moderation/user-moderation-dropdown.component.ts on lines 191..203

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

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

              blockAccountByInstance (account: AccountMutedStatus) {
                this.blocklistService.blockAccountByInstance(account)
                    .subscribe({
                      next: () => {
                        this.notifier.success($localize`Account ${account.nameWithHost} muted by the instance.`)
            client/src/app/shared/shared-moderation/user-moderation-dropdown.component.ts on lines 135..147
            client/src/app/shared/shared-moderation/user-moderation-dropdown.component.ts on lines 149..161
            client/src/app/shared/shared-moderation/user-moderation-dropdown.component.ts on lines 205..217

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

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

              blockAccountByUser (account: AccountMutedStatus) {
                this.blocklistService.blockAccountByUser(account)
                    .subscribe({
                      next: () => {
                        this.notifier.success($localize`Account ${account.nameWithHost} muted.`)
            client/src/app/shared/shared-moderation/user-moderation-dropdown.component.ts on lines 149..161
            client/src/app/shared/shared-moderation/user-moderation-dropdown.component.ts on lines 191..203
            client/src/app/shared/shared-moderation/user-moderation-dropdown.component.ts on lines 205..217

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

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

              unblockServerByUser (host: string) {
                this.blocklistService.unblockServerByUser(host)
                    .subscribe({
                      next: () => {
                        this.notifier.success($localize`Instance ${host} unmuted.`)
            client/src/app/shared/shared-moderation/user-moderation-dropdown.component.ts on lines 163..175
            client/src/app/shared/shared-moderation/user-moderation-dropdown.component.ts on lines 219..231
            client/src/app/shared/shared-moderation/user-moderation-dropdown.component.ts on lines 233..245

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

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

              blockServerByInstance (host: string) {
                this.blocklistService.blockServerByInstance(host)
                    .subscribe({
                      next: () => {
                        this.notifier.success($localize`Instance ${host} muted by the instance.`)
            client/src/app/shared/shared-moderation/user-moderation-dropdown.component.ts on lines 163..175
            client/src/app/shared/shared-moderation/user-moderation-dropdown.component.ts on lines 177..189
            client/src/app/shared/shared-moderation/user-moderation-dropdown.component.ts on lines 233..245

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

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

              unblockServerByInstance (host: string) {
                this.blocklistService.unblockServerByInstance(host)
                    .subscribe({
                      next: () => {
                        this.notifier.success($localize`Instance ${host} unmuted by the instance.`)
            client/src/app/shared/shared-moderation/user-moderation-dropdown.component.ts on lines 163..175
            client/src/app/shared/shared-moderation/user-moderation-dropdown.component.ts on lines 177..189
            client/src/app/shared/shared-moderation/user-moderation-dropdown.component.ts on lines 219..231

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

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

              blockServerByUser (host: string) {
                this.blocklistService.blockServerByUser(host)
                    .subscribe({
                      next: () => {
                        this.notifier.success($localize`Instance ${host} muted.`)
            client/src/app/shared/shared-moderation/user-moderation-dropdown.component.ts on lines 177..189
            client/src/app/shared/shared-moderation/user-moderation-dropdown.component.ts on lines 219..231
            client/src/app/shared/shared-moderation/user-moderation-dropdown.component.ts on lines 233..245

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

            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.userAdminService.unbanUsers(user)
                    .subscribe({
                      next: () => {
                        this.notifier.success($localize`User ${user.username} unbanned.`)
                        this.userChanged.emit()
            client/src/app/shared/shared-moderation/user-moderation-dropdown.component.ts on lines 112..120

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

            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.userAdminService.removeUsers(user)
                  .subscribe({
                    next: () => {
                      this.notifier.success($localize`User ${user.username} deleted.`)
                      this.userDeleted.emit()
            client/src/app/shared/shared-moderation/user-moderation-dropdown.component.ts on lines 90..98

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

            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

                    {
                      label: $localize`Remove comments from your instance`,
                      description: $localize`Remove comments made by this account from your instance.`,
                      isDisplayed: ({ account }) => !this.isMyAccount(account),
                      handler: ({ account }) => this.bulkRemoveCommentsOf({ accountName: account.nameWithHost, scope: 'instance' })
            client/src/app/shared/shared-moderation/user-moderation-dropdown.component.ts on lines 323..328

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

            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

                  {
                    label: $localize`Remove comments from your videos`,
                    description: $localize`Remove comments made by this account on your videos.`,
                    isDisplayed: ({ account }) => !this.isMyAccount(account),
                    handler: ({ account }) => this.bulkRemoveCommentsOf({ accountName: account.nameWithHost, scope: 'my-videos' })
            client/src/app/shared/shared-moderation/user-moderation-dropdown.component.ts on lines 412..417

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

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

                    {
                      label: $localize`Unmute this account`,
                      description: $localize`Show this user's content to the users of this instance again.`,
                      isDisplayed: ({ account }) => !this.isMyAccount(account) && account.mutedByInstance === true,
                      handler: ({ account }) => this.unblockAccountByInstance(account)
            client/src/app/shared/shared-moderation/user-moderation-dropdown.component.ts on lines 299..304
            client/src/app/shared/shared-moderation/user-moderation-dropdown.component.ts on lines 305..310
            client/src/app/shared/shared-moderation/user-moderation-dropdown.component.ts on lines 377..382

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

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

                  {
                    label: $localize`Unmute this account`,
                    description: $localize`Show back content from that user for you.`,
                    isDisplayed: ({ account }) => !this.isMyAccount(account) && account.mutedByUser === true,
                    handler: ({ account }) => this.unblockAccountByUser(account)
            client/src/app/shared/shared-moderation/user-moderation-dropdown.component.ts on lines 299..304
            client/src/app/shared/shared-moderation/user-moderation-dropdown.component.ts on lines 377..382
            client/src/app/shared/shared-moderation/user-moderation-dropdown.component.ts on lines 383..388

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

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

                    {
                      label: $localize`Unmute the instance by your instance`,
                      description: $localize`Show back content from that instance for you, your instance and its users.`,
                      isDisplayed: ({ account }) => !account.userId && account.mutedServerByInstance === true,
                      handler: ({ account }) => this.unblockServerByInstance(account.host)
            client/src/app/shared/shared-moderation/user-moderation-dropdown.component.ts on lines 311..316
            client/src/app/shared/shared-moderation/user-moderation-dropdown.component.ts on lines 317..322
            client/src/app/shared/shared-moderation/user-moderation-dropdown.component.ts on lines 395..400

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

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

                  {
                    label: $localize`Mute this account`,
                    description: $localize`Hide any content from that user from you.`,
                    isDisplayed: ({ account }) => !this.isMyAccount(account) && account.mutedByUser === false,
                    handler: ({ account }) => this.blockAccountByUser(account)
            client/src/app/shared/shared-moderation/user-moderation-dropdown.component.ts on lines 305..310
            client/src/app/shared/shared-moderation/user-moderation-dropdown.component.ts on lines 377..382
            client/src/app/shared/shared-moderation/user-moderation-dropdown.component.ts on lines 383..388

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

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

                  {
                    label: $localize`Unmute the instance`,
                    description: $localize`Show back content from that instance for you.`,
                    isDisplayed: ({ account }) => !account.userId && account.mutedServerByUser === true,
                    handler: ({ account }) => this.unblockServerByUser(account.host)
            client/src/app/shared/shared-moderation/user-moderation-dropdown.component.ts on lines 311..316
            client/src/app/shared/shared-moderation/user-moderation-dropdown.component.ts on lines 395..400
            client/src/app/shared/shared-moderation/user-moderation-dropdown.component.ts on lines 401..406

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

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

                    {
                      label: $localize`Mute the instance`,
                      description: $localize`Hide any content from that instance from you, your instance and its users.`,
                      isDisplayed: ({ account }) => !account.userId && account.mutedServerByInstance === false,
                      handler: ({ account }) => this.blockServerByInstance(account.host)
            client/src/app/shared/shared-moderation/user-moderation-dropdown.component.ts on lines 311..316
            client/src/app/shared/shared-moderation/user-moderation-dropdown.component.ts on lines 317..322
            client/src/app/shared/shared-moderation/user-moderation-dropdown.component.ts on lines 401..406

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

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

                    {
                      label: $localize`Mute this account`,
                      description: $localize`Hide any content from that user from you, your instance and its users.`,
                      isDisplayed: ({ account }) => !this.isMyAccount(account) && account.mutedByInstance === false,
                      handler: ({ account }) => this.blockAccountByInstance(account)
            client/src/app/shared/shared-moderation/user-moderation-dropdown.component.ts on lines 299..304
            client/src/app/shared/shared-moderation/user-moderation-dropdown.component.ts on lines 305..310
            client/src/app/shared/shared-moderation/user-moderation-dropdown.component.ts on lines 383..388

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

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

                  {
                    label: $localize`Mute the instance`,
                    description: $localize`Hide any content from that instance for you.`,
                    isDisplayed: ({ account }) => !account.userId && account.mutedServerByUser === false,
                    handler: ({ account }) => this.blockServerByUser(account.host)
            client/src/app/shared/shared-moderation/user-moderation-dropdown.component.ts on lines 317..322
            client/src/app/shared/shared-moderation/user-moderation-dropdown.component.ts on lines 395..400
            client/src/app/shared/shared-moderation/user-moderation-dropdown.component.ts on lines 401..406

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

            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

              constructor (
                private authService: AuthService,
                private notifier: Notifier,
                private confirmService: ConfirmService,
                private serverService: ServerService,
            client/src/app/+my-library/my-video-playlists/my-video-playlist-elements.component.ts on lines 54..62
            client/src/app/shared/shared-video-miniature/videos-list.component.ts on lines 148..158

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

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

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

                this.bulkService.removeCommentsOf(body)
                    .subscribe({
                      next: () => {
                        this.notifier.success($localize`Will remove comments of this account (may take several minutes).`)
                      },
            client/src/app/+admin/plugins/plugin-show-installed/plugin-show-installed.component.ts on lines 58..65
            client/src/app/+my-account/my-account-auto-tag-policies/my-account-auto-tag-policies.component.ts on lines 45..54

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

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

                const res = await this.confirmService.confirm($localize`Do you really want to unban ${user.username}?`, $localize`Unban`)
            client/src/app/+admin/plugins/plugin-list-installed/plugin-list-installed.component.ts on lines 136..139
            client/src/app/+my-library/my-video-playlists/my-video-playlist-elements.component.ts on lines 146..149
            client/src/app/+my-library/my-video-playlists/my-video-playlists.component.ts on lines 57..60

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

            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