Chocobozzz/PeerTube

View on GitHub
client/src/app/core/menu/menu.service.ts

Summary

Maintainability
C
1 day
Test Coverage

Function buildLibraryLinks has 41 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  buildLibraryLinks (userCanSeeVideosLink: boolean): MenuSection {
    let links: MenuLink[] = []

    if (userCanSeeVideosLink) {
      links.push({
Severity: Minor
Found in client/src/app/core/menu/menu.service.ts - About 1 hr to fix

    Function buildCommonLinks has 40 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      buildCommonLinks (config: HTMLServerConfig): MenuSection {
        let links: MenuLink[] = []
    
        if (config.homepage.enabled) {
          links.push({
    Severity: Minor
    Found in client/src/app/core/menu/menu.service.ts - About 1 hr to fix

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

            {
              icon: 'globe' as 'globe',
              label: $localize`Discover videos`,
              shortLabel: $localize`Discover`,
              path: '/videos/overview'
      Severity: Major
      Found in client/src/app/core/menu/menu.service.ts and 4 other locations - About 35 mins to fix
      client/src/app/core/menu/menu.service.ts on lines 122..127
      client/src/app/core/menu/menu.service.ts on lines 137..142
      client/src/app/core/menu/menu.service.ts on lines 143..148
      client/src/app/core/menu/menu.service.ts on lines 149..154

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

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

            {
              icon: 'trending' as 'trending',
              label: $localize`Trending videos`,
              shortLabel: $localize`Trending`,
              path: '/videos/trending'
      Severity: Major
      Found in client/src/app/core/menu/menu.service.ts and 4 other locations - About 35 mins to fix
      client/src/app/core/menu/menu.service.ts on lines 122..127
      client/src/app/core/menu/menu.service.ts on lines 131..136
      client/src/app/core/menu/menu.service.ts on lines 143..148
      client/src/app/core/menu/menu.service.ts on lines 149..154

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

      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

            {
              path: '/videos/subscriptions',
              icon: 'subscriptions' as GlobalIconName,
              shortLabel: $localize`Subscriptions`,
              label: $localize`My subscriptions`
      Severity: Major
      Found in client/src/app/core/menu/menu.service.ts and 3 other locations - About 35 mins to fix
      client/src/app/core/menu/menu.service.ts on lines 82..87
      client/src/app/core/menu/menu.service.ts on lines 91..96
      client/src/app/core/menu/menu.service.ts on lines 103..108

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

      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

            {
              path: '/my-library/video-playlists',
              icon: 'playlists' as GlobalIconName,
              shortLabel: $localize`Playlists`,
              label: $localize`My playlists`
      Severity: Major
      Found in client/src/app/core/menu/menu.service.ts and 3 other locations - About 35 mins to fix
      client/src/app/core/menu/menu.service.ts on lines 82..87
      client/src/app/core/menu/menu.service.ts on lines 97..102
      client/src/app/core/menu/menu.service.ts on lines 103..108

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

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

            links.push({
              icon: 'home' as 'home',
              label: $localize`Home`,
              shortLabel: $localize`Home`,
              path: '/home'
      Severity: Major
      Found in client/src/app/core/menu/menu.service.ts and 4 other locations - About 35 mins to fix
      client/src/app/core/menu/menu.service.ts on lines 131..136
      client/src/app/core/menu/menu.service.ts on lines 137..142
      client/src/app/core/menu/menu.service.ts on lines 143..148
      client/src/app/core/menu/menu.service.ts on lines 149..154

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

      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

            links.push({
              path: '/my-library/videos',
              icon: 'videos' as GlobalIconName,
              shortLabel: $localize`Videos`,
              label: $localize`My videos`
      Severity: Major
      Found in client/src/app/core/menu/menu.service.ts and 3 other locations - About 35 mins to fix
      client/src/app/core/menu/menu.service.ts on lines 91..96
      client/src/app/core/menu/menu.service.ts on lines 97..102
      client/src/app/core/menu/menu.service.ts on lines 103..108

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

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

            {
              icon: 'add' as 'add',
              label: $localize`Recently added videos`,
              shortLabel: $localize`Recently added`,
              path: '/videos/recently-added'
      Severity: Major
      Found in client/src/app/core/menu/menu.service.ts and 4 other locations - About 35 mins to fix
      client/src/app/core/menu/menu.service.ts on lines 122..127
      client/src/app/core/menu/menu.service.ts on lines 131..136
      client/src/app/core/menu/menu.service.ts on lines 137..142
      client/src/app/core/menu/menu.service.ts on lines 149..154

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

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

            {
              icon: 'local' as 'local',
              label: $localize`Local videos`,
              shortLabel: $localize`Local videos`,
              path: '/videos/local'
      Severity: Major
      Found in client/src/app/core/menu/menu.service.ts and 4 other locations - About 35 mins to fix
      client/src/app/core/menu/menu.service.ts on lines 122..127
      client/src/app/core/menu/menu.service.ts on lines 131..136
      client/src/app/core/menu/menu.service.ts on lines 137..142
      client/src/app/core/menu/menu.service.ts on lines 143..148

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

      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

            {
              path: '/my-library/history/videos',
              icon: 'history' as GlobalIconName,
              shortLabel: $localize`History`,
              label: $localize`My history`
      Severity: Major
      Found in client/src/app/core/menu/menu.service.ts and 3 other locations - About 35 mins to fix
      client/src/app/core/menu/menu.service.ts on lines 82..87
      client/src/app/core/menu/menu.service.ts on lines 91..96
      client/src/app/core/menu/menu.service.ts on lines 97..102

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

      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